| 1 | /* |
| 2 | * Copyright (c) 2017, 2020 Moritz Grimm <[email protected]> |
| 3 | * |
| 4 | * Permission to use, copy, modify, and distribute this software for any |
| 5 | * purpose with or without fee is hereby granted, provided that the above |
| 6 | * copyright notice and this permission notice appear in all copies. |
| 7 | * |
| 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
| 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
| 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
| 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
| 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
| 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 15 | */ |
| 16 | |
| 17 | #ifndef __CFG_STREAM_H__ |
| 18 | #define __CFG_STREAM_H__ |
| 19 | |
| 20 | #define CFG_SFMT_OGG "Ogg" |
| 21 | #define CFG_SFMT_MP3 "MP3" |
| 22 | #define CFG_SFMT_WEBM "WebM" |
| 23 | #define CFG_SFMT_MATROSKA "Matroska" |
| 24 | |
| 25 | enum cfg_stream_format { |
| 26 | CFG_STREAM_INVALID = 0, |
| 27 | CFG_STREAM_OGG, |
| 28 | CFG_STREAM_MP3, |
| 29 | CFG_STREAM_WEBM, |
| 30 | CFG_STREAM_MATROSKA, |
| 31 | CFG_STREAM_MIN = CFG_STREAM_OGG, |
| 32 | CFG_STREAM_MAX = CFG_STREAM_MATROSKA, |
| 33 | }; |
| 34 | |
| 35 | typedef struct cfg_stream * cfg_stream_t; |
| 36 | typedef struct cfg_stream_list * cfg_stream_list_t; |
| 37 | |
| 38 | cfg_stream_list_t |
| 39 | cfg_stream_list_create(void); |
| 40 | void cfg_stream_list_destroy(cfg_stream_list_t *); |
| 41 | unsigned int |
| 42 | cfg_stream_list_nentries(cfg_stream_list_t); |
| 43 | |
| 44 | cfg_stream_t |
| 45 | cfg_stream_list_find(cfg_stream_list_t, const char *); |
| 46 | cfg_stream_t |
| 47 | cfg_stream_list_get(cfg_stream_list_t, const char *); |
| 48 | void cfg_stream_list_foreach(cfg_stream_list_t, void (*)(cfg_stream_t, |
| 49 | void *), void *); |
| 50 | |
| 51 | cfg_stream_t |
| 52 | cfg_stream_create(const char *); |
| 53 | void cfg_stream_destroy(cfg_stream_t *); |
| 54 | |
| 55 | int cfg_stream_str2fmt(const char *, enum cfg_stream_format *); |
| 56 | const char * |
| 57 | cfg_stream_fmt2str(enum cfg_stream_format); |
| 58 | |
| 59 | int cfg_stream_set_name(cfg_stream_t, cfg_stream_list_t, const char *, |
| 60 | const char **); |
| 61 | int cfg_stream_set_mountpoint(cfg_stream_t, cfg_stream_list_t, |
| 62 | const char *, const char **); |
| 63 | int cfg_stream_set_intake(cfg_stream_t, cfg_stream_list_t, const char *, |
| 64 | const char **); |
| 65 | int cfg_stream_set_server(cfg_stream_t, cfg_stream_list_t, const char *, |
| 66 | const char **); |
| 67 | int cfg_stream_set_public(cfg_stream_t, cfg_stream_list_t, const char *, |
| 68 | const char **); |
| 69 | int cfg_stream_set_format(cfg_stream_t, cfg_stream_list_t, const char *, |
| 70 | const char **); |
| 71 | int cfg_stream_set_encoder(cfg_stream_t, cfg_stream_list_t, const char *, |
| 72 | const char **); |
| 73 | int cfg_stream_set_stream_name(cfg_stream_t, cfg_stream_list_t, |
| 74 | const char *, const char **); |
| 75 | int cfg_stream_set_stream_url(cfg_stream_t, cfg_stream_list_t, |
| 76 | const char *, const char **); |
| 77 | int cfg_stream_set_stream_genre(cfg_stream_t, cfg_stream_list_t, |
| 78 | const char *, const char **); |
| 79 | int cfg_stream_set_stream_description(cfg_stream_t, cfg_stream_list_t, |
| 80 | const char *, const char **); |
| 81 | int cfg_stream_set_stream_quality(cfg_stream_t, cfg_stream_list_t, |
| 82 | const char *, const char **); |
| 83 | int cfg_stream_set_stream_bitrate(cfg_stream_t, cfg_stream_list_t, |
| 84 | const char *, const char **); |
| 85 | int cfg_stream_set_stream_samplerate(cfg_stream_t, cfg_stream_list_t, |
| 86 | const char *, const char **); |
| 87 | int cfg_stream_set_stream_channels(cfg_stream_t, cfg_stream_list_t, |
| 88 | const char *, const char **); |
| 89 | |
| 90 | int cfg_stream_validate(cfg_stream_t, const char **); |
| 91 | |
| 92 | const char * |
| 93 | cfg_stream_get_name(cfg_stream_t); |
| 94 | const char * |
| 95 | cfg_stream_get_mountpoint(cfg_stream_t); |
| 96 | const char * |
| 97 | cfg_stream_get_intake(cfg_stream_t); |
| 98 | const char * |
| 99 | cfg_stream_get_server(cfg_stream_t); |
| 100 | int cfg_stream_get_public(cfg_stream_t); |
| 101 | enum cfg_stream_format |
| 102 | cfg_stream_get_format(cfg_stream_t); |
| 103 | const char * |
| 104 | cfg_stream_get_format_str(cfg_stream_t); |
| 105 | const char * |
| 106 | cfg_stream_get_encoder(cfg_stream_t); |
| 107 | const char * |
| 108 | cfg_stream_get_stream_name(cfg_stream_t); |
| 109 | const char * |
| 110 | cfg_stream_get_stream_url(cfg_stream_t); |
| 111 | const char * |
| 112 | cfg_stream_get_stream_genre(cfg_stream_t); |
| 113 | const char * |
| 114 | cfg_stream_get_stream_description(cfg_stream_t); |
| 115 | const char * |
| 116 | cfg_stream_get_stream_quality(cfg_stream_t); |
| 117 | const char * |
| 118 | cfg_stream_get_stream_bitrate(cfg_stream_t); |
| 119 | const char * |
| 120 | cfg_stream_get_stream_samplerate(cfg_stream_t); |
| 121 | const char * |
| 122 | cfg_stream_get_stream_channels(cfg_stream_t); |
| 123 | |
| 124 | #endif /* __CFG_STREAM_H__ */ |