Built SDL2_image and _mixer static

This commit is contained in:
2022-09-30 15:49:16 -04:00
parent e2605bf6c1
commit 1dec4347e0
4473 changed files with 1964551 additions and 9 deletions

View File

@ -0,0 +1,34 @@
## Process this file with automake to produce Makefile.in
AUTOMAKE_OPTIONS = foreign
INCLUDES = -I$(top_srcdir)/include @OGG_CFLAGS@
noinst_PROGRAMS = decoder_example encoder_example chaining_example\
vorbisfile_example seeking_example
EXTRA_DIST = frameview.pl
# uncomment to build static executables from the example code
#LDFLAGS = -all-static
decoder_example_SOURCES = decoder_example.c
decoder_example_LDADD = $(top_builddir)/lib/libvorbis.la
encoder_example_SOURCES = encoder_example.c
encoder_example_LDADD = $(top_builddir)/lib/libvorbisenc.la $(top_builddir)/lib/libvorbis.la
chaining_example_SOURCES = chaining_example.c
chaining_example_LDADD = $(top_builddir)/lib/libvorbisfile.la $(top_builddir)/lib/libvorbis.la
vorbisfile_example_SOURCES = vorbisfile_example.c
vorbisfile_example_LDADD = $(top_builddir)/lib/libvorbisfile.la $(top_builddir)/lib/libvorbis.la
seeking_example_SOURCES = seeking_example.c
seeking_example_LDADD = $(top_builddir)/lib/libvorbisfile.la $(top_builddir)/lib/libvorbis.la
debug:
$(MAKE) all CFLAGS="@DEBUG@"
profile:
$(MAKE) all CFLAGS="@PROFILE@"

View File

@ -0,0 +1,673 @@
# Makefile.in generated by automake 1.15 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2014 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@
VPATH = @srcdir@
am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \
false; \
elif test -n '$(MAKE_HOST)'; then \
true; \
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
true; \
else \
false; \
fi; \
}
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
*) echo "am__make_running_with_option: internal error: invalid" \
"target option '$${target_option-}' specified" >&2; \
exit 1;; \
esac; \
has_opt=no; \
sane_makeflags=$$MAKEFLAGS; \
if $(am__is_gnu_make); then \
sane_makeflags=$$MFLAGS; \
else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
bs=\\; \
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
esac; \
fi; \
skip_next=no; \
strip_trailopt () \
{ \
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
}; \
for flg in $$sane_makeflags; do \
test $$skip_next = yes && { skip_next=no; continue; }; \
case $$flg in \
*=*|--*) continue;; \
-*I) strip_trailopt 'I'; skip_next=yes;; \
-*I?*) strip_trailopt 'I';; \
-*O) strip_trailopt 'O'; skip_next=yes;; \
-*O?*) strip_trailopt 'O';; \
-*l) strip_trailopt 'l'; skip_next=yes;; \
-*l?*) strip_trailopt 'l';; \
-[dEDm]) skip_next=yes;; \
-[JT]) skip_next=yes;; \
esac; \
case $$flg in \
*$$target_option*) has_opt=yes; break;; \
esac; \
done; \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
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 = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
noinst_PROGRAMS = decoder_example$(EXEEXT) encoder_example$(EXEEXT) \
chaining_example$(EXEEXT) vorbisfile_example$(EXEEXT) \
seeking_example$(EXEEXT)
subdir = examples
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/add_cflags.m4 \
$(top_srcdir)/m4/ogg.m4 $(top_srcdir)/m4/pkg.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
PROGRAMS = $(noinst_PROGRAMS)
am_chaining_example_OBJECTS = chaining_example.$(OBJEXT)
chaining_example_OBJECTS = $(am_chaining_example_OBJECTS)
chaining_example_DEPENDENCIES = $(top_builddir)/lib/libvorbisfile.la \
$(top_builddir)/lib/libvorbis.la
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
am__v_lt_0 = --silent
am__v_lt_1 =
am_decoder_example_OBJECTS = decoder_example.$(OBJEXT)
decoder_example_OBJECTS = $(am_decoder_example_OBJECTS)
decoder_example_DEPENDENCIES = $(top_builddir)/lib/libvorbis.la
am_encoder_example_OBJECTS = encoder_example.$(OBJEXT)
encoder_example_OBJECTS = $(am_encoder_example_OBJECTS)
encoder_example_DEPENDENCIES = $(top_builddir)/lib/libvorbisenc.la \
$(top_builddir)/lib/libvorbis.la
am_seeking_example_OBJECTS = seeking_example.$(OBJEXT)
seeking_example_OBJECTS = $(am_seeking_example_OBJECTS)
seeking_example_DEPENDENCIES = $(top_builddir)/lib/libvorbisfile.la \
$(top_builddir)/lib/libvorbis.la
am_vorbisfile_example_OBJECTS = vorbisfile_example.$(OBJEXT)
vorbisfile_example_OBJECTS = $(am_vorbisfile_example_OBJECTS)
vorbisfile_example_DEPENDENCIES = \
$(top_builddir)/lib/libvorbisfile.la \
$(top_builddir)/lib/libvorbis.la
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
am__v_GEN_1 =
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
am__v_at_1 =
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
AM_V_CC = $(am__v_CC_@AM_V@)
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
am__v_CC_0 = @echo " CC " $@;
am__v_CC_1 =
CCLD = $(CC)
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
am__v_CCLD_1 =
SOURCES = $(chaining_example_SOURCES) $(decoder_example_SOURCES) \
$(encoder_example_SOURCES) $(seeking_example_SOURCES) \
$(vorbisfile_example_SOURCES)
DIST_SOURCES = $(chaining_example_SOURCES) $(decoder_example_SOURCES) \
$(encoder_example_SOURCES) $(seeking_example_SOURCES) \
$(vorbisfile_example_SOURCES)
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
# Read a list of newline-separated strings from the standard input,
# and print each of them once, without duplicates. Input order is
# *not* preserved.
am__uniquify_input = $(AWK) '\
BEGIN { nonempty = 0; } \
{ items[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in items) print i; }; } \
'
# Make sure the list of sources is unique. This is necessary because,
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
list='$(am__tagged_files)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@
ALLOCA = @ALLOCA@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
AS = @AS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG = @DEBUG@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
HAVE_DOXYGEN = @HAVE_DOXYGEN@
HTLATEX = @HTLATEX@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIBTOOL_DEPS = @LIBTOOL_DEPS@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OGG_CFLAGS = @OGG_CFLAGS@
OGG_LIBS = @OGG_LIBS@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PDFLATEX = @PDFLATEX@
PKG_CONFIG = @PKG_CONFIG@
PROFILE = @PROFILE@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
VE_LIB_AGE = @VE_LIB_AGE@
VE_LIB_CURRENT = @VE_LIB_CURRENT@
VE_LIB_REVISION = @VE_LIB_REVISION@
VF_LIB_AGE = @VF_LIB_AGE@
VF_LIB_CURRENT = @VF_LIB_CURRENT@
VF_LIB_REVISION = @VF_LIB_REVISION@
VORBIS_LIBS = @VORBIS_LIBS@
V_LIB_AGE = @V_LIB_AGE@
V_LIB_CURRENT = @V_LIB_CURRENT@
V_LIB_REVISION = @V_LIB_REVISION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
pthread_lib = @pthread_lib@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
AUTOMAKE_OPTIONS = foreign
INCLUDES = -I$(top_srcdir)/include @OGG_CFLAGS@
EXTRA_DIST = frameview.pl
# uncomment to build static executables from the example code
#LDFLAGS = -all-static
decoder_example_SOURCES = decoder_example.c
decoder_example_LDADD = $(top_builddir)/lib/libvorbis.la
encoder_example_SOURCES = encoder_example.c
encoder_example_LDADD = $(top_builddir)/lib/libvorbisenc.la $(top_builddir)/lib/libvorbis.la
chaining_example_SOURCES = chaining_example.c
chaining_example_LDADD = $(top_builddir)/lib/libvorbisfile.la $(top_builddir)/lib/libvorbis.la
vorbisfile_example_SOURCES = vorbisfile_example.c
vorbisfile_example_LDADD = $(top_builddir)/lib/libvorbisfile.la $(top_builddir)/lib/libvorbis.la
seeking_example_SOURCES = seeking_example.c
seeking_example_LDADD = $(top_builddir)/lib/libvorbisfile.la $(top_builddir)/lib/libvorbis.la
all: all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign examples/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign examples/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: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
clean-noinstPROGRAMS:
@list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \
echo " rm -f" $$list; \
rm -f $$list || exit $$?; \
test -n "$(EXEEXT)" || exit 0; \
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
echo " rm -f" $$list; \
rm -f $$list
chaining_example$(EXEEXT): $(chaining_example_OBJECTS) $(chaining_example_DEPENDENCIES) $(EXTRA_chaining_example_DEPENDENCIES)
@rm -f chaining_example$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(chaining_example_OBJECTS) $(chaining_example_LDADD) $(LIBS)
decoder_example$(EXEEXT): $(decoder_example_OBJECTS) $(decoder_example_DEPENDENCIES) $(EXTRA_decoder_example_DEPENDENCIES)
@rm -f decoder_example$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(decoder_example_OBJECTS) $(decoder_example_LDADD) $(LIBS)
encoder_example$(EXEEXT): $(encoder_example_OBJECTS) $(encoder_example_DEPENDENCIES) $(EXTRA_encoder_example_DEPENDENCIES)
@rm -f encoder_example$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(encoder_example_OBJECTS) $(encoder_example_LDADD) $(LIBS)
seeking_example$(EXEEXT): $(seeking_example_OBJECTS) $(seeking_example_DEPENDENCIES) $(EXTRA_seeking_example_DEPENDENCIES)
@rm -f seeking_example$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(seeking_example_OBJECTS) $(seeking_example_LDADD) $(LIBS)
vorbisfile_example$(EXEEXT): $(vorbisfile_example_OBJECTS) $(vorbisfile_example_DEPENDENCIES) $(EXTRA_vorbisfile_example_DEPENDENCIES)
@rm -f vorbisfile_example$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(vorbisfile_example_OBJECTS) $(vorbisfile_example_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chaining_example.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/decoder_example.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/encoder_example.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/seeking_example.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vorbisfile_example.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
.c.obj:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
.c.lo:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
ID: $(am__tagged_files)
$(am__define_uniq_tagged_files); mkid -fID $$unique
tags: tags-am
TAGS: tags
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
set x; \
here=`pwd`; \
$(am__define_uniq_tagged_files); \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: ctags-am
CTAGS: ctags
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
$(am__define_uniq_tagged_files); \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
cscopelist: cscopelist-am
cscopelist-am: $(am__tagged_files)
list='$(am__tagged_files)'; \
case "$(srcdir)" in \
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
*) sdir=$(subdir)/$(srcdir) ;; \
esac; \
for i in $$list; do \
if test -f "$$i"; then \
echo "$(subdir)/$$i"; \
else \
echo "$$sdir/$$i"; \
fi; \
done >> $(top_builddir)/cscope.files
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)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$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 $(PROGRAMS)
installdirs:
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:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_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-libtool clean-noinstPROGRAMS \
mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am:
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am:
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
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:
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
clean-libtool clean-noinstPROGRAMS cscopelist-am ctags \
ctags-am 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-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am install-info \
install-info-am install-man install-pdf install-pdf-am \
install-ps install-ps-am 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 tags-am uninstall uninstall-am
.PRECIOUS: Makefile
debug:
$(MAKE) all CFLAGS="@DEBUG@"
profile:
$(MAKE) all CFLAGS="@PROFILE@"
# 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:

View File

@ -0,0 +1,72 @@
/********************************************************************
* *
* THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
* *
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
* by the Xiph.Org Foundation http://www.xiph.org/ *
* *
********************************************************************
function: illustrate simple use of chained bitstream and vorbisfile.a
last mod: $Id: chaining_example.c 16243 2009-07-10 02:49:31Z xiphmont $
********************************************************************/
#include <stdlib.h>
#include <vorbis/codec.h>
#include <vorbis/vorbisfile.h>
#ifdef _WIN32 /* We need the following two to set stdin/stdout to binary */
#include <io.h>
#include <fcntl.h>
#endif
int main(){
OggVorbis_File ov;
int i;
#ifdef _WIN32 /* We need to set stdin to binary mode. Damn windows. */
/* Beware the evil ifdef. We avoid these where we can, but this one we
cannot. Don't add any more, you'll probably go to hell if you do. */
_setmode( _fileno( stdin ), _O_BINARY );
#endif
/* open the file/pipe on stdin */
if(ov_open_callbacks(stdin,&ov,NULL,-1,OV_CALLBACKS_NOCLOSE)<0){
printf("Could not open input as an OggVorbis file.\n\n");
exit(1);
}
/* print details about each logical bitstream in the input */
if(ov_seekable(&ov)){
printf("Input bitstream contained %ld logical bitstream section(s).\n",
ov_streams(&ov));
printf("Total bitstream samples: %ld\n\n",
(long)ov_pcm_total(&ov,-1));
printf("Total bitstream playing time: %ld seconds\n\n",
(long)ov_time_total(&ov,-1));
}else{
printf("Standard input was not seekable.\n"
"First logical bitstream information:\n\n");
}
for(i=0;i<ov_streams(&ov);i++){
vorbis_info *vi=ov_info(&ov,i);
printf("\tlogical bitstream section %d information:\n",i+1);
printf("\t\t%ldHz %d channels bitrate %ldkbps serial number=%ld\n",
vi->rate,vi->channels,ov_bitrate(&ov,i)/1000,
ov_serialnumber(&ov,i));
printf("\t\theader length: %ld bytes\n",(long)
(ov.dataoffsets[i]-ov.offsets[i]));
printf("\t\tcompressed length: %ld bytes\n",(long)(ov_raw_total(&ov,i)));
printf("\t\tplay time: %lds\n",(long)ov_time_total(&ov,i));
}
ov_clear(&ov);
return 0;
}

View File

@ -0,0 +1,314 @@
/********************************************************************
* *
* THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
* *
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
* by the Xiph.Org Foundation http://www.xiph.org/ *
* *
********************************************************************
function: simple example decoder
last mod: $Id: decoder_example.c 16243 2009-07-10 02:49:31Z xiphmont $
********************************************************************/
/* Takes a vorbis bitstream from stdin and writes raw stereo PCM to
stdout. Decodes simple and chained OggVorbis files from beginning
to end. Vorbisfile.a is somewhat more complex than the code below. */
/* Note that this is POSIX, not ANSI code */
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <vorbis/codec.h>
#ifdef _WIN32 /* We need the following two to set stdin/stdout to binary */
#include <io.h>
#include <fcntl.h>
#endif
#if defined(__MACOS__) && defined(__MWERKS__)
#include <console.h> /* CodeWarrior's Mac "command-line" support */
#endif
ogg_int16_t convbuffer[4096]; /* take 8k out of the data segment, not the stack */
int convsize=4096;
extern void _VDBG_dump(void);
int main(){
ogg_sync_state oy; /* sync and verify incoming physical bitstream */
ogg_stream_state os; /* take physical pages, weld into a logical
stream of packets */
ogg_page og; /* one Ogg bitstream page. Vorbis packets are inside */
ogg_packet op; /* one raw packet of data for decode */
vorbis_info vi; /* struct that stores all the static vorbis bitstream
settings */
vorbis_comment vc; /* struct that stores all the bitstream user comments */
vorbis_dsp_state vd; /* central working state for the packet->PCM decoder */
vorbis_block vb; /* local working space for packet->PCM decode */
char *buffer;
int bytes;
#ifdef _WIN32 /* We need to set stdin/stdout to binary mode. Damn windows. */
/* Beware the evil ifdef. We avoid these where we can, but this one we
cannot. Don't add any more, you'll probably go to hell if you do. */
_setmode( _fileno( stdin ), _O_BINARY );
_setmode( _fileno( stdout ), _O_BINARY );
#endif
#if defined(macintosh) && defined(__MWERKS__)
{
int argc;
char **argv;
argc=ccommand(&argv); /* get a "command line" from the Mac user */
/* this also lets the user set stdin and stdout */
}
#endif
/********** Decode setup ************/
ogg_sync_init(&oy); /* Now we can read pages */
while(1){ /* we repeat if the bitstream is chained */
int eos=0;
int i;
/* grab some data at the head of the stream. We want the first page
(which is guaranteed to be small and only contain the Vorbis
stream initial header) We need the first page to get the stream
serialno. */
/* submit a 4k block to libvorbis' Ogg layer */
buffer=ogg_sync_buffer(&oy,4096);
bytes=fread(buffer,1,4096,stdin);
ogg_sync_wrote(&oy,bytes);
/* Get the first page. */
if(ogg_sync_pageout(&oy,&og)!=1){
/* have we simply run out of data? If so, we're done. */
if(bytes<4096)break;
/* error case. Must not be Vorbis data */
fprintf(stderr,"Input does not appear to be an Ogg bitstream.\n");
exit(1);
}
/* Get the serial number and set up the rest of decode. */
/* serialno first; use it to set up a logical stream */
ogg_stream_init(&os,ogg_page_serialno(&og));
/* extract the initial header from the first page and verify that the
Ogg bitstream is in fact Vorbis data */
/* I handle the initial header first instead of just having the code
read all three Vorbis headers at once because reading the initial
header is an easy way to identify a Vorbis bitstream and it's
useful to see that functionality seperated out. */
vorbis_info_init(&vi);
vorbis_comment_init(&vc);
if(ogg_stream_pagein(&os,&og)<0){
/* error; stream version mismatch perhaps */
fprintf(stderr,"Error reading first page of Ogg bitstream data.\n");
exit(1);
}
if(ogg_stream_packetout(&os,&op)!=1){
/* no page? must not be vorbis */
fprintf(stderr,"Error reading initial header packet.\n");
exit(1);
}
if(vorbis_synthesis_headerin(&vi,&vc,&op)<0){
/* error case; not a vorbis header */
fprintf(stderr,"This Ogg bitstream does not contain Vorbis "
"audio data.\n");
exit(1);
}
/* At this point, we're sure we're Vorbis. We've set up the logical
(Ogg) bitstream decoder. Get the comment and codebook headers and
set up the Vorbis decoder */
/* The next two packets in order are the comment and codebook headers.
They're likely large and may span multiple pages. Thus we read
and submit data until we get our two packets, watching that no
pages are missing. If a page is missing, error out; losing a
header page is the only place where missing data is fatal. */
i=0;
while(i<2){
while(i<2){
int result=ogg_sync_pageout(&oy,&og);
if(result==0)break; /* Need more data */
/* Don't complain about missing or corrupt data yet. We'll
catch it at the packet output phase */
if(result==1){
ogg_stream_pagein(&os,&og); /* we can ignore any errors here
as they'll also become apparent
at packetout */
while(i<2){
result=ogg_stream_packetout(&os,&op);
if(result==0)break;
if(result<0){
/* Uh oh; data at some point was corrupted or missing!
We can't tolerate that in a header. Die. */
fprintf(stderr,"Corrupt secondary header. Exiting.\n");
exit(1);
}
result=vorbis_synthesis_headerin(&vi,&vc,&op);
if(result<0){
fprintf(stderr,"Corrupt secondary header. Exiting.\n");
exit(1);
}
i++;
}
}
}
/* no harm in not checking before adding more */
buffer=ogg_sync_buffer(&oy,4096);
bytes=fread(buffer,1,4096,stdin);
if(bytes==0 && i<2){
fprintf(stderr,"End of file before finding all Vorbis headers!\n");
exit(1);
}
ogg_sync_wrote(&oy,bytes);
}
/* Throw the comments plus a few lines about the bitstream we're
decoding */
{
char **ptr=vc.user_comments;
while(*ptr){
fprintf(stderr,"%s\n",*ptr);
++ptr;
}
fprintf(stderr,"\nBitstream is %d channel, %ldHz\n",vi.channels,vi.rate);
fprintf(stderr,"Encoded by: %s\n\n",vc.vendor);
}
convsize=4096/vi.channels;
/* OK, got and parsed all three headers. Initialize the Vorbis
packet->PCM decoder. */
if(vorbis_synthesis_init(&vd,&vi)==0){ /* central decode state */
vorbis_block_init(&vd,&vb); /* local state for most of the decode
so multiple block decodes can
proceed in parallel. We could init
multiple vorbis_block structures
for vd here */
/* The rest is just a straight decode loop until end of stream */
while(!eos){
while(!eos){
int result=ogg_sync_pageout(&oy,&og);
if(result==0)break; /* need more data */
if(result<0){ /* missing or corrupt data at this page position */
fprintf(stderr,"Corrupt or missing data in bitstream; "
"continuing...\n");
}else{
ogg_stream_pagein(&os,&og); /* can safely ignore errors at
this point */
while(1){
result=ogg_stream_packetout(&os,&op);
if(result==0)break; /* need more data */
if(result<0){ /* missing or corrupt data at this page position */
/* no reason to complain; already complained above */
}else{
/* we have a packet. Decode it */
float **pcm;
int samples;
if(vorbis_synthesis(&vb,&op)==0) /* test for success! */
vorbis_synthesis_blockin(&vd,&vb);
/*
**pcm is a multichannel float vector. In stereo, for
example, pcm[0] is left, and pcm[1] is right. samples is
the size of each channel. Convert the float values
(-1.<=range<=1.) to whatever PCM format and write it out */
while((samples=vorbis_synthesis_pcmout(&vd,&pcm))>0){
int j;
int clipflag=0;
int bout=(samples<convsize?samples:convsize);
/* convert floats to 16 bit signed ints (host order) and
interleave */
for(i=0;i<vi.channels;i++){
ogg_int16_t *ptr=convbuffer+i;
float *mono=pcm[i];
for(j=0;j<bout;j++){
#if 1
int val=floor(mono[j]*32767.f+.5f);
#else /* optional dither */
int val=mono[j]*32767.f+drand48()-0.5f;
#endif
/* might as well guard against clipping */
if(val>32767){
val=32767;
clipflag=1;
}
if(val<-32768){
val=-32768;
clipflag=1;
}
*ptr=val;
ptr+=vi.channels;
}
}
if(clipflag)
fprintf(stderr,"Clipping in frame %ld\n",(long)(vd.sequence));
fwrite(convbuffer,2*vi.channels,bout,stdout);
vorbis_synthesis_read(&vd,bout); /* tell libvorbis how
many samples we
actually consumed */
}
}
}
if(ogg_page_eos(&og))eos=1;
}
}
if(!eos){
buffer=ogg_sync_buffer(&oy,4096);
bytes=fread(buffer,1,4096,stdin);
ogg_sync_wrote(&oy,bytes);
if(bytes==0)eos=1;
}
}
/* ogg_page and ogg_packet structs always point to storage in
libvorbis. They're never freed or manipulated directly */
vorbis_block_clear(&vb);
vorbis_dsp_clear(&vd);
}else{
fprintf(stderr,"Error: Corrupt header during playback initialization.\n");
}
/* clean up this logical bitstream; before exit we see if we're
followed by another [chained] */
ogg_stream_clear(&os);
vorbis_comment_clear(&vc);
vorbis_info_clear(&vi); /* must be called last */
}
/* OK, clean up the framer */
ogg_sync_clear(&oy);
fprintf(stderr,"Done.\n");
return(0);
}

View File

@ -0,0 +1,252 @@
/********************************************************************
* *
* THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
* *
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
* by the Xiph.Org Foundation http://www.xiph.org/ *
* *
********************************************************************
function: simple example encoder
last mod: $Id: encoder_example.c 16946 2010-03-03 16:12:40Z xiphmont $
********************************************************************/
/* takes a stereo 16bit 44.1kHz WAV file from stdin and encodes it into
a Vorbis bitstream */
/* Note that this is POSIX, not ANSI, code */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <math.h>
#include <vorbis/vorbisenc.h>
#ifdef _WIN32 /* We need the following two to set stdin/stdout to binary */
#include <io.h>
#include <fcntl.h>
#endif
#if defined(__MACOS__) && defined(__MWERKS__)
#include <console.h> /* CodeWarrior's Mac "command-line" support */
#endif
#define READ 1024
signed char readbuffer[READ*4+44]; /* out of the data segment, not the stack */
int main(){
ogg_stream_state os; /* take physical pages, weld into a logical
stream of packets */
ogg_page og; /* one Ogg bitstream page. Vorbis packets are inside */
ogg_packet op; /* one raw packet of data for decode */
vorbis_info vi; /* struct that stores all the static vorbis bitstream
settings */
vorbis_comment vc; /* struct that stores all the user comments */
vorbis_dsp_state vd; /* central working state for the packet->PCM decoder */
vorbis_block vb; /* local working space for packet->PCM decode */
int eos=0,ret;
int i, founddata;
#if defined(macintosh) && defined(__MWERKS__)
int argc = 0;
char **argv = NULL;
argc = ccommand(&argv); /* get a "command line" from the Mac user */
/* this also lets the user set stdin and stdout */
#endif
/* we cheat on the WAV header; we just bypass 44 bytes (simplest WAV
header is 44 bytes) and assume that the data is 44.1khz, stereo, 16 bit
little endian pcm samples. This is just an example, after all. */
#ifdef _WIN32 /* We need to set stdin/stdout to binary mode. Damn windows. */
/* if we were reading/writing a file, it would also need to in
binary mode, eg, fopen("file.wav","wb"); */
/* Beware the evil ifdef. We avoid these where we can, but this one we
cannot. Don't add any more, you'll probably go to hell if you do. */
_setmode( _fileno( stdin ), _O_BINARY );
_setmode( _fileno( stdout ), _O_BINARY );
#endif
/* we cheat on the WAV header; we just bypass the header and never
verify that it matches 16bit/stereo/44.1kHz. This is just an
example, after all. */
readbuffer[0] = '\0';
for (i=0, founddata=0; i<30 && ! feof(stdin) && ! ferror(stdin); i++)
{
fread(readbuffer,1,2,stdin);
if ( ! strncmp((char*)readbuffer, "da", 2) ){
founddata = 1;
fread(readbuffer,1,6,stdin);
break;
}
}
/********** Encode setup ************/
vorbis_info_init(&vi);
/* choose an encoding mode. A few possibilities commented out, one
actually used: */
/*********************************************************************
Encoding using a VBR quality mode. The usable range is -.1
(lowest quality, smallest file) to 1. (highest quality, largest file).
Example quality mode .4: 44kHz stereo coupled, roughly 128kbps VBR
ret = vorbis_encode_init_vbr(&vi,2,44100,.4);
---------------------------------------------------------------------
Encoding using an average bitrate mode (ABR).
example: 44kHz stereo coupled, average 128kbps VBR
ret = vorbis_encode_init(&vi,2,44100,-1,128000,-1);
---------------------------------------------------------------------
Encode using a quality mode, but select that quality mode by asking for
an approximate bitrate. This is not ABR, it is true VBR, but selected
using the bitrate interface, and then turning bitrate management off:
ret = ( vorbis_encode_setup_managed(&vi,2,44100,-1,128000,-1) ||
vorbis_encode_ctl(&vi,OV_ECTL_RATEMANAGE2_SET,NULL) ||
vorbis_encode_setup_init(&vi));
*********************************************************************/
ret=vorbis_encode_init_vbr(&vi,2,44100,0.1);
/* do not continue if setup failed; this can happen if we ask for a
mode that libVorbis does not support (eg, too low a bitrate, etc,
will return 'OV_EIMPL') */
if(ret)exit(1);
/* add a comment */
vorbis_comment_init(&vc);
vorbis_comment_add_tag(&vc,"ENCODER","encoder_example.c");
/* set up the analysis state and auxiliary encoding storage */
vorbis_analysis_init(&vd,&vi);
vorbis_block_init(&vd,&vb);
/* set up our packet->stream encoder */
/* pick a random serial number; that way we can more likely build
chained streams just by concatenation */
srand(time(NULL));
ogg_stream_init(&os,rand());
/* Vorbis streams begin with three headers; the initial header (with
most of the codec setup parameters) which is mandated by the Ogg
bitstream spec. The second header holds any comment fields. The
third header holds the bitstream codebook. We merely need to
make the headers, then pass them to libvorbis one at a time;
libvorbis handles the additional Ogg bitstream constraints */
{
ogg_packet header;
ogg_packet header_comm;
ogg_packet header_code;
vorbis_analysis_headerout(&vd,&vc,&header,&header_comm,&header_code);
ogg_stream_packetin(&os,&header); /* automatically placed in its own
page */
ogg_stream_packetin(&os,&header_comm);
ogg_stream_packetin(&os,&header_code);
/* This ensures the actual
* audio data will start on a new page, as per spec
*/
while(!eos){
int result=ogg_stream_flush(&os,&og);
if(result==0)break;
fwrite(og.header,1,og.header_len,stdout);
fwrite(og.body,1,og.body_len,stdout);
}
}
while(!eos){
long i;
long bytes=fread(readbuffer,1,READ*4,stdin); /* stereo hardwired here */
if(bytes==0){
/* end of file. this can be done implicitly in the mainline,
but it's easier to see here in non-clever fashion.
Tell the library we're at end of stream so that it can handle
the last frame and mark end of stream in the output properly */
vorbis_analysis_wrote(&vd,0);
}else{
/* data to encode */
/* expose the buffer to submit data */
float **buffer=vorbis_analysis_buffer(&vd,READ);
/* uninterleave samples */
for(i=0;i<bytes/4;i++){
buffer[0][i]=((readbuffer[i*4+1]<<8)|
(0x00ff&(int)readbuffer[i*4]))/32768.f;
buffer[1][i]=((readbuffer[i*4+3]<<8)|
(0x00ff&(int)readbuffer[i*4+2]))/32768.f;
}
/* tell the library how much we actually submitted */
vorbis_analysis_wrote(&vd,i);
}
/* vorbis does some data preanalysis, then divvies up blocks for
more involved (potentially parallel) processing. Get a single
block for encoding now */
while(vorbis_analysis_blockout(&vd,&vb)==1){
/* analysis, assume we want to use bitrate management */
vorbis_analysis(&vb,NULL);
vorbis_bitrate_addblock(&vb);
while(vorbis_bitrate_flushpacket(&vd,&op)){
/* weld the packet into the bitstream */
ogg_stream_packetin(&os,&op);
/* write out pages (if any) */
while(!eos){
int result=ogg_stream_pageout(&os,&og);
if(result==0)break;
fwrite(og.header,1,og.header_len,stdout);
fwrite(og.body,1,og.body_len,stdout);
/* this could be set above, but for illustrative purposes, I do
it here (to show that vorbis does know where the stream ends) */
if(ogg_page_eos(&og))eos=1;
}
}
}
}
/* clean up and exit. vorbis_info_clear() must be called last */
ogg_stream_clear(&os);
vorbis_block_clear(&vb);
vorbis_dsp_clear(&vd);
vorbis_comment_clear(&vc);
vorbis_info_clear(&vi);
/* ogg_page and ogg_packet structs always point to storage in
libvorbis. They're never freed or manipulated directly */
fprintf(stderr,"Done.\n");
return(0);
}

View File

@ -0,0 +1,630 @@
#!/usr/bin/perl -w
use strict;
use Tk;
use Tk::Xrm;
use Tk qw(exit);
my $version="Analyzer 20020429";
my %bases;
my $first_file=undef;
my $last_file=undef;
my $fileno=0;
my @panel_labels;
my @panel_ones;
my @panel_twos;
my @panel_onevars;
my @panel_twovars;
my @panel_keys;
my $panel_count;
# pop the toplevels
my $toplevel=new MainWindow(-class=>'AnalyzerGraph');
my $Xname=$toplevel->Class;
$toplevel->optionAdd("$Xname.geometry", "800x600",20);
my $geometry=$toplevel->optionGet('geometry','');
$geometry=~/^(\d+)x(\d+)/;
$toplevel->configure(-width=>$1);
$toplevel->configure(-height=>$2);
$toplevel->optionAdd("$Xname.background", "#4fc627",20);
$toplevel->optionAdd("$Xname*highlightBackground", "#80c0d3",20);
$toplevel->optionAdd("$Xname.Panel.background", "#4fc627",20);
$toplevel->optionAdd("$Xname.Panel.foreground", "#d0d0d0",20);
$toplevel->optionAdd("$Xname.Panel.font",
'-*-helvetica-bold-r-*-*-18-*-*-*-*-*-*-*',20);
$toplevel->optionAdd("$Xname*Statuslabel.font",
'-*-helvetica-bold-r-*-*-18-*-*-*-*-*-*-*',20);
$toplevel->optionAdd("$Xname*Statuslabel.foreground", "#606060");
$toplevel->optionAdd("$Xname*Status.font",
'-*-helvetica-bold-r-*-*-18-*-*-*-*-*-*-*',20);
$toplevel->optionAdd("$Xname*AlertDetail.font",
'-*-helvetica-medium-r-*-*-10-*-*-*-*-*-*-*',20);
$toplevel->optionAdd("$Xname*background", "#d0d0d0",20);
$toplevel->optionAdd("$Xname*foreground", '#000000',20);
$toplevel->optionAdd("$Xname*Button*background", "#f0d0b0",20);
$toplevel->optionAdd("$Xname*Button*foreground", '#000000',20);
$toplevel->optionAdd("$Xname*Button*borderWidth", '2',20);
$toplevel->optionAdd("$Xname*Button*relief", 'groove',20);
$toplevel->optionAdd("$Xname*Button*padY", 1,20);
#$toplevel->optionAdd("$Xname*Scale*background", "#f0d0b0",20);
$toplevel->optionAdd("$Xname*Scale*foreground", '#000000',20);
$toplevel->optionAdd("$Xname*Scale*borderWidth", '1',20);
#$toplevel->optionAdd("$Xname*Scale*relief", 'groove',20);
$toplevel->optionAdd("$Xname*Scale*padY", 1,20);
$toplevel->optionAdd("$Xname*Checkbutton*background", "#f0d0b0",20);
$toplevel->optionAdd("$Xname*Checkbutton*foreground", '#000000',20);
$toplevel->optionAdd("$Xname*Checkbutton*borderWidth", '2',20);
$toplevel->optionAdd("$Xname*Checkbutton*relief", 'groove',20);
$toplevel->optionAdd("$Xname*activeBackground", "#ffffff",20);
$toplevel->optionAdd("$Xname*activeForeground", '#0000a0',20);
$toplevel->optionAdd("$Xname*borderWidth", 0,20);
$toplevel->optionAdd("$Xname*relief", 'flat',20);
$toplevel->optionAdd("$Xname*activeBorderWidth", 1,20);
$toplevel->optionAdd("$Xname*highlightThickness", 0,20);
$toplevel->optionAdd("$Xname*padX", 2,20);
$toplevel->optionAdd("$Xname*padY", 2,20);
$toplevel->optionAdd("$Xname*font",
'-*-helvetica-bold-r-*-*-12-*-*-*-*-*-*-*',20);
$toplevel->optionAdd("$Xname*Entry.font",
'-*-helvetica-medium-r-*-*-12-*-*-*-*-*-*-*',20);
$toplevel->optionAdd("$Xname*Exit.font",
'-*-helvetica-bold-r-*-*-10-*-*-*-*-*-*-*',20);
$toplevel->optionAdd("$Xname*Exit.relief", 'groove',20);
$toplevel->optionAdd("$Xname*Exit.padX", 1,20);
$toplevel->optionAdd("$Xname*Exit.padY", 1,20);
$toplevel->optionAdd("$Xname*Exit.borderWidth", 2,20);
$toplevel->optionAdd("$Xname*Exit*background", "#a0a0a0",20);
$toplevel->optionAdd("$Xname*Exit*disabledForeground", "#ffffff",20);
#$toplevel->optionAdd("$Xname*Canvas.background", "#c0c0c0",20);
$toplevel->optionAdd("$Xname*Entry.background", "#ffffff",20);
$toplevel->optionAdd("$Xname*Entry.disabledForeground", "#c0c0c0",20);
$toplevel->optionAdd("$Xname*Entry.relief", "sunken",20);
$toplevel->optionAdd("$Xname*Entry.borderWidth", 1,20);
$toplevel->optionAdd("$Xname*Field.background", "#ffffff",20);
$toplevel->optionAdd("$Xname*Field.disabledForeground", "#c0c0c0",20);
$toplevel->optionAdd("$Xname*Field.relief", "flat",20);
$toplevel->optionAdd("$Xname*Field.borderWidth", 1,20);
$toplevel->optionAdd("$Xname*Label.disabledForeground", "#c0c0c0",20);
$toplevel->optionAdd("$Xname*Label.borderWidth", 1,20);
$toplevel->configure(-background=>$toplevel->optionGet("background",""));
#$toplevel->resizable(FALSE,FALSE);
my $panel=new MainWindow(-class=>'AnalyzerPanel');
my $X2name=$panel->Class;
$panel->optionAdd("$X2name.background", "#353535",20);
$panel->optionAdd("$X2name*highlightBackground", "#80c0d3",20);
$panel->optionAdd("$X2name.Panel.background", "#353535",20);
$panel->optionAdd("$X2name.Panel.foreground", "#4fc627",20);
$panel->optionAdd("$X2name.Panel.font",
'-*-helvetica-bold-o-*-*-18-*-*-*-*-*-*-*',20);
$panel->optionAdd("$X2name*Statuslabel.font",
'-*-helvetica-bold-r-*-*-18-*-*-*-*-*-*-*',20);
$panel->optionAdd("$X2name*Statuslabel.foreground", "#4fc627",20);
$panel->optionAdd("$X2name*Status.font",
'-*-helvetica-bold-r-*-*-18-*-*-*-*-*-*-*',20);
$panel->optionAdd("$X2name*AlertDetail.font",
'-*-helvetica-medium-r-*-*-10-*-*-*-*-*-*-*',20);
$panel->optionAdd("$X2name*background", "#d0d0d0",20);
$panel->optionAdd("$X2name*foreground", '#000000',20);
$panel->optionAdd("$X2name*Button*background", "#f0d0b0",20);
$panel->optionAdd("$X2name*Button*foreground", '#000000',20);
$panel->optionAdd("$X2name*Button*borderWidth", '2',20);
$panel->optionAdd("$X2name*Button*relief", 'groove',20);
$panel->optionAdd("$X2name*Button*padY", 1,20);
$panel->optionAdd("$X2name*Checkbutton*background", "#f0d0b0",20);
$panel->optionAdd("$X2name*Checkbutton*foreground", '#000000',20);
$panel->optionAdd("$X2name*Checkbutton*borderWidth", '2',20);
#$panel->optionAdd("$X2name*Checkbutton*padX", '0',20);
#$panel->optionAdd("$X2name*Checkbutton*padY", '0',20);
#$panel->optionAdd("$X2name*Checkbutton*relief", 'groove',20);
$panel->optionAdd("$X2name*activeBackground", "#ffffff",20);
$panel->optionAdd("$X2name*activeForeground", '#0000a0',20);
$panel->optionAdd("$X2name*borderWidth", 0,20);
$panel->optionAdd("$X2name*relief", 'flat',20);
$panel->optionAdd("$X2name*activeBorderWidth", 1,20);
$panel->optionAdd("$X2name*highlightThickness", 0,20);
$panel->optionAdd("$X2name*padX", 2,20);
$panel->optionAdd("$X2name*padY", 2,20);
$panel->optionAdd("$X2name*font",
'-*-helvetica-bold-r-*-*-12-*-*-*-*-*-*-*',20);
$panel->optionAdd("$X2name*Entry.font",
'-*-helvetica-medium-r-*-*-12-*-*-*-*-*-*-*',20);
$panel->optionAdd("$X2name*Exit.font",
'-*-helvetica-bold-r-*-*-10-*-*-*-*-*-*-*',20);
$panel->optionAdd("$X2name*Exit.relief", 'groove',20);
$panel->optionAdd("$X2name*Exit.padX", 1,20);
$panel->optionAdd("$X2name*Exit.padY", 1,20);
$panel->optionAdd("$X2name*Exit.borderWidth", 2,20);
$panel->optionAdd("$X2name*Exit*background", "#a0a0a0",20);
$panel->optionAdd("$X2name*Exit*disabledForeground", "#ffffff",20);
$panel->optionAdd("$X2name*Entry.background", "#ffffff",20);
$panel->optionAdd("$X2name*Entry.disabledForeground", "#c0c0c0",20);
$panel->optionAdd("$X2name*Entry.relief", "sunken",20);
$panel->optionAdd("$X2name*Entry.borderWidth", 1,20);
$panel->optionAdd("$X2name*Field.background", "#ffffff",20);
$panel->optionAdd("$X2name*Field.disabledForeground", "#c0c0c0",20);
$panel->optionAdd("$X2name*Field.relief", "flat",20);
$panel->optionAdd("$X2name*Field.borderWidth", 1,20);
$panel->optionAdd("$X2name*Label.disabledForeground", "#c0c0c0",20);
$panel->optionAdd("$X2name*Label.borderWidth", 1,20);
$panel->configure(-background=>$panel->optionGet("background",""));
#$panel->resizable("FALSE","FALSE");
my $panel_shell=$panel->Label(Name=>"shell",-borderwidth=>1,-relief=>'raised')->
place(-x=>10,-y=>36,-relwidth=>1.0,-relheight=>1.0,
-width=>-20,-height=>-46,-anchor=>'nw');
my $panel_quit=$panel_shell->Button(-class=>"Exit",-text=>"quit",-command=>[sub{Shutdown()}])->
place(-x=>-1,-y=>-1,-relx=>1.0,-rely=>1.0,-anchor=>'se');
$panel->Label(Name=>"logo text",-class=>"Panel",-text=>$version)->
place(-x=>5,-y=>5,-anchor=>'nw');
my $graph_shell=$toplevel->Label(Name=>"shell",-borderwidth=>1,-relief=>'raised')->
place(-x=>10,-y=>36,-relwidth=>1.0,-relheight=>1.0,
-width=>-20,-height=>-46,-anchor=>'nw');
my $graph_status=$toplevel->Label(Name=>"logo text",-class=>"Panel",-text=>"Starting up")->
place(-x=>5,-y=>5,-anchor=>'nw');
my $panely=5;
my $panel_rescan=$panel_shell->Button(-text=>"rescan",-command=>[sub{scan_directory()}])->
place(-x=>-5,-relx=>1.,-y=>$panely,-anchor=>'ne');
$panely+=$panel_rescan->reqheight()+6;
my$temp=$graph_shell->Button(-text=>"<<",
-command=>[sub{$fileno-=10;$fileno=$first_file if($fileno<$first_file);
load_graph();}])->
place(-x=>5,-y=>-5,-rely=>1.,-relwidth=>.2,-width=>-5,-anchor=>'sw');
$graph_shell->Button(-text=>">>",
-command=>[sub{$fileno+=10;$fileno=$last_file if($fileno>$last_file);
load_graph();}])->
place(-x=>-5,-y=>-5,-relwidth=>.2,-rely=>1.,-width=>-5,-relx=>1.,-anchor=>'se');
$graph_shell->Button(-text=>"<",
-command=>[sub{$fileno-=1;$fileno=$first_file if($fileno<$first_file);
load_graph();}])->
place(-x=>5,-y=>-5,-relwidth=>.3,-width=>-7,-rely=>1.,-relx=>.2,-anchor=>'sw');
$graph_shell->Button(-text=>">",
-command=>[sub{$fileno+=1;$fileno=$last_file if($fileno>$last_file);
load_graph();}])->
place(-x=>-5,-y=>-5,-relwidth=>.3,-width=>-7,-rely=>1.,-relx=>.8,-anchor=>'se');
my$graphy=-10-$temp->reqheight();
my$graph_slider=$temp=$graph_shell->Scale(-bigincrement=>1,
-resolution=>1,
-showvalue=>'TRUE',-variable=>\$fileno,-orient=>'horizontal')->
place(-x=>5,-y=>$graphy,-relwidth=>1.,-rely=>1.,-width=>-10,-anchor=>'sw');
$graphy-=$temp->reqheight()+5;
my$onecrop;
my$twocrop;
my$oneresize=$temp=$graph_shell->Checkbutton(-text=>"rescale",-variable=>\$onecrop,
-command=>[sub{draw_graph();}])->
place(-x=>5,-y=>5,-anchor=>'nw');
my$one=$graph_shell->Canvas()->
place(-relwidth=>1.,-width=>-10,-relheight=>.5,-height=>($graphy/2)-5-$temp->reqheight(),
-x=>5,-y=>5+$temp->reqheight,-anchor=>'nw');
my$tworesize=$temp=$graph_shell->Checkbutton(-text=>"rescale",-variable=>\$twocrop,
-command=>[sub{draw_graph();}])->
place(-rely=>1.,-y=>5,-anchor=>'nw',-in=>$one);
my$two=$graph_shell->Canvas()->
place(-relwidth=>1.,-relheight=>1.,-rely=>1.,-y=>5+$temp->reqheight(),-anchor=>'nw',-in=>$one);
scan_directory();
my%onestate;
my%twostate;
my @data;
$onestate{"canvas"}=$one;
$onestate{"vars"}=\@panel_onevars;
$twostate{"canvas"}=$two;
$twostate{"vars"}=\@panel_twovars;
$graph_slider->configure(-command=>[sub{load_graph()}]);
load_graph();
$toplevel->bind('MainWindow','<Configure>',[sub{$toplevel->update();
draw_graph()}]);
Tk::MainLoop();
sub load_graph{
scan_directory()if(!defined($panel_count));
@data=undef;
for(my$i=0;$i<$panel_count;$i++){
my$filename=$panel_keys[$i]."_$fileno.m";
if(open F, "$filename"){
$data[$i]=[(<F>)];
close F;
}
}
draw_graph();
}
sub graphhelper{
my($graph)=@_;
my$count=0;
my@colors=("#ff0000","#00df00","#0000ff","#ffff00","#ff00ff","#00ffff","#ffffff",
"#9f0000","#007f00","#00009f","#8f8f00","#8f008f","#008f8f","#000000");
my$w=$graph->{"canvas"};
my$rescale=0;
Status("Plotting $fileno");
$w->delete('foo');
$w->delete('legend');
$w->delete('lines');
# count range
for(my$i=0;$i<$panel_count;$i++){
if($graph->{"vars"}->[$i]){
if(defined($data[$i])){
if(!defined($graph->{"minx"})){
$data[$i]->[0]=~m/^\s*(-?[0-9\.]*)[ ,]+(-?[0-9\.]*)/;
$graph->{"maxx"}=$1;
$graph->{"minx"}=$1;
$graph->{"maxy"}=$2;
$graph->{"miny"}=$2;
$rescale=1;
}
for(my$j=0;$j<=$#{$data[$i]};$j++){
$data[$i]->[$j]=~m/^\s*(-?[0-9\.]*)[ ,]+(-?[0-9\.]*)/;
$rescale=1 if($1>$graph->{"maxx"});
$rescale=1 if($1<$graph->{"minx"});
$rescale=1 if($2>$graph->{"maxy"});
$rescale=1 if($2<$graph->{"miny"});
$graph->{"maxx"}=$1 if($1>$graph->{"maxx"});
$graph->{"minx"}=$1 if($1<$graph->{"minx"});
$graph->{"maxy"}=$2 if($2>$graph->{"maxy"});
$graph->{"miny"}=$2 if($2<$graph->{"miny"});
}
}
$count++;
}
}
my$width=$w->width();
my$height=$w->height();
$rescale=1 if(!defined($graph->{"width"}) ||
$width!=$graph->{"width"} ||
$height!=$graph->{"height"});
$graph->{"width"}=$width;
$graph->{"height"}=$height;
if(defined($graph->{"maxx"})){
# draw axes, labels
# look for appropriate axis scales
if($rescale){
$w->delete('ylabel');
$w->delete('xlabel');
$w->delete('axes');
my$yscale=1.;
my$xscale=1.;
my$iyscale=1.;
my$ixscale=1.;
while(($graph->{"maxx"}-$graph->{"minx"})*$xscale>15){$xscale*=.1;$ixscale*=10.;}
while(($graph->{"maxy"}-$graph->{"miny"})*$yscale>15){$yscale*=.1;$iyscale*=10.;}
while(($graph->{"maxx"}-$graph->{"minx"})*$xscale<3){$xscale*=10.;$ixscale*=.1;}
while(($graph->{"maxy"}-$graph->{"miny"})*$yscale<3){$yscale*=10.;$iyscale*=.1;}
# how tall are the x axis labels?
$w->createText(-1,-1,-anchor=>'se',-tags=>['foo'],-text=>"0123456789.");
my($x1,$y1,$x2,$y2)=$w->bbox('foo');
$w->delete('foo');
my$maxlabelheight=$y2-$y1;
my$useabley=$height-$maxlabelheight-3;
my$pixelpery=$useabley/($graph->{"maxy"}-$graph->{"miny"});
# place y axis labels at proper spacing/height
my$lasty=-$maxlabelheight/2;
my$topyval=int($graph->{"maxy"}*$yscale+1.)*$iyscale;
for(my$i=0;;$i++){
my$yval= $topyval-$i*$iyscale;
my$y= ($graph->{"maxy"}-$yval)*$pixelpery;
last if($y>$useabley);
if($y-$maxlabelheight>=$lasty){
$w->createText(0,$y,-anchor=>'e',-tags=>['ylabel'],-text=>"$yval");
$lasty=$y;
}
}
# get the max ylabel width and place them at proper x
($x1,$y1,$x2,$y2)=$w->bbox('ylabel');
my$maxylabelwidth=$x2-$x1;
$w->move('ylabel',$maxylabelwidth,0);
my$beginx=$maxylabelwidth+3;
my$useablex=$width-$beginx;
# draw basic axes
$w->createLine($beginx,0,$beginx,$useabley,$width,$useabley,
-tags=>['axes'],-width=>2);
# draw y tix
$lasty=-$maxlabelheight/2;
for(my$i=0;;$i++){
my$yval= $topyval-$i*$iyscale;
my$y= ($graph->{"maxy"}-$yval)*$pixelpery;
last if($y>$useabley);
if($yval==0){
$w->createLine($beginx,$y,$width,$y,
-tags=>['axes'],-width=>1);
}else{
if($y-$maxlabelheight>=$lasty){
$w->createLine($beginx,$y,$width,$y,
-tags=>['axes'],-width=>1,
-stipple=>'gray50');
$lasty=$y;
}
}
}
# place x axis labels at proper spacing
my$topxval=int($graph->{"maxx"}*$xscale+1.)*$ixscale;
my$pixelperx=$useablex/($graph->{"maxx"}-$graph->{"minx"});
for(my$i=0;;$i++){
my$xval= $topxval-$i*$ixscale;
my$x= $width-($graph->{"maxx"}-$xval)*$pixelperx;
last if($x<$beginx);
# bounding boxen are hard. place temp labels.
$w->createText(-1,-1,-anchor=>'e',-tags=>['foo'],-text=>"$xval");
}
($x1,$y1,$x2,$y2)=$w->bbox('foo');
my$maxxlabelwidth=$x2-$x1;
$w->delete('foo');
my$lastx=$width;
for(my$i=0;;$i++){
my$xval= $topxval-$i*$ixscale;
my$x= $width-($graph->{"maxx"}-$xval)*$pixelperx;
last if($x-$maxxlabelwidth/2<0 || $x<$beginx);
if($xval==0 && $x<$width){
$w->createLine($x,0,$x,$useabley,-tags=>['axes'],-width=>1);
}
if($x+$maxxlabelwidth<=$lastx){
$w->createText($x,$height-1,-anchor=>'s',-tags=>['xlabel'],-text=>"$xval");
$w->createLine($x,0,$x,$useabley,-tags=>['axes'],-width=>1,-stipple=>"gray50");
$lastx=$x;
}
}
$graph->{"labelheight"}=$maxlabelheight;
$graph->{"xo"}=$beginx;
$graph->{"ppx"}=$pixelperx;
$graph->{"ppy"}=$pixelpery;
}
# plot the files
$count=0;
my$legendy=$graph->{"labelheight"}/2;
for(my$i=0;$i<$panel_count;$i++){
if($graph->{"vars"}->[$i]){
$count++; # count here for legend color selection stability
if(defined($data[$i])){
# place a legend placard;
my$color=$colors[($count-1)%($#colors+1)];
$w->createText($width,$legendy,-anchor=>'e',-tags=>['legend'],
-fill=>$color,-text=>$panel_keys[$i]);
$legendy+=$graph->{"labelheight"};
# plot the lines
my@pairs=map{if(/^\s*(-?[0-9\.]*)[ ,]+(-?[0-9\.]*)/){
(($1-$graph->{"minx"})*$graph->{"ppx"}+$graph->{"xo"},
(-$2+$graph->{"maxy"})*$graph->{"ppy"})}} (@{$data[$i]});
$w->createLine((@pairs),-fill=>$color,-tags=>['lines']);
}
}
}
}
}
sub draw_graph{
if($onecrop){
$onestate{"minx"}=undef;
$onestate{"miny"}=undef;
$onestate{"maxx"}=undef;
$onestate{"maxy"}=undef;
}
if($twocrop){
$twostate{"minx"}=undef;
$twostate{"miny"}=undef;
$twostate{"maxx"}=undef;
$twostate{"maxy"}=undef;
}
for(my$i=0;$i<$panel_count;$i++){
if($twostate{"vars"}->[$i]){
#re-place the canvases
$oneresize->place(-x=>5,-y=>5,-anchor=>'nw');
$one->place(-relwidth=>1.,-width=>-10,-relheight=>.5,
-height=>($graphy/2)-5-$oneresize->reqheight(),
-x=>5,-y=>5+$oneresize->reqheight,-anchor=>'nw');
$tworesize->place(-rely=>1.,-y=>5,-anchor=>'nw',-in=>$one);
$two->place(-relwidth=>1.,-relheight=>1.,-rely=>1.,
-y=>5+$tworesize->reqheight(),-anchor=>'nw',-in=>$one);
graphhelper(\%onestate);
graphhelper(\%twostate);
return;
}
}
$oneresize->place(-x=>5,-y=>5,-anchor=>'nw');
$one->place(-relwidth=>1.,-width=>-10,-relheight=>1.,
-height=>$graphy-5-$oneresize->reqheight(),
-x=>5,-y=>5+$oneresize->reqheight,-anchor=>'nw');
$tworesize->placeForget();
$two->placeForget();
graphhelper(\%onestate);
}
sub depopulate_panel{
my $win;
foreach $win (@panel_labels){
$win->destroy();
}
@panel_labels=();
foreach $win (@panel_ones){
$win->destroy();
}
@panel_ones=();
foreach $win (@panel_twos){
$win->destroy();
}
@panel_twos=();
@panel_keys=();
}
sub populate_panel{
my $localy=$panely;
my $key;
my $i=0;
foreach $key (sort (keys %bases)){
$panel_keys[$i]=$key;
if(!defined($panel_onevars[$i])){
$panel_onevars[$i]=0;
$panel_twovars[$i]=0;
}
my $temp=$panel_twos[$i]=$panel_shell->
Checkbutton(-variable=>\$panel_twovars[$i],-command=>['main::draw_graph'],-text=>'2')->
place(-y=>$localy,-x=>-5,-anchor=>"ne",-relx=>1.);
my $oney=$temp->reqheight();
my $onex=$temp->reqwidth()+15;
$temp=$panel_ones[$i]=$panel_shell->
Checkbutton(-variable=>\$panel_onevars[$i],-command=>['main::draw_graph'],-text=>'1')->
place(-y=>0,-x=>0,-anchor=>"ne",-in=>$temp,-bordermode=>'outside');
$oney=$temp->reqheight() if ($oney<$temp->reqheight());
$onex+=$temp->reqwidth();
$temp=$panel_labels[$i]=$panel_shell->Label(-text=>$key,-class=>'Field',-justify=>'left')->
place(-y=>$localy,-x=>5,-anchor=>"nw",-relwidth=>1.,-width=>-$onex,
-bordermode=>'outside');
$oney=$temp->reqheight() if ($oney<$temp->reqheight());
$localy+=$oney+2;
$i++;
}
$panel_count=$i;
$localy+=$panel_quit->reqheight()+50;
my $geometry=$panel->geometry();
$geometry=~/^(\d+)/;
$panel->configure(-height=>$localy);
$panel->configure(-width=>$1);
}
sub Shutdown{
Tk::exit();
}
sub Status{
my$text=shift @_;
$graph_status->configure(-text=>"$text");
$toplevel->update();
}
sub scan_directory{
%bases=();
my$count=0;
$first_file=undef;
$last_file=undef;
if(opendir(D,".")){
my$file;
while(defined($file=readdir(D))){
if($file=~m/^(\S*)_(\d+).m/){
$bases{"$1"}="0";
$first_file=$2 if(!defined($first_file) || $2<$first_file);
$last_file=$2 if(!defined($last_file) || $2>$last_file);
$count++;
Status("Reading... $count")if($count%117==0);
}
}
closedir(D);
}
Status("Done Reading: $count files");
depopulate_panel();
populate_panel();
$fileno=$first_file if($fileno<$first_file);
$fileno=$last_file if($fileno>$last_file);
$graph_slider->configure(-from=>$first_file,-to=>$last_file);
}

View File

@ -0,0 +1,278 @@
/********************************************************************
* *
* THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
* *
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
* by the Xiph.Org Foundation http://www.xiph.org/ *
* *
********************************************************************
function: illustrate seeking, and test it too
last mod: $Id: seeking_example.c 19164 2014-06-18 06:33:58Z xiphmont $
********************************************************************/
#include <stdlib.h>
#include <stdio.h>
#include "vorbis/codec.h"
#include "vorbis/vorbisfile.h"
#ifdef _WIN32 /* We need the following two to set stdin/stdout to binary */
# include <io.h>
# include <fcntl.h>
#endif
void _verify(OggVorbis_File *ov,
ogg_int64_t val,ogg_int64_t pcmval,double timeval,
ogg_int64_t pcmlength,
char *bigassbuffer){
off_t i;
int j;
long bread;
char buffer[4096];
int dummy;
ogg_int64_t pos;
int hs = ov_halfrate_p(ov);
/* verify the raw position, the pcm position and position decode */
if(val!=-1 && ov_raw_tell(ov)<val){
fprintf(stderr,"raw position out of tolerance: requested %ld, got %ld\n",
(long)val,(long)ov_raw_tell(ov));
exit(1);
}
if(pcmval!=-1 && ov_pcm_tell(ov)>pcmval){
fprintf(stderr,"pcm position out of tolerance: requested %ld, got %ld\n",
(long)pcmval,(long)ov_pcm_tell(ov));
exit(1);
}
if(timeval!=-1 && ov_time_tell(ov)>timeval){
fprintf(stderr,"time position out of tolerance: requested %f, got %f\n",
timeval,ov_time_tell(ov));
exit(1);
}
pos=ov_pcm_tell(ov);
if(pos<0 || pos>pcmlength){
fprintf(stderr,"pcm position out of bounds: got %ld\n",(long)pos);
exit(1);
}
bread=ov_read(ov,buffer,4096,1,1,1,&dummy);
for(j=0;j<bread;j++){
if(buffer[j]!=bigassbuffer[j+((pos>>hs)*2)]){
fprintf(stderr,"data after seek doesn't match declared pcm position %ld\n",(long)pos);
for(i=0;i<(pcmlength>>hs)*2-bread;i++){
for(j=0;j<bread;j++)
if(buffer[j] != bigassbuffer[i+j])break;
if(j==bread){
fprintf(stderr,"data after seek appears to match position %ld\n",(long)((i/2)<<hs));
}
}
{
FILE *f=fopen("a.m","w");
for(j=0;j<bread;j++)fprintf(f,"%d %d\n",j,(int)buffer[j]);
fclose(f);
f=fopen("b.m","w");
for(j=-4096;j<bread+4096;j++)
if(j+((pos*2)>>hs)>=0 && (j+((pos*2)>>hs))<(pcmlength>>hs)*2)
fprintf(f,"%d %d\n",j,(int)bigassbuffer[j+((pos*2)>>hs)]);
fclose(f);
}
exit(1);
}
}
}
int main(){
OggVorbis_File ov;
int i,ret;
ogg_int64_t pcmlength;
double timelength;
char *bigassbuffer;
int dummy;
int hs=0;
#ifdef _WIN32 /* We need to set stdin/stdout to binary mode. Damn windows. */
_setmode( _fileno( stdin ), _O_BINARY );
#endif
/* open the file/pipe on stdin */
if(ov_open_callbacks(stdin,&ov,NULL,-1,OV_CALLBACKS_NOCLOSE)<0){
fprintf(stderr,"Could not open input as an OggVorbis file.\n\n");
exit(1);
}
#if 0 /*enable this code to test seeking with halfrate decode */
if(ov_halfrate(&ov,1)){
fprintf(stderr,"Sorry; unable to set half-rate decode.\n\n");
exit(1);
}else
hs=1;
#endif
if(ov_seekable(&ov)){
/* to simplify our own lives, we want to assume the whole file is
stereo. Verify this to avoid potentially mystifying users
(pissing them off is OK, just don't confuse them) */
for(i=0;i<ov.links;i++){
vorbis_info *vi=ov_info(&ov,i);
if(vi->channels!=2){
fprintf(stderr,"Sorry; right now seeking_test can only use Vorbis files\n"
"that are entirely stereo.\n\n");
exit(1);
}
}
/* because we want to do sample-level verification that the seek
does what it claimed, decode the entire file into memory */
pcmlength=ov_pcm_total(&ov,-1);
timelength=ov_time_total(&ov,-1);
bigassbuffer=malloc((pcmlength>>hs)*2); /* w00t */
i=0;
while(i<(pcmlength>>hs)*2){
int ret=ov_read(&ov,bigassbuffer+i,((pcmlength>>hs)*2)-i,1,1,1,&dummy);
if(ret<0){
fprintf(stderr,"Error reading file.\n");
exit(1);
}
if(ret){
i+=ret;
}else{
pcmlength=(i/2)<<hs;
}
fprintf(stderr,"\rloading.... [%ld left] ",
(long)((pcmlength>>hs)*2-i));
}
{
ogg_int64_t length=ov.end;
fprintf(stderr,"\rtesting raw seeking to random places in %ld bytes....\n",
(long)length);
for(i=0;i<1000;i++){
ogg_int64_t val=(double)rand()/RAND_MAX*length;
fprintf(stderr,"\r\t%d [raw position %ld]... ",i,(long)val);
ret=ov_raw_seek(&ov,val);
if(ret<0){
fprintf(stderr,"seek failed: %d\n",ret);
exit(1);
}
_verify(&ov,val,-1,-1.,pcmlength,bigassbuffer);
}
}
fprintf(stderr,"\r");
{
fprintf(stderr,"testing pcm page seeking to random places in %ld samples....\n",
(long)pcmlength);
for(i=0;i<1000;i++){
ogg_int64_t val= i==0?(ogg_int64_t)0:(double)rand()/RAND_MAX*pcmlength;
fprintf(stderr,"\r\t%d [pcm position %ld]... ",i,(long)val);
ret=ov_pcm_seek_page(&ov,val);
if(ret<0){
fprintf(stderr,"seek failed: %d\n",ret);
exit(1);
}
_verify(&ov,-1,val,-1.,pcmlength,bigassbuffer);
}
}
fprintf(stderr,"\r");
{
fprintf(stderr,"testing pcm exact seeking to random places in %f seconds....\n",
timelength);
for(i=0;i<1000;i++){
ogg_int64_t val= i==0?(ogg_int64_t)0:(double)rand()/RAND_MAX*pcmlength;
fprintf(stderr,"\r\t%d [pcm position %ld]... ",i,(long)val);
ret=ov_pcm_seek(&ov,val);
if(ret<0){
fprintf(stderr,"seek failed: %d\n",ret);
exit(1);
}
if(ov_pcm_tell(&ov)!=((val>>hs)<<hs)){
fprintf(stderr,"Declared position didn't perfectly match request: %ld != %ld\n",
(long)val,(long)ov_pcm_tell(&ov));
exit(1);
}
_verify(&ov,-1,val,-1.,pcmlength,bigassbuffer);
}
}
fprintf(stderr,"\r");
{
fprintf(stderr,"testing time page seeking to random places in %f seconds....\n",
timelength);
for(i=0;i<1000;i++){
double val=(double)rand()/RAND_MAX*timelength;
fprintf(stderr,"\r\t%d [time position %f]... ",i,val);
ret=ov_time_seek_page(&ov,val);
if(ret<0){
fprintf(stderr,"seek failed: %d\n",ret);
exit(1);
}
_verify(&ov,-1,-1,val,pcmlength,bigassbuffer);
}
}
fprintf(stderr,"\r");
{
fprintf(stderr,"testing time exact seeking to random places in %f seconds....\n",
timelength);
for(i=0;i<1000;i++){
double val=(double)rand()/RAND_MAX*timelength;
fprintf(stderr,"\r\t%d [time position %f]... ",i,val);
ret=ov_time_seek(&ov,val);
if(ret<0){
fprintf(stderr,"seek failed: %d\n",ret);
exit(1);
}
if(ov_time_tell(&ov)<val-1 || ov_time_tell(&ov)>val+1){
fprintf(stderr,"Declared position didn't perfectly match request: %f != %f\n",
val,ov_time_tell(&ov));
exit(1);
}
_verify(&ov,-1,-1,val,pcmlength,bigassbuffer);
}
}
fprintf(stderr,"\r \nOK.\n\n");
}else{
fprintf(stderr,"Standard input was not seekable.\n");
}
ov_clear(&ov);
return 0;
}

View File

@ -0,0 +1,92 @@
/********************************************************************
* *
* THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
* *
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
* by the Xiph.Org Foundation http://www.xiph.org/ *
* *
********************************************************************
function: simple example decoder using vorbisfile
last mod: $Id: vorbisfile_example.c 16328 2009-07-24 01:51:10Z xiphmont $
********************************************************************/
/* Takes a vorbis bitstream from stdin and writes raw stereo PCM to
stdout using vorbisfile. Using vorbisfile is much simpler than
dealing with libvorbis. */
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <vorbis/codec.h>
#include <vorbis/vorbisfile.h>
#ifdef _WIN32 /* We need the following two to set stdin/stdout to binary */
#include <io.h>
#include <fcntl.h>
#endif
char pcmout[4096]; /* take 4k out of the data segment, not the stack */
int main(){
OggVorbis_File vf;
int eof=0;
int current_section;
#ifdef _WIN32 /* We need to set stdin/stdout to binary mode. Damn windows. */
/* Beware the evil ifdef. We avoid these where we can, but this one we
cannot. Don't add any more, you'll probably go to hell if you do. */
_setmode( _fileno( stdin ), _O_BINARY );
_setmode( _fileno( stdout ), _O_BINARY );
#endif
if(ov_open_callbacks(stdin, &vf, NULL, 0, OV_CALLBACKS_NOCLOSE) < 0) {
fprintf(stderr,"Input does not appear to be an Ogg bitstream.\n");
exit(1);
}
/* Throw the comments plus a few lines about the bitstream we're
decoding */
{
char **ptr=ov_comment(&vf,-1)->user_comments;
vorbis_info *vi=ov_info(&vf,-1);
while(*ptr){
fprintf(stderr,"%s\n",*ptr);
++ptr;
}
fprintf(stderr,"\nBitstream is %d channel, %ldHz\n",vi->channels,vi->rate);
fprintf(stderr,"\nDecoded length: %ld samples\n",
(long)ov_pcm_total(&vf,-1));
fprintf(stderr,"Encoded by: %s\n\n",ov_comment(&vf,-1)->vendor);
}
while(!eof){
long ret=ov_read(&vf,pcmout,sizeof(pcmout),0,2,1,&current_section);
if (ret == 0) {
/* EOF */
eof=1;
} else if (ret < 0) {
if(ret==OV_EBADLINK){
fprintf(stderr,"Corrupt bitstream section! Exiting.\n");
exit(1);
}
/* some other error in the stream. Not a problem, just reporting it in
case we (the app) cares. In this case, we don't. */
} else {
/* we don't bother dealing with sample rate changes, etc, but
you'll have to*/
fwrite(pcmout,1,ret,stdout);
}
}
/* cleanup */
ov_clear(&vf);
fprintf(stderr,"Done.\n");
return(0);
}