1 /*-*- Mode: C; c-basic-offset: 8 -*-*/ 2 3 #ifndef foocanberrareadsoundfilehfoo 4 #define foocanberrareadsoundfilehfoo 5 6 /*** 7 This file is part of libcanberra. 8 9 Copyright 2008 Lennart Poettering 10 11 libcanberra is free software; you can redistribute it and/or modify 12 it under the terms of the GNU Lesser General Public License as 13 published by the Free Software Foundation, either version 2.1 of the 14 License, or (at your option) any later version. 15 16 libcanberra is distributed in the hope that it will be useful, but 17 WITHOUT ANY WARRANTY; without even the implied warranty of 18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 Lesser General Public License for more details. 20 21 You should have received a copy of the GNU Lesser General Public 22 License along with libcanberra. If not, see 23 <http://www.gnu.org/licenses/>. 24 ***/ 25 26 #include <sys/types.h> 27 #include <inttypes.h> 28 29 typedef enum ca_sample_type { 30 CA_SAMPLE_S16NE, 31 CA_SAMPLE_S16RE, 32 CA_SAMPLE_U8 33 } ca_sample_type_t; 34 35 typedef enum ca_channel_position { 36 CA_CHANNEL_MONO, 37 CA_CHANNEL_FRONT_LEFT, 38 CA_CHANNEL_FRONT_RIGHT, 39 CA_CHANNEL_FRONT_CENTER, 40 CA_CHANNEL_REAR_LEFT, 41 CA_CHANNEL_REAR_RIGHT, 42 CA_CHANNEL_REAR_CENTER, 43 CA_CHANNEL_LFE, 44 CA_CHANNEL_FRONT_LEFT_OF_CENTER, 45 CA_CHANNEL_FRONT_RIGHT_OF_CENTER, 46 CA_CHANNEL_SIDE_LEFT, 47 CA_CHANNEL_SIDE_RIGHT, 48 CA_CHANNEL_TOP_CENTER, 49 CA_CHANNEL_TOP_FRONT_LEFT, 50 CA_CHANNEL_TOP_FRONT_RIGHT, 51 CA_CHANNEL_TOP_FRONT_CENTER, 52 CA_CHANNEL_TOP_REAR_LEFT, 53 CA_CHANNEL_TOP_REAR_RIGHT, 54 CA_CHANNEL_TOP_REAR_CENTER, 55 _CA_CHANNEL_POSITION_MAX 56 } ca_channel_position_t; 57 58 typedef struct ca_sound_file ca_sound_file; 59 60 int ca_sound_file_open(ca_sound_file **f, const char *fn); 61 void ca_sound_file_close(ca_sound_file *f); 62 63 unsigned ca_sound_file_get_nchannels(ca_sound_file *f); 64 unsigned ca_sound_file_get_rate(ca_sound_file *f); 65 ca_sample_type_t ca_sound_file_get_sample_type(ca_sound_file *f); 66 const ca_channel_position_t* ca_sound_file_get_channel_map(ca_sound_file *f); 67 68 off_t ca_sound_file_get_size(ca_sound_file *f); 69 70 int ca_sound_file_read_int16(ca_sound_file *f, int16_t *d, size_t *n); 71 int ca_sound_file_read_uint8(ca_sound_file *f, uint8_t *d, size_t *n); 72 73 int ca_sound_file_read_arbitrary(ca_sound_file *f, void *d, size_t *n); 74 75 size_t ca_sound_file_frame_size(ca_sound_file *f); 76 77 #endif 78