summaryrefslogtreecommitdiffstats
path: root/alsa-utils/iecset
diff options
context:
space:
mode:
Diffstat (limited to 'alsa-utils/iecset')
-rw-r--r--alsa-utils/iecset/Makefile.am9
-rw-r--r--alsa-utils/iecset/Makefile.in502
-rw-r--r--alsa-utils/iecset/iecbits.c259
-rw-r--r--alsa-utils/iecset/iecset.1104
-rw-r--r--alsa-utils/iecset/iecset.c432
5 files changed, 1306 insertions, 0 deletions
diff --git a/alsa-utils/iecset/Makefile.am b/alsa-utils/iecset/Makefile.am
new file mode 100644
index 0000000..c03a7f1
--- /dev/null
+++ b/alsa-utils/iecset/Makefile.am
@@ -0,0 +1,9 @@
+INCLUDES = -I$(top_srcdir)/include
+LDADD = -lm
+# LDFLAGS = -static
+# CFLAGS += -g -Wall
+
+bin_PROGRAMS = iecset
+iecset_SOURCES = iecset.c iecbits.c
+man_MANS = iecset.1
+EXTRA_DIST = iecset.1
diff --git a/alsa-utils/iecset/Makefile.in b/alsa-utils/iecset/Makefile.in
new file mode 100644
index 0000000..82c31cc
--- /dev/null
+++ b/alsa-utils/iecset/Makefile.in
@@ -0,0 +1,502 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 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 = :
+build_triplet = @build@
+host_triplet = @host@
+bin_PROGRAMS = iecset$(EXEEXT)
+subdir = iecset
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \
+ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \
+ $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
+ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
+ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/aconfig.h
+CONFIG_CLEAN_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am_iecset_OBJECTS = iecset.$(OBJEXT) iecbits.$(OBJEXT)
+iecset_OBJECTS = $(am_iecset_OBJECTS)
+iecset_LDADD = $(LDADD)
+iecset_DEPENDENCIES =
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(iecset_SOURCES)
+DIST_SOURCES = $(iecset_SOURCES)
+man1dir = $(mandir)/man1
+NROFF = nroff
+MANS = $(man_MANS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALSACONF_FALSE = @ALSACONF_FALSE@
+ALSACONF_TRUE = @ALSACONF_TRUE@
+ALSAMIXER_FALSE = @ALSAMIXER_FALSE@
+ALSAMIXER_TRUE = @ALSAMIXER_TRUE@
+ALSA_CFLAGS = @ALSA_CFLAGS@
+ALSA_LIBS = @ALSA_LIBS@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CURSESINC = @CURSESINC@
+CURSESLIB = @CURSESLIB@
+CURSES_CFLAGS = @CURSES_CFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GMSGFMT = @GMSGFMT@
+GMSGFMT_015 = @GMSGFMT_015@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INTLLIBS = @INTLLIBS@
+INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+LDFLAGS = @LDFLAGS@
+LIBICONV = @LIBICONV@
+LIBINTL = @LIBINTL@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LN_S = @LN_S@
+LTLIBICONV = @LTLIBICONV@
+LTLIBINTL = @LTLIBINTL@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MSGFMT = @MSGFMT@
+MSGFMT_015 = @MSGFMT_015@
+MSGMERGE = @MSGMERGE@
+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@
+POSUB = @POSUB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SND_UTIL_MAJOR = @SND_UTIL_MAJOR@
+SND_UTIL_MINOR = @SND_UTIL_MINOR@
+SND_UTIL_SUBMINOR = @SND_UTIL_SUBMINOR@
+SND_UTIL_VERSION = @SND_UTIL_VERSION@
+STRIP = @STRIP@
+TESTSOUND = @TESTSOUND@
+USE_NLS = @USE_NLS@
+USE_XMLTO_FALSE = @USE_XMLTO_FALSE@
+USE_XMLTO_TRUE = @USE_XMLTO_TRUE@
+VERSION = @VERSION@
+XGETTEXT = @XGETTEXT@
+XGETTEXT_015 = @XGETTEXT_015@
+ac_ct_CC = @ac_ct_CC@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+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@
+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@
+ncurses5_config = @ncurses5_config@
+ncursesw5_config = @ncursesw5_config@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+xmlto = @xmlto@
+INCLUDES = -I$(top_srcdir)/include
+LDADD = -lm
+iecset_SOURCES = iecset.c iecbits.c
+man_MANS = iecset.1
+EXTRA_DIST = iecset.1
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .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) --foreign iecset/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign iecset/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-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+iecset$(EXEEXT): $(iecset_OBJECTS) $(iecset_DEPENDENCIES)
+ @rm -f iecset$(EXEEXT)
+ $(LINK) $(iecset_LDFLAGS) $(iecset_OBJECTS) $(iecset_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iecbits.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iecset.Po@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@ DEPDIR=$(DEPDIR) $(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@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+uninstall-info-am:
+install-man1: $(man1_MANS) $(man_MANS)
+ @$(NORMAL_INSTALL)
+ test -z "$(man1dir)" || $(mkdir_p) "$(DESTDIR)$(man1dir)"
+ @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.1*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
+ else file=$$i; fi; \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 1*) ;; \
+ *) ext='1' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \
+ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst"; \
+ done
+uninstall-man1:
+ @$(NORMAL_UNINSTALL)
+ @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.1*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 1*) ;; \
+ *) ext='1' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " rm -f '$(DESTDIR)$(man1dir)/$$inst'"; \
+ rm -f "$(DESTDIR)$(man1dir)/$$inst"; \
+ 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 $(PROGRAMS) $(MANS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; 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:
+ -test -z "$(CONFIG_CLEAN_FILES)" || 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-binPROGRAMS clean-generic 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
+
+info: info-am
+
+info-am:
+
+install-data-am: install-man
+
+install-exec-am: install-binPROGRAMS
+
+install-info: install-info-am
+
+install-man: install-man1
+
+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
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS uninstall-info-am uninstall-man
+
+uninstall-man: uninstall-man1
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic ctags distclean distclean-compile \
+ distclean-generic distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-exec install-exec-am \
+ install-info install-info-am install-man install-man1 \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-binPROGRAMS \
+ uninstall-info-am uninstall-man uninstall-man1
+
+# 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:
diff --git a/alsa-utils/iecset/iecbits.c b/alsa-utils/iecset/iecbits.c
new file mode 100644
index 0000000..edea932
--- /dev/null
+++ b/alsa-utils/iecset/iecbits.c
@@ -0,0 +1,259 @@
+/*
+ iecdump - dump IEC958 status bits on ALSA
+ Copyright (C) 2003 by Takashi Iwai <tiwai@suse.de>
+
+ 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
+ of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include <stdio.h>
+#include <alsa/asoundlib.h>
+
+struct category_str {
+ int val;
+ const char *name;
+};
+
+static const struct category_str con_category[] = {
+ { IEC958_AES1_CON_GENERAL, "general" },
+
+ { IEC958_AES1_CON_IEC908_CD, "CD" },
+ { IEC958_AES1_CON_NON_IEC908_CD, "non-IEC908 CD" },
+ { IEC958_AES1_CON_MINI_DISC, "Mini-Disc" },
+ { IEC958_AES1_CON_DVD, "DVD" },
+
+ { IEC958_AES1_CON_PCM_CODER, "PCM coder" },
+ { IEC958_AES1_CON_MIXER, "digital signal mixer" },
+ { IEC958_AES1_CON_RATE_CONVERTER, "rate converter" },
+ { IEC958_AES1_CON_SAMPLER, "sampler" },
+ { IEC958_AES1_CON_DSP, "digital sound processor" },
+
+ { IEC958_AES1_CON_DAT, "DAT" },
+ { IEC958_AES1_CON_VCR, "VCR" },
+ { IEC958_AES1_CON_DCC, "DCC" },
+ { IEC958_AES1_CON_MAGNETIC_DISC, "magnetic disc" },
+
+ { IEC958_AES1_CON_DAB_JAPAN, "digital audio broadcast (Japan)" },
+ { IEC958_AES1_CON_DAB_EUROPE, "digital audio broadcast (Europe)" },
+ { IEC958_AES1_CON_DAB_USA, "digital audio broadcast (USA)" },
+ { IEC958_AES1_CON_SOFTWARE, "software delivery" },
+
+ { IEC958_AES1_CON_SYNTHESIZER, "synthesizer" },
+ { IEC958_AES1_CON_MICROPHONE, "microphone" },
+
+ { IEC958_AES1_CON_ADC, "ADC without copyright information" },
+
+ { IEC958_AES1_CON_ADC_COPYRIGHT, "ADC with copyright information" },
+
+ { IEC958_AES1_CON_SOLIDMEM_DIGITAL_RECORDER_PLAYER, "flash memory recorder/player" },
+
+ { IEC958_AES1_CON_EXPERIMENTAL, "experimental" },
+};
+
+
+#define ARRAY_SIZE(x) (int)(sizeof(x)/sizeof(x[0]))
+
+void dump_iec958(snd_aes_iec958_t *iec)
+{
+ int i;
+
+ if (! (iec->status[0] & IEC958_AES0_PROFESSIONAL)) {
+ /* consumer */
+ printf("Mode: consumer\n");
+ printf("Data: ");
+ if (!(iec->status[0] & IEC958_AES0_NONAUDIO)) {
+ printf("audio\n");
+ } else {
+ printf("non-audio\n");
+ }
+ printf("Rate: ");
+ switch (iec->status[3] & IEC958_AES3_CON_FS) {
+ case IEC958_AES3_CON_FS_22050:
+ printf("22050 Hz\n");
+ break;
+ case IEC958_AES3_CON_FS_24000:
+ printf("24000 Hz\n");
+ break;
+ case IEC958_AES3_CON_FS_32000:
+ printf("32000 Hz\n");
+ break;
+ case IEC958_AES3_CON_FS_44100:
+ printf("44100 Hz\n");
+ break;
+ case IEC958_AES3_CON_FS_48000:
+ printf("48000 Hz\n");
+ break;
+ case IEC958_AES3_CON_FS_88200:
+ printf("88200 Hz\n");
+ break;
+ case IEC958_AES3_CON_FS_96000:
+ printf("96000 Hz\n");
+ break;
+ case IEC958_AES3_CON_FS_176400:
+ printf("176400 Hz\n");
+ break;
+ case IEC958_AES3_CON_FS_192000:
+ printf("192000 Hz\n");
+ break;
+ case IEC958_AES3_CON_FS_768000:
+ printf("768000 Hz\n");
+ break;
+ case IEC958_AES3_CON_FS_NOTID:
+ printf("not indicated\n");
+ break;
+ default:
+ printf("unknown\n");
+ break;
+ }
+ printf("Copyright: ");
+ if (iec->status[0] & IEC958_AES0_CON_NOT_COPYRIGHT) {
+ printf("permitted\n");
+ } else {
+ printf("protected\n");
+ }
+ printf("Emphasis: ");
+ if ((iec->status[0] & IEC958_AES0_CON_EMPHASIS) != IEC958_AES0_CON_EMPHASIS_5015) {
+ printf("none\n");
+ } else {
+ printf("50/15us\n");
+ }
+ printf("Category: ");
+ for (i = 0; i < ARRAY_SIZE(con_category); i++) {
+ if ((iec->status[1] & IEC958_AES1_CON_CATEGORY) == con_category[i].val) {
+ printf("%s\n", con_category[i].name);
+ break;
+ }
+ }
+ if (i >= ARRAY_SIZE(con_category)) {
+ printf("unknown 0x%x\n", iec->status[1] & IEC958_AES1_CON_CATEGORY);
+ }
+ printf("Original: ");
+ if (iec->status[1] & IEC958_AES1_CON_ORIGINAL) {
+ printf("original\n");
+ } else {
+ printf("1st generation\n");
+ }
+ printf("Clock: ");
+ switch (iec->status[3] & IEC958_AES3_CON_CLOCK) {
+ case IEC958_AES3_CON_CLOCK_1000PPM:
+ printf("1000 ppm\n");
+ break;
+ case IEC958_AES3_CON_CLOCK_50PPM:
+ printf("50 ppm\n");
+ break;
+ case IEC958_AES3_CON_CLOCK_VARIABLE:
+ printf("variable pitch\n");
+ break;
+ default:
+ printf("unknown\n");
+ break;
+ }
+ } else {
+ printf("Mode: professional\n");
+ printf("Data: ");
+ if (!(iec->status[0] & IEC958_AES0_NONAUDIO)) {
+ printf("audio\n");
+ } else {
+ printf("non-audio\n");
+ }
+ printf("Rate: ");
+ switch (iec->status[0] & IEC958_AES0_PRO_FS) {
+ case IEC958_AES0_PRO_FS_44100:
+ printf("44100 Hz\n");
+ break;
+ case IEC958_AES0_PRO_FS_48000:
+ printf("48000 Hz\n");
+ break;
+ case IEC958_AES0_PRO_FS_32000:
+ printf("32000 Hz\n");
+ break;
+ default:
+ printf("unknown\n");
+ break;
+ }
+ printf("Rate Locked: ");
+ if (iec->status[0] & IEC958_AES0_PRO_FREQ_UNLOCKED)
+ printf("no\n");
+ else
+ printf("yes\n");
+ printf("Emphasis: ");
+ switch (iec->status[0] & IEC958_AES0_PRO_EMPHASIS) {
+ case IEC958_AES0_PRO_EMPHASIS_CCITT:
+ printf("CCITT J.17\n");
+ break;
+ case IEC958_AES0_PRO_EMPHASIS_NONE:
+ printf("none\n");
+ break;
+ case IEC958_AES0_PRO_EMPHASIS_5015:
+ printf("50/15us\n");
+ break;
+ case IEC958_AES0_PRO_EMPHASIS_NOTID:
+ default:
+ printf("unknown\n");
+ break;
+ }
+ printf("Stereophonic: ");
+ if ((iec->status[1] & IEC958_AES1_PRO_MODE) == IEC958_AES1_PRO_MODE_STEREOPHONIC) {
+ printf("stereo\n");
+ } else {
+ printf("not indicated\n");
+ }
+ printf("Userbits: ");
+ switch (iec->status[1] & IEC958_AES1_PRO_USERBITS) {
+ case IEC958_AES1_PRO_USERBITS_192:
+ printf("192bit\n");
+ break;
+ case IEC958_AES1_PRO_USERBITS_UDEF:
+ printf("user-defined\n");
+ break;
+ default:
+ printf("unkown\n");
+ break;
+ }
+ printf("Sample Bits: ");
+ switch (iec->status[2] & IEC958_AES2_PRO_SBITS) {
+ case IEC958_AES2_PRO_SBITS_20:
+ printf("20 bit\n");
+ break;
+ case IEC958_AES2_PRO_SBITS_24:
+ printf("24 bit\n");
+ break;
+ case IEC958_AES2_PRO_SBITS_UDEF:
+ printf("user defined\n");
+ break;
+ default:
+ printf("unknown\n");
+ break;
+ }
+ printf("Word Length: ");
+ switch (iec->status[2] & IEC958_AES2_PRO_WORDLEN) {
+ case IEC958_AES2_PRO_WORDLEN_22_18:
+ printf("22 bit or 18 bit\n");
+ break;
+ case IEC958_AES2_PRO_WORDLEN_23_19:
+ printf("23 bit or 19 bit\n");
+ break;
+ case IEC958_AES2_PRO_WORDLEN_24_20:
+ printf("24 bit or 20 bit\n");
+ break;
+ case IEC958_AES2_PRO_WORDLEN_20_16:
+ printf("20 bit or 16 bit\n");
+ break;
+ default:
+ printf("unknown\n");
+ break;
+ }
+ }
+}
+
diff --git a/alsa-utils/iecset/iecset.1 b/alsa-utils/iecset/iecset.1
new file mode 100644
index 0000000..dec4ac0
--- /dev/null
+++ b/alsa-utils/iecset/iecset.1
@@ -0,0 +1,104 @@
+.TH iecset 1 "23 Oct 2003"
+.SH NAME
+iecset \- Set or dump IEC958 status bits
+
+.SH SYNOPSIS
+\fBiecset\fP [\fIoptions\fP] [\fIcmd\fP \fIarg\fP...]
+
+.SH DESCRIPTION
+\fBiecset\fP is a small utility to set or dump the IEC958 (or so-called
+"S/PDIF") status bits of the specified sound card via ALSA control API.
+
+When \fBiecset\fP is started without arguments except for options,
+it will show the current IEC958 status in a human-readable form.
+When the commands are given in the arguments, they are parsed
+and the IEC958 status bits are updated. The resultant status is
+shown as well.
+
+The commands consist of the command directive and the argument.
+As the boolean argument, \fIyes\fP, \fIno\fP, \fItrue\fP, \fIfalse\fP,
+or a digit number is allowed.
+
+.SH EXAMPLES
+.TP
+.BI iecset\ \-Dhw:1
+Displays the current IEC958 status bits on the second card.
+This is equivalent with \fI\-c 1\fP.
+.TP
+.BI iecset\ \-x
+Displays the current IEC958 status bits in a style of the arguments
+for the PCM stream. The output string can be passed to the \fIiec958\fP
+(or \fIspdif\fP) PCM type as the optional argument.
+.TP
+.BI iecset\ pro\ off\ audio\ off
+Sets the current status to the consumer-mode and turns on the
+non-audio bit. The modified status will be shown, too.
+
+.SH OPTIONS
+.TP
+\fI\-D\fP device
+Specifies the device name of the control to open
+.TP
+\fI\-c\fP card
+Specifies the card index to open. Equivalent with \fI\-Dhw:x\fP.
+.TP
+\fI\-n\fP index
+Specifies the IEC958 control element index, in case you have multiple
+IEC958 devices and need to choose one of them.
+.TP
+\fI\-x\fP
+Dumps the status in the form of AESx bytes.
+.TP
+\fI\-i\fP
+Reads the command sequences from stdin.
+Each line has single command.
+
+.SH COMMANDS
+.TP
+\fIprofessional\fP <bool>
+The professional mode (true) or consumer mode (false).
+
+.TP
+\fIaudio\fP <bool>
+The audio mode (true) or non-audio mode (false).
+
+.TP
+\fIrate\fP <int>
+The sample rate in Hz.
+
+.TP
+\fIemphasis\fP <int>
+The emphasis: 0 = none, 1 = 50/15us, 2 = CCITT.
+
+.TP
+\fIlock\fP <bool>
+Rate lock: locked (true), unlocked (false).
+This command is for the professional mode only.
+
+.TP
+\fIsbits\fP <int>
+Sample bits: 2 = 20bit, 4 = 24bit, 6 = undefined.
+This command is for the professional mode only.
+
+.TP
+\fIwordlength\fP <int>
+Wordlength: 0 = No, 2 = 22-18 bit, 4 = 23-19 bit, 5 = 24-20 bit, 6 = 20-16 bit.
+This command is for the professional mode only.
+
+.TP
+\fIcategory\fP <int>
+Category: the value is from 0 to 0x7f.
+This command is for the consumer mode only.
+
+.TP
+\fIcopyright\fP <bool>
+Copyright: copyrighted (true), non-copyrighted (false).
+This command is for the consumer mode only.
+
+.TP
+\fIoriginal\fP <boo>
+Original flag: original (true), 1st generation (false).
+This command is for the consumer mode only.
+
+.SH AUTHOR
+Takashi Iwai <tiwai@suse.de>
diff --git a/alsa-utils/iecset/iecset.c b/alsa-utils/iecset/iecset.c
new file mode 100644
index 0000000..92a93e8
--- /dev/null
+++ b/alsa-utils/iecset/iecset.c
@@ -0,0 +1,432 @@
+/*
+ iecset - change IEC958 status bits on ALSA
+ Copyright (C) 2003 by Takashi Iwai <tiwai@suse.de>
+
+ 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
+ of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include <stdio.h>
+#include <ctype.h>
+#include <alsa/asoundlib.h>
+
+void dump_iec958(snd_aes_iec958_t *iec);
+
+static int get_bool(const char *str)
+{
+ if (strncmp(str, "yes", 3) == 0 ||
+ strncmp(str, "YES", 3) == 0 ||
+ strncmp(str, "on", 2) == 0 ||
+ strncmp(str, "ON", 2) == 0 ||
+ strncmp(str, "true", 4) == 0 ||
+ strncmp(str, "TRUE", 4) == 0 ||
+ *str == '1')
+ return 1;
+ return 0;
+}
+
+enum {
+ CMD_BOOL, CMD_BOOL_INV, CMD_INT
+};
+
+enum {
+ IDX_PRO, IDX_NOAUDIO, IDX_RATE, IDX_UNLOCK, IDX_SBITS, IDX_WORD, IDX_EMP, IDX_CAT, IDX_NOCOPY, IDX_ORIG,
+ IDX_LAST
+};
+
+struct cmdtbl {
+ const char *name;
+ int idx;
+ int type;
+ const char *desc;
+};
+
+static const struct cmdtbl cmds[] = {
+ { "pro", IDX_PRO, CMD_BOOL,
+ "professional (common)\n\toff = consumer mode, on = professional mode" },
+ { "aud", IDX_NOAUDIO, CMD_BOOL_INV,
+ "audio (common)\n\ton = audio mode, off = non-audio mode" },
+ { "rat", IDX_RATE, CMD_INT,
+ "rate (common)\n\tsample rate in Hz (0 = not indicated)" },
+ { "emp", IDX_EMP, CMD_INT,
+ "emphasis (common)\n\t0 = none, 1 = 50/15us, 2 = CCITT" },
+ { "loc", IDX_UNLOCK, CMD_BOOL_INV,
+ "lock (prof.)\n\toff = rate unlocked, on = rate locked" },
+ { "sbi", IDX_SBITS, CMD_INT,
+ "sbits (prof.)\n\tsample bits 2 = 20bit, 4 = 24bit, 6 = undef" },
+ { "wor", IDX_WORD, CMD_INT,
+ "wordlength (prof.)\n\t0=no, 2=22-18bit, 4=23-19bit, 5=24-20bit, 6=20-16bit" },
+ { "cat", IDX_CAT, CMD_INT,
+ "category (consumer)\n\t0-0x7f" },
+ { "cop", IDX_NOCOPY, CMD_BOOL_INV,
+ "copyright (consumer)\n\toff = non-copyright, on = copyright" },
+ { "ori", IDX_ORIG, CMD_BOOL,
+ "original (consumer)\n\toff = 1st-gen, on = original" },
+};
+
+
+static void error(const char *s, int err)
+{
+ fprintf(stderr, "%s: %s\n", s, snd_strerror(err));
+}
+
+
+static void usage(void)
+{
+ int i;
+
+ printf("Usage: iecset [options] [cmd arg...]\n");
+ printf("Options:\n");
+ printf(" -D device specifies the control device to use\n");
+ printf(" -c card specifies the card number to use (equiv. with -Dhw:#)\n");
+ printf(" -n number specifies the control index number (default = 0)\n");
+ printf(" -x dump the dump the AESx hex code for IEC958 PCM parameters\n");
+ printf(" -i read commands from stdin\n");
+ printf("Commands:\n");
+ for (i = 0; i < (int)(sizeof(cmds)/sizeof(cmds[0])); i++) {
+ printf(" %s\n", cmds[i].desc);
+ }
+}
+
+
+/*
+ * parse iecset commands
+ */
+static void parse_command(int *parms, const char *c, const char *arg)
+{
+ int i;
+
+ for (i = 0; i < (int)(sizeof(cmds)/sizeof(cmds[0])); i++) {
+ if (strncmp(c, cmds[i].name, strlen(cmds[i].name)) == 0) {
+ int val;
+ switch (cmds[i].type) {
+ case CMD_BOOL:
+ val = get_bool(arg);
+ break;
+ case CMD_BOOL_INV:
+ val = !get_bool(arg);
+ break;
+ case CMD_INT:
+ default:
+ val = (int)strtol(arg, NULL, 0);
+ break;
+ }
+ parms[cmds[i].idx] = val;
+ return;
+ }
+ }
+}
+
+static char *skipspace(char *line)
+{
+ char *p;
+ for (p = line; *p && isspace(*p); p++)
+ ;
+ return p;
+}
+
+/*
+ * parse iecset commands from the file
+ */
+static void parse_file(int *parms, FILE *fp)
+{
+ char line[1024], *cmd, *arg;
+ while (fgets(line, sizeof(line), fp) != NULL) {
+ cmd = skipspace(line);
+ if (*cmd == '#' || ! *cmd)
+ continue;
+ for (arg = cmd; *arg && !isspace(*arg); arg++)
+ ;
+ if (! *arg)
+ continue;
+ *arg++ = 0;
+ arg = skipspace(arg);
+ if (! *arg)
+ continue;
+ parse_command(parms, cmd, arg);
+ }
+}
+
+/* update iec958 status values
+ * return non-zero if the values are modified
+ */
+static int update_iec958_status(snd_aes_iec958_t *iec958, int *parms)
+{
+ int changed = 0;
+ if (parms[IDX_PRO] >= 0) {
+ if (parms[IDX_PRO])
+ iec958->status[0] |= IEC958_AES0_PROFESSIONAL;
+ else
+ iec958->status[0] &= ~IEC958_AES0_PROFESSIONAL;
+ changed = 1;
+ }
+ if (parms[IDX_NOAUDIO] >= 0) {
+ if (parms[IDX_NOAUDIO])
+ iec958->status[0] |= IEC958_AES0_NONAUDIO;
+ else
+ iec958->status[0] &= ~IEC958_AES0_NONAUDIO;
+ changed = 1;
+ }
+ if (parms[IDX_RATE] >= 0) {
+ if (iec958->status[0] & IEC958_AES0_PROFESSIONAL) {
+ iec958->status[0] &= ~IEC958_AES0_PRO_FS;
+ switch (parms[IDX_RATE]) {
+ case 44100:
+ iec958->status[0] |= IEC958_AES0_PRO_FS_44100;
+ break;
+ case 48000:
+ iec958->status[0] |= IEC958_AES0_PRO_FS_48000;
+ break;
+ case 32000:
+ iec958->status[0] |= IEC958_AES0_PRO_FS_32000;
+ break;
+ }
+ } else {
+ iec958->status[3] &= ~IEC958_AES3_CON_FS;
+ switch (parms[IDX_RATE]) {
+ case 22050:
+ iec958->status[3] |= IEC958_AES3_CON_FS_22050;
+ break;
+ case 24000:
+ iec958->status[3] |= IEC958_AES3_CON_FS_24000;
+ break;
+ case 32000:
+ iec958->status[3] |= IEC958_AES3_CON_FS_32000;
+ break;
+ case 44100:
+ iec958->status[3] |= IEC958_AES3_CON_FS_44100;
+ break;
+ case 48000:
+ iec958->status[3] |= IEC958_AES3_CON_FS_48000;
+ break;
+ case 88200:
+ iec958->status[3] |= IEC958_AES3_CON_FS_88200;;
+ break;
+ case 96000:
+ iec958->status[3] |= IEC958_AES3_CON_FS_96000;
+ break;
+ case 176400:
+ iec958->status[3] |= IEC958_AES3_CON_FS_176400;
+ break;
+ case 192000:
+ iec958->status[3] |= IEC958_AES3_CON_FS_192000;
+ break;
+ case 768000:
+ iec958->status[3] |= IEC958_AES3_CON_FS_768000;
+ break;
+ default:
+ iec958->status[3] |= IEC958_AES3_CON_FS_NOTID;
+ break;
+ }
+ }
+ changed = 1;
+ }
+ if (parms[IDX_NOCOPY] >= 0) {
+ if (! (iec958->status[0] & IEC958_AES0_PROFESSIONAL)) {
+ if (parms[IDX_NOCOPY])
+ iec958->status[0] |= IEC958_AES0_CON_NOT_COPYRIGHT;
+ else
+ iec958->status[0] &= ~IEC958_AES0_CON_NOT_COPYRIGHT;
+ }
+ changed = 1;
+ }
+ if (parms[IDX_ORIG] >= 0) {
+ if (! (iec958->status[0] & IEC958_AES0_PROFESSIONAL)) {
+ if (parms[IDX_ORIG])
+ iec958->status[1] |= IEC958_AES1_CON_ORIGINAL;
+ else
+ iec958->status[1] &= ~IEC958_AES1_CON_ORIGINAL;
+ }
+ changed = 1;
+ }
+ if (parms[IDX_EMP] >= 0) {
+ if (iec958->status[0] & IEC958_AES0_PROFESSIONAL) {
+ iec958->status[0] &= ~IEC958_AES0_PRO_EMPHASIS;
+ switch (parms[IDX_EMP]) {
+ case 0:
+ iec958->status[0] |= IEC958_AES0_PRO_EMPHASIS_NONE;
+ break;
+ case 1:
+ iec958->status[0] |= IEC958_AES0_PRO_EMPHASIS_5015;
+ break;
+ case 2:
+ iec958->status[0] |= IEC958_AES0_PRO_EMPHASIS_CCITT;
+ break;
+ }
+ } else {
+ if (parms[IDX_EMP])
+ iec958->status[0] |= IEC958_AES0_CON_EMPHASIS_5015;
+ else
+ iec958->status[0] &= ~IEC958_AES0_CON_EMPHASIS_5015;
+ }
+ changed = 1;
+ }
+ if (parms[IDX_UNLOCK] >= 0) {
+ if (iec958->status[0] & IEC958_AES0_PROFESSIONAL) {
+ if (parms[IDX_UNLOCK])
+ iec958->status[0] |= IEC958_AES0_PRO_FREQ_UNLOCKED;
+ else
+ iec958->status[0] &= ~IEC958_AES0_PRO_FREQ_UNLOCKED;
+ }
+ changed = 1;
+ }
+ if (parms[IDX_SBITS] >= 0) {
+ if (iec958->status[0] & IEC958_AES0_PROFESSIONAL) {
+ iec958->status[2] &= ~IEC958_AES2_PRO_SBITS;
+ iec958->status[2] |= parms[IDX_SBITS] & 7;
+ }
+ changed = 1;
+ }
+ if (parms[IDX_WORD] >= 0) {
+ if (iec958->status[0] & IEC958_AES0_PROFESSIONAL) {
+ iec958->status[2] &= ~IEC958_AES2_PRO_WORDLEN;
+ iec958->status[2] |= (parms[IDX_WORD] & 7) << 3;
+ }
+ changed = 1;
+ }
+ if (parms[IDX_CAT] >= 0) {
+ if (! (iec958->status[0] & IEC958_AES0_PROFESSIONAL)) {
+ iec958->status[1] &= ~IEC958_AES1_CON_CATEGORY;
+ iec958->status[1] |= parms[IDX_CAT] & 0x7f;
+ }
+ changed = 1;
+ }
+
+ return changed;
+}
+
+
+int main(int argc, char **argv)
+{
+ const char *dev = "default";
+ const char *spdif_str = SND_CTL_NAME_IEC958("", PLAYBACK, DEFAULT);
+ int spdif_index = -1;
+ snd_ctl_t *ctl;
+ snd_ctl_elem_list_t *clist;
+ snd_ctl_elem_id_t *cid;
+ snd_ctl_elem_value_t *cval;
+ snd_aes_iec958_t iec958;
+ int from_stdin = 0;
+ int dumphex = 0;
+ int i, c, err;
+ unsigned int controls, cidx;
+ char tmpname[32];
+ int parms[IDX_LAST];
+
+ for (i = 0; i < IDX_LAST; i++)
+ parms[i] = -1; /* not set */
+
+ while ((c = getopt(argc, argv, "D:c:n:xhi")) != -1) {
+ switch (c) {
+ case 'D':
+ dev = optarg;
+ break;
+ case 'c':
+ i = atoi(optarg);
+ if (i < 0 || i >= 32) {
+ fprintf(stderr, "invalid card index %d\n", i);
+ return 1;
+ }
+ sprintf(tmpname, "hw:%d", i);
+ dev = tmpname;
+ break;
+ case 'n':
+ spdif_index = atoi(optarg);
+ break;
+ case 'x':
+ dumphex = 1;
+ break;
+ case 'i':
+ from_stdin = 1;
+ break;
+ default:
+ usage();
+ return 1;
+ }
+ }
+
+ if ((err = snd_ctl_open(&ctl, dev, 0)) < 0) {
+ error("snd_ctl_open", err);
+ return 1;
+ }
+
+ snd_ctl_elem_list_alloca(&clist);
+ if ((err = snd_ctl_elem_list(ctl, clist)) < 0) {
+ error("snd_ctl_elem_list", err);
+ return 1;
+ }
+ if ((err = snd_ctl_elem_list_alloc_space(clist, snd_ctl_elem_list_get_count(clist))) < 0) {
+ error("snd_ctl_elem_list_alloc_space", err);
+ return 1;
+ }
+ if ((err = snd_ctl_elem_list(ctl, clist)) < 0) {
+ error("snd_ctl_elem_list", err);
+ return 1;
+ }
+
+ controls = snd_ctl_elem_list_get_used(clist);
+ for (cidx = 0; cidx < controls; cidx++) {
+ if (!strcmp(snd_ctl_elem_list_get_name(clist, cidx), spdif_str))
+ if (spdif_index < 0 ||
+ snd_ctl_elem_list_get_index(clist, cidx) == spdif_index)
+ break;
+ }
+ if (cidx >= controls) {
+ fprintf(stderr, "control \"%s\" (index %d) not found\n",
+ spdif_str, spdif_index);
+ return 1;
+ }
+
+ snd_ctl_elem_id_alloca(&cid);
+ snd_ctl_elem_list_get_id(clist, cidx, cid);
+ snd_ctl_elem_value_alloca(&cval);
+ snd_ctl_elem_value_set_id(cval, cid);
+ if ((err = snd_ctl_elem_read(ctl, cval)) < 0) {
+ error("snd_ctl_elem_read", err);
+ return 1;
+ }
+
+ snd_ctl_elem_value_get_iec958(cval, &iec958);
+
+ /* parse from stdin */
+ if (from_stdin)
+ parse_file(parms, stdin);
+
+ /* parse commands */
+ for (c = optind; c < argc - 1; c += 2)
+ parse_command(parms, argv[c], argv[c + 1]);
+
+ if (update_iec958_status(&iec958, parms)) {
+ /* store the values */
+ snd_ctl_elem_value_set_iec958(cval, &iec958);
+ if ((err = snd_ctl_elem_write(ctl, cval)) < 0) {
+ error("snd_ctl_elem_write", err);
+ return 1;
+ }
+ if ((err = snd_ctl_elem_read(ctl, cval)) < 0) {
+ error("snd_ctl_elem_write", err);
+ return 1;
+ }
+ snd_ctl_elem_value_get_iec958(cval, &iec958);
+ }
+
+ if (dumphex)
+ printf("AES0=0x%02x,AES1=0x%02x,AES2=0x%02x,AES3=0x%02x\n",
+ iec958.status[0], iec958.status[1], iec958.status[2], iec958.status[3]);
+ else
+ dump_iec958(&iec958);
+
+ snd_ctl_close(ctl);
+ return 0;
+}