cannam@125: /* cannam@125: ** Copyright (C) 2001-2014 Erik de Castro Lopo cannam@125: ** cannam@125: ** All rights reserved. cannam@125: ** cannam@125: ** Redistribution and use in source and binary forms, with or without cannam@125: ** modification, are permitted provided that the following conditions are cannam@125: ** met: cannam@125: ** cannam@125: ** * Redistributions of source code must retain the above copyright cannam@125: ** notice, this list of conditions and the following disclaimer. cannam@125: ** * Redistributions in binary form must reproduce the above copyright cannam@125: ** notice, this list of conditions and the following disclaimer in cannam@125: ** the documentation and/or other materials provided with the cannam@125: ** distribution. cannam@125: ** * Neither the author nor the names of any contributors may be used cannam@125: ** to endorse or promote products derived from this software without cannam@125: ** specific prior written permission. cannam@125: ** cannam@125: ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS cannam@125: ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED cannam@125: ** TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR cannam@125: ** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR cannam@125: ** CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, cannam@125: ** EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, cannam@125: ** PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; cannam@125: ** OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, cannam@125: ** WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR cannam@125: ** OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF cannam@125: ** ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. cannam@125: */ cannam@125: cannam@125: #include cannam@125: #include cannam@125: #include cannam@125: #include cannam@125: cannam@125: #include cannam@125: cannam@125: int cannam@125: main (void) cannam@125: { SF_FORMAT_INFO info ; cannam@125: SF_INFO sfinfo ; cannam@125: int format, major_count, subtype_count, m, s ; cannam@125: cannam@125: memset (&sfinfo, 0, sizeof (sfinfo)) ; cannam@125: printf ("Version : %s\n\n", sf_version_string ()) ; cannam@125: cannam@125: sf_command (NULL, SFC_GET_FORMAT_MAJOR_COUNT, &major_count, sizeof (int)) ; cannam@125: sf_command (NULL, SFC_GET_FORMAT_SUBTYPE_COUNT, &subtype_count, sizeof (int)) ; cannam@125: cannam@125: sfinfo.channels = 1 ; cannam@125: for (m = 0 ; m < major_count ; m++) cannam@125: { info.format = m ; cannam@125: sf_command (NULL, SFC_GET_FORMAT_MAJOR, &info, sizeof (info)) ; cannam@125: printf ("%s (extension \"%s\")\n", info.name, info.extension) ; cannam@125: cannam@125: format = info.format ; cannam@125: cannam@125: for (s = 0 ; s < subtype_count ; s++) cannam@125: { info.format = s ; cannam@125: sf_command (NULL, SFC_GET_FORMAT_SUBTYPE, &info, sizeof (info)) ; cannam@125: cannam@125: format = (format & SF_FORMAT_TYPEMASK) | info.format ; cannam@125: cannam@125: sfinfo.format = format ; cannam@125: if (sf_format_check (&sfinfo)) cannam@125: printf (" %s\n", info.name) ; cannam@125: } ; cannam@125: puts ("") ; cannam@125: } ; cannam@125: puts ("") ; cannam@125: cannam@125: return 0 ; cannam@125: } /* main */ cannam@125: