1 /***************************************************************************
2       WavFileFormat.cpp  -  wav file formats
3 			     -------------------
4     begin                : Oct 02 2012
5     copyright            : (C) 2012 by Thomas Eschenbacher
6     email                : Thomas Eschenbacher <thomas.eschenbacher@gmx.de>
7  ***************************************************************************/
8 
9 /***************************************************************************
10  *                                                                         *
11  *   This program is free software; you can redistribute it and/or modify  *
12  *   it under the terms of the GNU General Public License as published by  *
13  *   the Free Software Foundation; either version 2 of the License, or     *
14  *   (at your option) any later version.                                   *
15  *                                                                         *
16  ***************************************************************************/
17 
18 #include "config.h"
19 
20 #include <audiofile.h>
21 #include <stdlib.h>
22 
23 #include "WavFileFormat.h"
24 
25 //***************************************************************************
audiofileCompressionTypes()26 QList<Kwave::Compression::Type> Kwave::audiofileCompressionTypes()
27 {
28     QList<Kwave::Compression::Type> list;
29 
30     const long int numCompressionTypes = afQueryLong(
31 	AF_QUERYTYPE_COMPRESSION, AF_QUERY_ID_COUNT, 0, 0, 0);
32 
33     if (numCompressionTypes != 0) {
34 	int *compressions = static_cast<int *>(afQueryPointer(
35 	    AF_QUERYTYPE_COMPRESSION, AF_QUERY_IDS, 0, 0, 0));
36 
37 	if (compressions) {
38 	    for (long int index = 0; index < numCompressionTypes; index++) {
39 		Kwave::Compression::Type compression_type =
40 		    Kwave::Compression::fromAudiofile(compressions[index]);
41 		if (!list.contains(compression_type))
42 		    list.append(compression_type);
43 	    }
44 	    free(compressions);
45 	}
46     }
47 
48     return list;
49 }
50 
51 //***************************************************************************
52 //***************************************************************************
53