Sylvain Munaut | 0f7e52d | 2010-10-29 11:38:54 +0200 | [diff] [blame] | 1 | /* Formats handling */ |
| 2 | |
| 3 | /* |
| 4 | * This file is part of gapk (GSM Audio Pocket Knife). |
| 5 | * |
| 6 | * gapk is free software: you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation, either version 3 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | * |
| 11 | * gapk is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with gapk. If not, see <http://www.gnu.org/licenses/>. |
| 18 | */ |
| 19 | |
| 20 | #include <stdio.h> /* for NULL */ |
| 21 | |
| 22 | #include <gapk/formats.h> |
| 23 | |
| 24 | /* Extern format descriptors */ |
Sylvain Munaut | 5e380d0 | 2010-10-29 11:41:16 +0200 | [diff] [blame] | 25 | extern const struct format_desc fmt_gsm; |
Sylvain Munaut | f905983 | 2010-10-29 11:44:40 +0200 | [diff] [blame] | 26 | extern const struct format_desc fmt_hr_ref_dec; |
| 27 | extern const struct format_desc fmt_hr_ref_enc; |
Sylvain Munaut | 6c96cc2 | 2010-10-29 11:46:05 +0200 | [diff] [blame^] | 28 | extern const struct format_desc fmt_racal_hr; |
| 29 | extern const struct format_desc fmt_racal_fr; |
| 30 | extern const struct format_desc fmt_racal_efr; |
Sylvain Munaut | 5e380d0 | 2010-10-29 11:41:16 +0200 | [diff] [blame] | 31 | |
Sylvain Munaut | 0f7e52d | 2010-10-29 11:38:54 +0200 | [diff] [blame] | 32 | static const struct format_desc *supported_formats[_FMT_MAX] = { |
| 33 | [FMT_INVALID] = NULL, |
Sylvain Munaut | 5e380d0 | 2010-10-29 11:41:16 +0200 | [diff] [blame] | 34 | [FMT_GSM] = &fmt_gsm, |
Sylvain Munaut | f905983 | 2010-10-29 11:44:40 +0200 | [diff] [blame] | 35 | [FMT_HR_REF_DEC] = &fmt_hr_ref_dec, |
| 36 | [FMT_HR_REF_ENC] = &fmt_hr_ref_enc, |
Sylvain Munaut | 6c96cc2 | 2010-10-29 11:46:05 +0200 | [diff] [blame^] | 37 | [FMT_RACAL_HR] = &fmt_racal_hr, |
| 38 | [FMT_RACAL_FR] = &fmt_racal_fr, |
| 39 | [FMT_RACAL_EFR] = &fmt_racal_efr, |
Sylvain Munaut | 0f7e52d | 2010-10-29 11:38:54 +0200 | [diff] [blame] | 40 | }; |
| 41 | |
| 42 | |
| 43 | const struct format_desc * |
| 44 | fmt_get_from_type(enum format_type type) |
| 45 | { |
| 46 | if (type <= FMT_INVALID || type >= _FMT_MAX) |
| 47 | return NULL; |
| 48 | return supported_formats[type]; |
| 49 | } |