diff options
author | Jeong-Seok Yang <jseok.yang@samsung.com> | 2010-08-25 18:32:24 -0700 |
---|---|---|
committer | Ed Heyl <edheyl@google.com> | 2010-08-25 18:52:19 -0700 |
commit | ec456383c58adf2d4c4818438a703e5a2ca949b5 (patch) | |
tree | 6d7b1ddc2610c37e911917dad5be7ebdebc6c6ad /alsa-lib/aserver | |
parent | 1206fad9881e5bca592fcd0fbdafc9d7f195d539 (diff) | |
download | device_samsung_crespo-ec456383c58adf2d4c4818438a703e5a2ca949b5.zip device_samsung_crespo-ec456383c58adf2d4c4818438a703e5a2ca949b5.tar.gz device_samsung_crespo-ec456383c58adf2d4c4818438a703e5a2ca949b5.tar.bz2 |
S5PC11X: crespo: add alsa-lib, alsa-utils, libaudio, libcamera
Change-Id: I4a6ee248b407c67682eb8884d1176f4807288c7c
Diffstat (limited to 'alsa-lib/aserver')
-rw-r--r-- | alsa-lib/aserver/COPYING | 340 | ||||
-rw-r--r-- | alsa-lib/aserver/Makefile.am | 12 | ||||
-rw-r--r-- | alsa-lib/aserver/Makefile.in | 556 | ||||
-rw-r--r-- | alsa-lib/aserver/aserver.c | 1104 |
4 files changed, 2012 insertions, 0 deletions
diff --git a/alsa-lib/aserver/COPYING b/alsa-lib/aserver/COPYING new file mode 100644 index 0000000..b07ad0d --- /dev/null +++ b/alsa-lib/aserver/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + 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.1 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 + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + <signature of Ty Coon>, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/alsa-lib/aserver/Makefile.am b/alsa-lib/aserver/Makefile.am new file mode 100644 index 0000000..116f578 --- /dev/null +++ b/alsa-lib/aserver/Makefile.am @@ -0,0 +1,12 @@ +bin_PROGRAMS = aserver +aserver_SOURCES = aserver.c +# aserver_LDADD = -lasound +aserver_LDADD = ../src/libasound.la + +all: aserver + +INCLUDES=-I$(top_srcdir)/include -I$(top_srcdir)/src/pcm + +../src/libasound.la: + $(MAKE) -C ../src libasound.la + diff --git a/alsa-lib/aserver/Makefile.in b/alsa-lib/aserver/Makefile.in new file mode 100644 index 0000000..2e9828a --- /dev/null +++ b/alsa-lib/aserver/Makefile.in @@ -0,0 +1,556 @@ +# 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 = aserver$(EXEEXT) +subdir = aserver +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in COPYING +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(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/config.h +CONFIG_CLEAN_FILES = +am__installdirs = "$(DESTDIR)$(bindir)" +binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) +PROGRAMS = $(bin_PROGRAMS) +am_aserver_OBJECTS = aserver.$(OBJEXT) +aserver_OBJECTS = $(am_aserver_OBJECTS) +aserver_DEPENDENCIES = ../src/libasound.la +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) +LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(aserver_SOURCES) +DIST_SOURCES = $(aserver_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALSA_CONFIG_DIR = @ALSA_CONFIG_DIR@ +ALSA_DEPLIBS = @ALSA_DEPLIBS@ +ALSA_HSEARCH_R_FALSE = @ALSA_HSEARCH_R_FALSE@ +ALSA_HSEARCH_R_TRUE = @ALSA_HSEARCH_R_TRUE@ +ALSA_PLUGIN_DIR = @ALSA_PLUGIN_DIR@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BUILD_ALISP_FALSE = @BUILD_ALISP_FALSE@ +BUILD_ALISP_TRUE = @BUILD_ALISP_TRUE@ +BUILD_CTL_PLUGIN_EXT_FALSE = @BUILD_CTL_PLUGIN_EXT_FALSE@ +BUILD_CTL_PLUGIN_EXT_TRUE = @BUILD_CTL_PLUGIN_EXT_TRUE@ +BUILD_CTL_PLUGIN_FALSE = @BUILD_CTL_PLUGIN_FALSE@ +BUILD_CTL_PLUGIN_SHM_FALSE = @BUILD_CTL_PLUGIN_SHM_FALSE@ +BUILD_CTL_PLUGIN_SHM_TRUE = @BUILD_CTL_PLUGIN_SHM_TRUE@ +BUILD_CTL_PLUGIN_TRUE = @BUILD_CTL_PLUGIN_TRUE@ +BUILD_HWDEP_FALSE = @BUILD_HWDEP_FALSE@ +BUILD_HWDEP_TRUE = @BUILD_HWDEP_TRUE@ +BUILD_MIXER_FALSE = @BUILD_MIXER_FALSE@ +BUILD_MIXER_TRUE = @BUILD_MIXER_TRUE@ +BUILD_MODULES_FALSE = @BUILD_MODULES_FALSE@ +BUILD_MODULES_TRUE = @BUILD_MODULES_TRUE@ +BUILD_PCM_FALSE = @BUILD_PCM_FALSE@ +BUILD_PCM_PLUGIN_ADPCM_FALSE = @BUILD_PCM_PLUGIN_ADPCM_FALSE@ +BUILD_PCM_PLUGIN_ADPCM_TRUE = @BUILD_PCM_PLUGIN_ADPCM_TRUE@ +BUILD_PCM_PLUGIN_ALAW_FALSE = @BUILD_PCM_PLUGIN_ALAW_FALSE@ +BUILD_PCM_PLUGIN_ALAW_TRUE = @BUILD_PCM_PLUGIN_ALAW_TRUE@ +BUILD_PCM_PLUGIN_ASYM_FALSE = @BUILD_PCM_PLUGIN_ASYM_FALSE@ +BUILD_PCM_PLUGIN_ASYM_TRUE = @BUILD_PCM_PLUGIN_ASYM_TRUE@ +BUILD_PCM_PLUGIN_COPY_FALSE = @BUILD_PCM_PLUGIN_COPY_FALSE@ +BUILD_PCM_PLUGIN_COPY_TRUE = @BUILD_PCM_PLUGIN_COPY_TRUE@ +BUILD_PCM_PLUGIN_DMIX_FALSE = @BUILD_PCM_PLUGIN_DMIX_FALSE@ +BUILD_PCM_PLUGIN_DMIX_TRUE = @BUILD_PCM_PLUGIN_DMIX_TRUE@ +BUILD_PCM_PLUGIN_DSHARE_FALSE = @BUILD_PCM_PLUGIN_DSHARE_FALSE@ +BUILD_PCM_PLUGIN_DSHARE_TRUE = @BUILD_PCM_PLUGIN_DSHARE_TRUE@ +BUILD_PCM_PLUGIN_DSNOOP_FALSE = @BUILD_PCM_PLUGIN_DSNOOP_FALSE@ +BUILD_PCM_PLUGIN_DSNOOP_TRUE = @BUILD_PCM_PLUGIN_DSNOOP_TRUE@ +BUILD_PCM_PLUGIN_EMPTY_FALSE = @BUILD_PCM_PLUGIN_EMPTY_FALSE@ +BUILD_PCM_PLUGIN_EMPTY_TRUE = @BUILD_PCM_PLUGIN_EMPTY_TRUE@ +BUILD_PCM_PLUGIN_EXTPLUG_FALSE = @BUILD_PCM_PLUGIN_EXTPLUG_FALSE@ +BUILD_PCM_PLUGIN_EXTPLUG_TRUE = @BUILD_PCM_PLUGIN_EXTPLUG_TRUE@ +BUILD_PCM_PLUGIN_FALSE = @BUILD_PCM_PLUGIN_FALSE@ +BUILD_PCM_PLUGIN_FILE_FALSE = @BUILD_PCM_PLUGIN_FILE_FALSE@ +BUILD_PCM_PLUGIN_FILE_TRUE = @BUILD_PCM_PLUGIN_FILE_TRUE@ +BUILD_PCM_PLUGIN_HOOKS_FALSE = @BUILD_PCM_PLUGIN_HOOKS_FALSE@ +BUILD_PCM_PLUGIN_HOOKS_TRUE = @BUILD_PCM_PLUGIN_HOOKS_TRUE@ +BUILD_PCM_PLUGIN_IEC958_FALSE = @BUILD_PCM_PLUGIN_IEC958_FALSE@ +BUILD_PCM_PLUGIN_IEC958_TRUE = @BUILD_PCM_PLUGIN_IEC958_TRUE@ +BUILD_PCM_PLUGIN_IOPLUG_FALSE = @BUILD_PCM_PLUGIN_IOPLUG_FALSE@ +BUILD_PCM_PLUGIN_IOPLUG_TRUE = @BUILD_PCM_PLUGIN_IOPLUG_TRUE@ +BUILD_PCM_PLUGIN_LADSPA_FALSE = @BUILD_PCM_PLUGIN_LADSPA_FALSE@ +BUILD_PCM_PLUGIN_LADSPA_TRUE = @BUILD_PCM_PLUGIN_LADSPA_TRUE@ +BUILD_PCM_PLUGIN_LFLOAT_FALSE = @BUILD_PCM_PLUGIN_LFLOAT_FALSE@ +BUILD_PCM_PLUGIN_LFLOAT_TRUE = @BUILD_PCM_PLUGIN_LFLOAT_TRUE@ +BUILD_PCM_PLUGIN_LINEAR_FALSE = @BUILD_PCM_PLUGIN_LINEAR_FALSE@ +BUILD_PCM_PLUGIN_LINEAR_TRUE = @BUILD_PCM_PLUGIN_LINEAR_TRUE@ +BUILD_PCM_PLUGIN_METER_FALSE = @BUILD_PCM_PLUGIN_METER_FALSE@ +BUILD_PCM_PLUGIN_METER_TRUE = @BUILD_PCM_PLUGIN_METER_TRUE@ +BUILD_PCM_PLUGIN_MMAP_EMUL_FALSE = @BUILD_PCM_PLUGIN_MMAP_EMUL_FALSE@ +BUILD_PCM_PLUGIN_MMAP_EMUL_TRUE = @BUILD_PCM_PLUGIN_MMAP_EMUL_TRUE@ +BUILD_PCM_PLUGIN_MULAW_FALSE = @BUILD_PCM_PLUGIN_MULAW_FALSE@ +BUILD_PCM_PLUGIN_MULAW_TRUE = @BUILD_PCM_PLUGIN_MULAW_TRUE@ +BUILD_PCM_PLUGIN_MULTI_FALSE = @BUILD_PCM_PLUGIN_MULTI_FALSE@ +BUILD_PCM_PLUGIN_MULTI_TRUE = @BUILD_PCM_PLUGIN_MULTI_TRUE@ +BUILD_PCM_PLUGIN_NULL_FALSE = @BUILD_PCM_PLUGIN_NULL_FALSE@ +BUILD_PCM_PLUGIN_NULL_TRUE = @BUILD_PCM_PLUGIN_NULL_TRUE@ +BUILD_PCM_PLUGIN_PLUG_FALSE = @BUILD_PCM_PLUGIN_PLUG_FALSE@ +BUILD_PCM_PLUGIN_PLUG_TRUE = @BUILD_PCM_PLUGIN_PLUG_TRUE@ +BUILD_PCM_PLUGIN_RATE_FALSE = @BUILD_PCM_PLUGIN_RATE_FALSE@ +BUILD_PCM_PLUGIN_RATE_TRUE = @BUILD_PCM_PLUGIN_RATE_TRUE@ +BUILD_PCM_PLUGIN_ROUTE_FALSE = @BUILD_PCM_PLUGIN_ROUTE_FALSE@ +BUILD_PCM_PLUGIN_ROUTE_TRUE = @BUILD_PCM_PLUGIN_ROUTE_TRUE@ +BUILD_PCM_PLUGIN_SHARE_FALSE = @BUILD_PCM_PLUGIN_SHARE_FALSE@ +BUILD_PCM_PLUGIN_SHARE_TRUE = @BUILD_PCM_PLUGIN_SHARE_TRUE@ +BUILD_PCM_PLUGIN_SHM_FALSE = @BUILD_PCM_PLUGIN_SHM_FALSE@ +BUILD_PCM_PLUGIN_SHM_TRUE = @BUILD_PCM_PLUGIN_SHM_TRUE@ +BUILD_PCM_PLUGIN_SOFTVOL_FALSE = @BUILD_PCM_PLUGIN_SOFTVOL_FALSE@ +BUILD_PCM_PLUGIN_SOFTVOL_TRUE = @BUILD_PCM_PLUGIN_SOFTVOL_TRUE@ +BUILD_PCM_PLUGIN_TRUE = @BUILD_PCM_PLUGIN_TRUE@ +BUILD_PCM_TRUE = @BUILD_PCM_TRUE@ +BUILD_PYTHON_FALSE = @BUILD_PYTHON_FALSE@ +BUILD_PYTHON_TRUE = @BUILD_PYTHON_TRUE@ +BUILD_RAWMIDI_FALSE = @BUILD_RAWMIDI_FALSE@ +BUILD_RAWMIDI_TRUE = @BUILD_RAWMIDI_TRUE@ +BUILD_SEQ_FALSE = @BUILD_SEQ_FALSE@ +BUILD_SEQ_TRUE = @BUILD_SEQ_TRUE@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +GREP = @GREP@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_M4_FALSE = @INSTALL_M4_FALSE@ +INSTALL_M4_TRUE = @INSTALL_M4_TRUE@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +KEEP_OLD_SYMBOLS_FALSE = @KEEP_OLD_SYMBOLS_FALSE@ +KEEP_OLD_SYMBOLS_TRUE = @KEEP_OLD_SYMBOLS_TRUE@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIBTOOL_VERSION_INFO = @LIBTOOL_VERSION_INFO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +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@ +PYTHON_INCLUDES = @PYTHON_INCLUDES@ +PYTHON_LIBS = @PYTHON_LIBS@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SND_LIB_EXTRAVER = @SND_LIB_EXTRAVER@ +SND_LIB_MAJOR = @SND_LIB_MAJOR@ +SND_LIB_MINOR = @SND_LIB_MINOR@ +SND_LIB_SUBMINOR = @SND_LIB_SUBMINOR@ +SND_LIB_VERSION = @SND_LIB_VERSION@ +STRIP = @STRIP@ +SYMBOLIC_FUNCTIONS_FALSE = @SYMBOLIC_FUNCTIONS_FALSE@ +SYMBOLIC_FUNCTIONS_TRUE = @SYMBOLIC_FUNCTIONS_TRUE@ +SYMBOL_PREFIX = @SYMBOL_PREFIX@ +VERSION = @VERSION@ +VERSIONED_SYMBOLS_FALSE = @VERSIONED_SYMBOLS_FALSE@ +VERSIONED_SYMBOLS_TRUE = @VERSIONED_SYMBOLS_TRUE@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +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@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +aserver_SOURCES = aserver.c +# aserver_LDADD = -lasound +aserver_LDADD = ../src/libasound.la +INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/src/pcm +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign aserver/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign aserver/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 \ + || test -f $$p1 \ + ; then \ + f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(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: + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done +aserver$(EXEEXT): $(aserver_OBJECTS) $(aserver_DEPENDENCIES) + @rm -f aserver$(EXEEXT) + $(LINK) $(aserver_LDFLAGS) $(aserver_OBJECTS) $(aserver_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aserver.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) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) +installdirs: + for dir in "$(DESTDIR)$(bindir)"; 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 clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: install-binPROGRAMS + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binPROGRAMS uninstall-info-am + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ + clean-generic clean-libtool ctags distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-binPROGRAMS install-data install-data-am install-exec \ + install-exec-am install-info install-info-am install-man \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am \ + uninstall-binPROGRAMS uninstall-info-am + + +all: aserver + +../src/libasound.la: + $(MAKE) -C ../src libasound.la +# 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-lib/aserver/aserver.c b/alsa-lib/aserver/aserver.c new file mode 100644 index 0000000..73ea4e9 --- /dev/null +++ b/alsa-lib/aserver/aserver.c @@ -0,0 +1,1104 @@ +/* + * ALSA server + * Copyright (c) by Abramo Bagnara <abramo@alsa-project.org> + * + * 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 <sys/shm.h> +#include <sys/socket.h> +#include <sys/poll.h> +#include <sys/un.h> +#include <sys/uio.h> +#include <stdio.h> +#include <unistd.h> +#include <fcntl.h> +#include <stddef.h> +#include <getopt.h> +#include <netinet/in.h> +#include <netdb.h> +#include <limits.h> +#include <signal.h> + +#include "aserver.h" + +char *command; + +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) +#define ERROR(...) do {\ + fprintf(stderr, "%s %s:%i:(%s) ", command, __FILE__, __LINE__, __FUNCTION__); \ + fprintf(stderr, __VA_ARGS__); \ + putc('\n', stderr); \ +} while (0) +#else +#define ERROR(args...) do {\ + fprintf(stderr, "%s %s:%i:(%s) ", command, __FILE__, __LINE__, __FUNCTION__); \ + fprintf(stderr, ##args); \ + putc('\n', stderr); \ +} while (0) +#endif + +#define SYSERROR(string) ERROR(string ": %s", strerror(errno)) + +static int make_local_socket(const char *filename) +{ + size_t l = strlen(filename); + size_t size = offsetof(struct sockaddr_un, sun_path) + l; + struct sockaddr_un *addr = alloca(size); + int sock; + + sock = socket(PF_LOCAL, SOCK_STREAM, 0); + if (sock < 0) { + int result = -errno; + SYSERROR("socket failed"); + return result; + } + + unlink(filename); + + addr->sun_family = AF_LOCAL; + memcpy(addr->sun_path, filename, l); + + if (bind(sock, (struct sockaddr *) addr, size) < 0) { + int result = -errno; + SYSERROR("bind failed"); + return result; + } + + return sock; +} + +static int make_inet_socket(int port) +{ + struct sockaddr_in addr; + int sock; + + sock = socket(PF_INET, SOCK_STREAM, 0); + if (sock < 0) { + int result = -errno; + SYSERROR("socket failed"); + return result; + } + + addr.sin_family = AF_INET; + addr.sin_port = htons(port); + addr.sin_addr.s_addr = INADDR_ANY; + + if (bind(sock, (struct sockaddr *) &addr, sizeof(addr)) < 0) { + int result = -errno; + SYSERROR("bind failed"); + return result; + } + + return sock; +} + +struct pollfd *pollfds; +unsigned int pollfds_count = 0; +typedef struct waiter waiter_t; +typedef int (*waiter_handler_t)(waiter_t *waiter, unsigned short events); +struct waiter { + int fd; + void *private_data; + waiter_handler_t handler; +}; +waiter_t *waiters; + +static void add_waiter(int fd, unsigned short events, waiter_handler_t handler, + void *data) +{ + waiter_t *w = &waiters[fd]; + struct pollfd *pfd = &pollfds[pollfds_count]; + assert(!w->handler); + pfd->fd = fd; + pfd->events = events; + pfd->revents = 0; + w->fd = fd; + w->private_data = data; + w->handler = handler; + pollfds_count++; +} + +static void del_waiter(int fd) +{ + waiter_t *w = &waiters[fd]; + unsigned int k; + assert(w->handler); + w->handler = 0; + for (k = 0; k < pollfds_count; ++k) { + if (pollfds[k].fd == fd) + break; + } + assert(k < pollfds_count); + pollfds_count--; + memmove(&pollfds[k], &pollfds[k + 1], pollfds_count - k); +} + +typedef struct client client_t; + +typedef struct { + int (*open)(client_t *client, int *cookie); + int (*cmd)(client_t *client); + int (*close)(client_t *client); +} transport_ops_t; + +struct client { + struct list_head list; + int poll_fd; + int ctrl_fd; + int local; + int transport_type; + int dev_type; + char name[256]; + int stream; + int mode; + transport_ops_t *ops; + snd_async_handler_t *async_handler; + int async_sig; + pid_t async_pid; + union { + struct { + snd_pcm_t *handle; + int fd; + } pcm; + struct { + snd_ctl_t *handle; + int fd; + } ctl; +#if 0 + struct { + snd_rawmidi_t *handle; + } rawmidi; + struct { + snd_timer_open_t *handle; + } timer; + struct { + snd_hwdep_t *handle; + } hwdep; + struct { + snd_seq_t *handle; + } seq; +#endif + } device; + int polling; + int open; + int cookie; + union { + struct { + int ctrl_id; + void *ctrl; + } shm; + } transport; +}; + +LIST_HEAD(clients); + +typedef struct { + struct list_head list; + int fd; + uint32_t cookie; +} inet_pending_t; +LIST_HEAD(inet_pendings); + +#if 0 +static int pcm_handler(waiter_t *waiter, unsigned short events) +{ + client_t *client = waiter->private_data; + char buf[1]; + ssize_t n; + if (events & POLLIN) { + n = write(client->poll_fd, buf, 1); + if (n != 1) { + SYSERROR("write failed"); + return -errno; + } + } else if (events & POLLOUT) { + n = read(client->poll_fd, buf, 1); + if (n != 1) { + SYSERROR("read failed"); + return -errno; + } + } + del_waiter(waiter->fd); + client->polling = 0; + return 0; +} +#endif + +static void pcm_shm_hw_ptr_changed(snd_pcm_t *pcm, snd_pcm_t *src ATTRIBUTE_UNUSED) +{ + client_t *client = pcm->hw.private_data; + volatile snd_pcm_shm_ctrl_t *ctrl = client->transport.shm.ctrl; + snd_pcm_t *loop; + + ctrl->hw.changed = 1; + if (pcm->hw.fd >= 0) { + ctrl->hw.use_mmap = 1; + ctrl->hw.offset = pcm->hw.offset; + return; + } + ctrl->hw.use_mmap = 0; + ctrl->hw.ptr = pcm->hw.ptr ? *pcm->hw.ptr : 0; + for (loop = pcm->hw.master; loop; loop = loop->hw.master) + loop->hw.ptr = &ctrl->hw.ptr; + pcm->hw.ptr = &ctrl->hw.ptr; +} + +static void pcm_shm_appl_ptr_changed(snd_pcm_t *pcm, snd_pcm_t *src ATTRIBUTE_UNUSED) +{ + client_t *client = pcm->appl.private_data; + volatile snd_pcm_shm_ctrl_t *ctrl = client->transport.shm.ctrl; + snd_pcm_t *loop; + + ctrl->appl.changed = 1; + if (pcm->appl.fd >= 0) { + ctrl->appl.use_mmap = 1; + ctrl->appl.offset = pcm->appl.offset; + return; + } + ctrl->appl.use_mmap = 0; + ctrl->appl.ptr = pcm->appl.ptr ? *pcm->appl.ptr : 0; + for (loop = pcm->appl.master; loop; loop = loop->appl.master) + loop->appl.ptr = &ctrl->appl.ptr; + pcm->appl.ptr = &ctrl->appl.ptr; +} + +static int pcm_shm_open(client_t *client, int *cookie) +{ + int shmid; + snd_pcm_t *pcm; + int err; + int result; + err = snd_pcm_open(&pcm, client->name, client->stream, SND_PCM_NONBLOCK); + if (err < 0) + return err; + client->device.pcm.handle = pcm; + client->device.pcm.fd = _snd_pcm_poll_descriptor(pcm); + pcm->hw.private_data = client; + pcm->hw.changed = pcm_shm_hw_ptr_changed; + pcm->appl.private_data = client; + pcm->appl.changed = pcm_shm_appl_ptr_changed; + + shmid = shmget(IPC_PRIVATE, PCM_SHM_SIZE, 0666); + if (shmid < 0) { + result = -errno; + SYSERROR("shmget failed"); + goto _err; + } + client->transport.shm.ctrl_id = shmid; + client->transport.shm.ctrl = shmat(shmid, 0, 0); + if (client->transport.shm.ctrl == (void*) -1) { + result = -errno; + shmctl(shmid, IPC_RMID, 0); + SYSERROR("shmat failed"); + goto _err; + } + *cookie = shmid; + return 0; + + _err: + snd_pcm_close(pcm); + return result; + +} + +static int pcm_shm_close(client_t *client) +{ + int err; + snd_pcm_shm_ctrl_t *ctrl = client->transport.shm.ctrl; + if (client->polling) { + del_waiter(client->device.pcm.fd); + client->polling = 0; + } + err = snd_pcm_close(client->device.pcm.handle); + ctrl->result = err; + if (err < 0) + ERROR("snd_pcm_close"); + if (client->transport.shm.ctrl) { + err = shmdt((void *)client->transport.shm.ctrl); + if (err < 0) + SYSERROR("shmdt failed"); + err = shmctl(client->transport.shm.ctrl_id, IPC_RMID, 0); + if (err < 0) + SYSERROR("shmctl IPC_RMID failed"); + client->transport.shm.ctrl = 0; + } + client->open = 0; + return 0; +} + +static int shm_ack(client_t *client) +{ + struct pollfd pfd; + int err; + char buf[1]; + pfd.fd = client->ctrl_fd; + pfd.events = POLLHUP; + if (poll(&pfd, 1, 0) == 1) + return -EBADFD; + err = write(client->ctrl_fd, buf, 1); + if (err != 1) + return -EBADFD; + return 0; +} + +static int shm_ack_fd(client_t *client, int fd) +{ + struct pollfd pfd; + int err; + char buf[1]; + pfd.fd = client->ctrl_fd; + pfd.events = POLLHUP; + if (poll(&pfd, 1, 0) == 1) + return -EBADFD; + err = snd_send_fd(client->ctrl_fd, buf, 1, fd); + if (err != 1) + return -EBADFD; + return 0; +} + +static int shm_rbptr_fd(client_t *client, snd_pcm_rbptr_t *rbptr) +{ + if (rbptr->fd < 0) + return -EINVAL; + return shm_ack_fd(client, rbptr->fd); +} + +static void async_handler(snd_async_handler_t *handler) +{ + client_t *client = snd_async_handler_get_callback_private(handler); + /* FIXME: use sigqueue */ + kill(client->async_pid, client->async_sig); +} + +static int pcm_shm_cmd(client_t *client) +{ + volatile snd_pcm_shm_ctrl_t *ctrl = client->transport.shm.ctrl; + char buf[1]; + int err; + int cmd; + snd_pcm_t *pcm; + err = read(client->ctrl_fd, buf, 1); + if (err != 1) + return -EBADFD; + cmd = ctrl->cmd; + ctrl->cmd = 0; + pcm = client->device.pcm.handle; + switch (cmd) { + case SND_PCM_IOCTL_ASYNC: + ctrl->result = snd_pcm_async(pcm, ctrl->u.async.sig, ctrl->u.async.pid); + if (ctrl->result < 0) + break; + if (ctrl->u.async.sig >= 0) { + assert(client->async_sig < 0); + ctrl->result = snd_async_add_pcm_handler(&client->async_handler, pcm, async_handler, client); + if (ctrl->result < 0) + break; + } else { + assert(client->async_sig >= 0); + snd_async_del_handler(client->async_handler); + } + client->async_sig = ctrl->u.async.sig; + client->async_pid = ctrl->u.async.pid; + break; + case SNDRV_PCM_IOCTL_INFO: + ctrl->result = snd_pcm_info(pcm, (snd_pcm_info_t *) &ctrl->u.info); + break; + case SNDRV_PCM_IOCTL_HW_REFINE: + ctrl->result = snd_pcm_hw_refine(pcm, (snd_pcm_hw_params_t *) &ctrl->u.hw_refine); + break; + case SNDRV_PCM_IOCTL_HW_PARAMS: + ctrl->result = snd_pcm_hw_params(pcm, (snd_pcm_hw_params_t *) &ctrl->u.hw_params); + break; + case SNDRV_PCM_IOCTL_HW_FREE: + ctrl->result = snd_pcm_hw_free(pcm); + break; + case SNDRV_PCM_IOCTL_SW_PARAMS: + ctrl->result = snd_pcm_sw_params(pcm, (snd_pcm_sw_params_t *) &ctrl->u.sw_params); + break; + case SNDRV_PCM_IOCTL_STATUS: + ctrl->result = snd_pcm_status(pcm, (snd_pcm_status_t *) &ctrl->u.status); + break; + case SND_PCM_IOCTL_STATE: + ctrl->result = snd_pcm_state(pcm); + break; + case SND_PCM_IOCTL_HWSYNC: + ctrl->result = snd_pcm_hwsync(pcm); + break; + case SNDRV_PCM_IOCTL_DELAY: + ctrl->result = snd_pcm_delay(pcm, (snd_pcm_sframes_t *) &ctrl->u.delay.frames); + break; + case SND_PCM_IOCTL_AVAIL_UPDATE: + ctrl->result = snd_pcm_avail_update(pcm); + break; + case SNDRV_PCM_IOCTL_PREPARE: + ctrl->result = snd_pcm_prepare(pcm); + break; + case SNDRV_PCM_IOCTL_RESET: + ctrl->result = snd_pcm_reset(pcm); + break; + case SNDRV_PCM_IOCTL_START: + ctrl->result = snd_pcm_start(pcm); + break; + case SNDRV_PCM_IOCTL_DRAIN: + ctrl->result = snd_pcm_drain(pcm); + break; + case SNDRV_PCM_IOCTL_DROP: + ctrl->result = snd_pcm_drop(pcm); + break; + case SNDRV_PCM_IOCTL_PAUSE: + ctrl->result = snd_pcm_pause(pcm, ctrl->u.pause.enable); + break; + case SNDRV_PCM_IOCTL_CHANNEL_INFO: + ctrl->result = snd_pcm_channel_info(pcm, (snd_pcm_channel_info_t *) &ctrl->u.channel_info); + if (ctrl->result >= 0 && + ctrl->u.channel_info.type == SND_PCM_AREA_MMAP) + return shm_ack_fd(client, ctrl->u.channel_info.u.mmap.fd); + break; + case SNDRV_PCM_IOCTL_REWIND: + ctrl->result = snd_pcm_rewind(pcm, ctrl->u.rewind.frames); + break; + case SND_PCM_IOCTL_FORWARD: + ctrl->result = snd_pcm_forward(pcm, ctrl->u.forward.frames); + break; + case SNDRV_PCM_IOCTL_LINK: + { + /* FIXME */ + ctrl->result = -ENOSYS; + break; + } + case SNDRV_PCM_IOCTL_UNLINK: + ctrl->result = snd_pcm_unlink(pcm); + break; + case SNDRV_PCM_IOCTL_RESUME: + ctrl->result = snd_pcm_resume(pcm); + break; + case SND_PCM_IOCTL_MMAP: + { + ctrl->result = snd_pcm_mmap(pcm); + } + case SND_PCM_IOCTL_MUNMAP: + { + ctrl->result = snd_pcm_munmap(pcm); + break; + } + case SND_PCM_IOCTL_MMAP_COMMIT: + ctrl->result = snd_pcm_mmap_commit(pcm, + ctrl->u.mmap_commit.offset, + ctrl->u.mmap_commit.frames); + break; + case SND_PCM_IOCTL_POLL_DESCRIPTOR: + ctrl->result = 0; + return shm_ack_fd(client, _snd_pcm_poll_descriptor(pcm)); + case SND_PCM_IOCTL_CLOSE: + client->ops->close(client); + break; + case SND_PCM_IOCTL_HW_PTR_FD: + return shm_rbptr_fd(client, &pcm->hw); + case SND_PCM_IOCTL_APPL_PTR_FD: + return shm_rbptr_fd(client, &pcm->appl); + default: + ERROR("Bogus cmd: %x", ctrl->cmd); + ctrl->result = -ENOSYS; + } + return shm_ack(client); +} + +transport_ops_t pcm_shm_ops = { + .open = pcm_shm_open, + .cmd = pcm_shm_cmd, + .close = pcm_shm_close, +}; + +static int ctl_handler(waiter_t *waiter, unsigned short events) +{ + client_t *client = waiter->private_data; + char buf[1]; + ssize_t n; + if (events & POLLIN) { + n = write(client->poll_fd, buf, 1); + if (n != 1) { + SYSERROR("write failed"); + return -errno; + } + } + del_waiter(waiter->fd); + client->polling = 0; + return 0; +} + +static int ctl_shm_open(client_t *client, int *cookie) +{ + int shmid; + snd_ctl_t *ctl; + int err; + int result; + err = snd_ctl_open(&ctl, client->name, SND_CTL_NONBLOCK); + if (err < 0) + return err; + client->device.ctl.handle = ctl; + client->device.ctl.fd = _snd_ctl_poll_descriptor(ctl); + + shmid = shmget(IPC_PRIVATE, CTL_SHM_SIZE, 0666); + if (shmid < 0) { + result = -errno; + SYSERROR("shmget failed"); + goto _err; + } + client->transport.shm.ctrl_id = shmid; + client->transport.shm.ctrl = shmat(shmid, 0, 0); + if (!client->transport.shm.ctrl) { + result = -errno; + shmctl(shmid, IPC_RMID, 0); + SYSERROR("shmat failed"); + goto _err; + } + *cookie = shmid; + add_waiter(client->device.ctl.fd, POLLIN, ctl_handler, client); + client->polling = 1; + return 0; + + _err: + snd_ctl_close(ctl); + return result; + +} + +static int ctl_shm_close(client_t *client) +{ + int err; + snd_ctl_shm_ctrl_t *ctrl = client->transport.shm.ctrl; + if (client->polling) { + del_waiter(client->device.ctl.fd); + client->polling = 0; + } + err = snd_ctl_close(client->device.ctl.handle); + ctrl->result = err; + if (err < 0) + ERROR("snd_ctl_close"); + if (client->transport.shm.ctrl) { + err = shmdt((void *)client->transport.shm.ctrl); + if (err < 0) + SYSERROR("shmdt failed"); + err = shmctl(client->transport.shm.ctrl_id, IPC_RMID, 0); + if (err < 0) + SYSERROR("shmctl failed"); + client->transport.shm.ctrl = 0; + } + client->open = 0; + return 0; +} + +static int ctl_shm_cmd(client_t *client) +{ + snd_ctl_shm_ctrl_t *ctrl = client->transport.shm.ctrl; + char buf[1]; + int err; + int cmd; + snd_ctl_t *ctl; + err = read(client->ctrl_fd, buf, 1); + if (err != 1) + return -EBADFD; + cmd = ctrl->cmd; + ctrl->cmd = 0; + ctl = client->device.ctl.handle; + switch (cmd) { + case SND_CTL_IOCTL_ASYNC: + ctrl->result = snd_ctl_async(ctl, ctrl->u.async.sig, ctrl->u.async.pid); + if (ctrl->result < 0) + break; + if (ctrl->u.async.sig >= 0) { + assert(client->async_sig < 0); + ctrl->result = snd_async_add_ctl_handler(&client->async_handler, ctl, async_handler, client); + if (ctrl->result < 0) + break; + } else { + assert(client->async_sig >= 0); + snd_async_del_handler(client->async_handler); + } + client->async_sig = ctrl->u.async.sig; + client->async_pid = ctrl->u.async.pid; + break; + break; + case SNDRV_CTL_IOCTL_SUBSCRIBE_EVENTS: + ctrl->result = snd_ctl_subscribe_events(ctl, ctrl->u.subscribe_events); + break; + case SNDRV_CTL_IOCTL_CARD_INFO: + ctrl->result = snd_ctl_card_info(ctl, &ctrl->u.card_info); + break; + case SNDRV_CTL_IOCTL_ELEM_LIST: + { + size_t maxsize = CTL_SHM_DATA_MAXLEN; + if (ctrl->u.element_list.space * sizeof(*ctrl->u.element_list.pids) > maxsize) { + ctrl->result = -EFAULT; + break; + } + ctrl->u.element_list.pids = (snd_ctl_elem_id_t*) ctrl->data; + ctrl->result = snd_ctl_elem_list(ctl, &ctrl->u.element_list); + break; + } + case SNDRV_CTL_IOCTL_ELEM_INFO: + ctrl->result = snd_ctl_elem_info(ctl, &ctrl->u.element_info); + break; + case SNDRV_CTL_IOCTL_ELEM_READ: + ctrl->result = snd_ctl_elem_read(ctl, &ctrl->u.element_read); + break; + case SNDRV_CTL_IOCTL_ELEM_WRITE: + ctrl->result = snd_ctl_elem_write(ctl, &ctrl->u.element_write); + break; + case SNDRV_CTL_IOCTL_ELEM_LOCK: + ctrl->result = snd_ctl_elem_lock(ctl, &ctrl->u.element_lock); + break; + case SNDRV_CTL_IOCTL_ELEM_UNLOCK: + ctrl->result = snd_ctl_elem_unlock(ctl, &ctrl->u.element_unlock); + break; + case SNDRV_CTL_IOCTL_HWDEP_NEXT_DEVICE: + ctrl->result = snd_ctl_hwdep_next_device(ctl, &ctrl->u.device); + break; + case SNDRV_CTL_IOCTL_HWDEP_INFO: + ctrl->result = snd_ctl_hwdep_info(ctl, &ctrl->u.hwdep_info); + break; + case SNDRV_CTL_IOCTL_PCM_NEXT_DEVICE: + ctrl->result = snd_ctl_pcm_next_device(ctl, &ctrl->u.device); + break; + case SNDRV_CTL_IOCTL_PCM_INFO: + ctrl->result = snd_ctl_pcm_info(ctl, &ctrl->u.pcm_info); + break; + case SNDRV_CTL_IOCTL_PCM_PREFER_SUBDEVICE: + ctrl->result = snd_ctl_pcm_prefer_subdevice(ctl, ctrl->u.pcm_prefer_subdevice); + break; + case SNDRV_CTL_IOCTL_RAWMIDI_NEXT_DEVICE: + ctrl->result = snd_ctl_rawmidi_next_device(ctl, &ctrl->u.device); + break; + case SNDRV_CTL_IOCTL_RAWMIDI_INFO: + ctrl->result = snd_ctl_rawmidi_info(ctl, &ctrl->u.rawmidi_info); + break; + case SNDRV_CTL_IOCTL_RAWMIDI_PREFER_SUBDEVICE: + ctrl->result = snd_ctl_rawmidi_prefer_subdevice(ctl, ctrl->u.rawmidi_prefer_subdevice); + break; + case SNDRV_CTL_IOCTL_POWER: + ctrl->result = snd_ctl_set_power_state(ctl, ctrl->u.power_state); + break; + case SNDRV_CTL_IOCTL_POWER_STATE: + ctrl->result = snd_ctl_get_power_state(ctl, &ctrl->u.power_state); + break; + case SND_CTL_IOCTL_READ: + ctrl->result = snd_ctl_read(ctl, &ctrl->u.read); + break; + case SND_CTL_IOCTL_CLOSE: + client->ops->close(client); + break; + case SND_CTL_IOCTL_POLL_DESCRIPTOR: + ctrl->result = 0; + return shm_ack_fd(client, _snd_ctl_poll_descriptor(ctl)); + default: + ERROR("Bogus cmd: %x", ctrl->cmd); + ctrl->result = -ENOSYS; + } + return shm_ack(client); +} + +transport_ops_t ctl_shm_ops = { + .open = ctl_shm_open, + .cmd = ctl_shm_cmd, + .close = ctl_shm_close, +}; + +static int snd_client_open(client_t *client) +{ + int err; + snd_client_open_request_t req; + snd_client_open_answer_t ans; + char *name; + memset(&ans, 0, sizeof(ans)); + err = read(client->ctrl_fd, &req, sizeof(req)); + if (err < 0) { + SYSERROR("read failed"); + exit(1); + } + if (err != sizeof(req)) { + ans.result = -EINVAL; + goto _answer; + } + name = alloca(req.namelen); + err = read(client->ctrl_fd, name, req.namelen); + if (err < 0) { + SYSERROR("read failed"); + exit(1); + } + if (err != req.namelen) { + ans.result = -EINVAL; + goto _answer; + } + + switch (req.transport_type) { + case SND_TRANSPORT_TYPE_SHM: + if (!client->local) { + ans.result = -EINVAL; + goto _answer; + } + switch (req.dev_type) { + case SND_DEV_TYPE_PCM: + client->ops = &pcm_shm_ops; + break; + case SND_DEV_TYPE_CONTROL: + client->ops = &ctl_shm_ops; + break; + default: + ans.result = -EINVAL; + goto _answer; + } + break; + default: + ans.result = -EINVAL; + goto _answer; + } + + name[req.namelen] = '\0'; + + client->transport_type = req.transport_type; + strcpy(client->name, name); + client->stream = req.stream; + client->mode = req.mode; + + err = client->ops->open(client, &ans.cookie); + if (err < 0) { + ans.result = err; + } else { + client->open = 1; + ans.result = 0; + } + + _answer: + err = write(client->ctrl_fd, &ans, sizeof(ans)); + if (err != sizeof(ans)) { + SYSERROR("write failed"); + exit(1); + } + return 0; +} + +static int client_poll_handler(waiter_t *waiter, unsigned short events ATTRIBUTE_UNUSED) +{ + client_t *client = waiter->private_data; + if (client->open) + client->ops->close(client); + close(client->poll_fd); + close(client->ctrl_fd); + del_waiter(client->poll_fd); + del_waiter(client->ctrl_fd); + list_del(&client->list); + free(client); + return 0; +} + +static int client_ctrl_handler(waiter_t *waiter, unsigned short events) +{ + client_t *client = waiter->private_data; + if (events & POLLHUP) { + if (client->open) + client->ops->close(client); + close(client->ctrl_fd); + del_waiter(client->ctrl_fd); + list_del(&client->list); + free(client); + return 0; + } + if (client->open) + return client->ops->cmd(client); + else + return snd_client_open(client); +} + +static int inet_pending_handler(waiter_t *waiter, unsigned short events) +{ + inet_pending_t *pending = waiter->private_data; + inet_pending_t *pdata; + client_t *client; + uint32_t cookie; + struct list_head *item; + int remove = 0; + if (events & POLLHUP) + remove = 1; + else { + int err = read(waiter->fd, &cookie, sizeof(cookie)); + if (err != sizeof(cookie)) + remove = 1; + else { + err = write(waiter->fd, &cookie, sizeof(cookie)); + if (err != sizeof(cookie)) + remove = 1; + } + } + del_waiter(waiter->fd); + if (remove) { + close(waiter->fd); + list_del(&pending->list); + free(pending); + return 0; + } + + list_for_each(item, &inet_pendings) { + pdata = list_entry(item, inet_pending_t, list); + if (pdata->cookie == cookie) + goto found; + } + pending->cookie = cookie; + return 0; + + found: + client = calloc(1, sizeof(*client)); + client->local = 0; + client->poll_fd = pdata->fd; + client->ctrl_fd = waiter->fd; + add_waiter(client->ctrl_fd, POLLIN | POLLHUP, client_ctrl_handler, client); + add_waiter(client->poll_fd, POLLHUP, client_poll_handler, client); + client->open = 0; + list_add_tail(&client->list, &clients); + list_del(&pending->list); + list_del(&pdata->list); + free(pending); + free(pdata); + return 0; +} + +static int local_handler(waiter_t *waiter, unsigned short events ATTRIBUTE_UNUSED) +{ + int sock; + sock = accept(waiter->fd, 0, 0); + if (sock < 0) { + int result = -errno; + SYSERROR("accept failed"); + return result; + } else { + client_t *client = calloc(1, sizeof(*client)); + client->ctrl_fd = sock; + client->local = 1; + client->open = 0; + add_waiter(sock, POLLIN | POLLHUP, client_ctrl_handler, client); + list_add_tail(&client->list, &clients); + } + return 0; +} + +static int inet_handler(waiter_t *waiter, unsigned short events ATTRIBUTE_UNUSED) +{ + int sock; + sock = accept(waiter->fd, 0, 0); + if (sock < 0) { + int result = -errno; + SYSERROR("accept failed"); + return result; + } else { + inet_pending_t *pending = calloc(1, sizeof(*pending)); + pending->fd = sock; + pending->cookie = 0; + add_waiter(sock, POLLIN, inet_pending_handler, pending); + list_add_tail(&pending->list, &inet_pendings); + } + return 0; +} + +static int server(const char *sockname, int port) +{ + int err; + unsigned int k; + long open_max; + int result; + + if (!sockname && port < 0) + return -EINVAL; + open_max = sysconf(_SC_OPEN_MAX); + if (open_max < 0) { + result = -errno; + SYSERROR("sysconf failed"); + return result; + } + pollfds = calloc((size_t) open_max, sizeof(*pollfds)); + waiters = calloc((size_t) open_max, sizeof(*waiters)); + + if (sockname) { + int sock = make_local_socket(sockname); + if (sock < 0) + return sock; + if (fcntl(sock, F_SETFL, O_NONBLOCK) < 0) { + result = -errno; + SYSERROR("fcntl O_NONBLOCK failed"); + goto _end; + } + if (listen(sock, 4) < 0) { + result = -errno; + SYSERROR("listen failed"); + goto _end; + } + add_waiter(sock, POLLIN, local_handler, NULL); + } + if (port >= 0) { + int sock = make_inet_socket(port); + if (sock < 0) + return sock; + if (fcntl(sock, F_SETFL, O_NONBLOCK) < 0) { + result = -errno; + SYSERROR("fcntl failed"); + goto _end; + } + if (listen(sock, 4) < 0) { + result = -errno; + SYSERROR("listen failed"); + goto _end; + } + add_waiter(sock, POLLIN, inet_handler, NULL); + } + + while (1) { + struct pollfd pfds[open_max]; + size_t pfds_count; + do { + err = poll(pollfds, pollfds_count, -1); + } while (err == 0); + if (err < 0) { + SYSERROR("poll failed"); + continue; + } + + pfds_count = pollfds_count; + memcpy(pfds, pollfds, sizeof(*pfds) * pfds_count); + for (k = 0; k < pfds_count; k++) { + struct pollfd *pfd = &pfds[k]; + if (pfd->revents) { + waiter_t *w = &waiters[pfd->fd]; + if (!w->handler) + continue; + err = w->handler(w, pfd->revents); + if (err < 0) + ERROR("waiter handler failed"); + } + } + } + _end: + free(pollfds); + free(waiters); + return result; +} + + +static void usage(void) +{ + fprintf(stderr, + "Usage: %s [OPTIONS] server\n" + "--help help\n", + command); +} + +int main(int argc, char **argv) +{ + static const struct option long_options[] = { + {"help", 0, 0, 'h'}, + { 0 , 0 , 0, 0 } + }; + int c; + snd_config_t *conf; + snd_config_iterator_t i, next; + const char *sockname = NULL; + const char *host = NULL; + long port = -1; + int err; + char *srvname; + struct hostent *h; + command = argv[0]; + while ((c = getopt_long(argc, argv, "h", long_options, 0)) != -1) { + switch (c) { + case 'h': + usage(); + return 0; + default: + fprintf(stderr, "Try `%s --help' for more information\n", command); + return 1; + } + } + if (argc - optind != 1) { + ERROR("you need to specify server name"); + return 1; + } + err = snd_config_update(); + if (err < 0) { + ERROR("cannot read configuration file"); + return 1; + } + srvname = argv[optind]; + err = snd_config_search_definition(snd_config, "server", srvname, &conf); + if (err < 0) { + ERROR("Missing definition for server %s", srvname); + return 1; + } + if (snd_config_get_type(conf) != SND_CONFIG_TYPE_COMPOUND) { + SNDERR("Invalid type for server %s definition", srvname); + return -EINVAL; + } + snd_config_for_each(i, next, conf) { + snd_config_t *n = snd_config_iterator_entry(i); + const char *id; + if (snd_config_get_id(n, &id) < 0) + continue; + if (strcmp(id, "comment") == 0) + continue; + if (strcmp(id, "host") == 0) { + err = snd_config_get_string(n, &host); + if (err < 0) { + ERROR("Invalid type for %s", id); + return 1; + } + continue; + } + if (strcmp(id, "socket") == 0) { + err = snd_config_get_string(n, &sockname); + if (err < 0) { + ERROR("Invalid type for %s", id); + return 1; + } + continue; + } + if (strcmp(id, "port") == 0) { + err = snd_config_get_integer(n, &port); + if (err < 0) { + ERROR("Invalid type for %s", id); + return 1; + } + continue; + } + ERROR("Unknown field %s", id); + return 1; + } + if (!host) { + ERROR("host is not defined"); + return 1; + } + h = gethostbyname(host); + if (!h) { + ERROR("Cannot resolve %s", host); + return 1; + } + if (!snd_is_local(h)) { + ERROR("%s is not the local host", host); + return 1; + } + if (!sockname && port < 0) { + ERROR("either socket or port need to be defined"); + return 1; + } + server(sockname, port); + return 0; +} |