|
| 1 | +/* |
| 2 | + * Espressif Modified MIT License |
| 3 | + * |
| 4 | + * Copyright (c) 2025 Espressif Systems (Shanghai) Co., LTD |
| 5 | + * |
| 6 | + * Permission is hereby granted for use **exclusively** with Espressif Systems products. |
| 7 | + * This includes the right to use, copy, modify, merge, publish, distribute, and sublicense |
| 8 | + * the Software, subject to the following conditions: |
| 9 | + * |
| 10 | + * 1. This Software **must be used in conjunction with Espressif Systems products**. |
| 11 | + * 2. The above copyright notice and this permission notice shall be included in all copies |
| 12 | + * or substantial portions of the Software. |
| 13 | + * 3. Redistribution of the Software in source or binary form **for use with non-Espressif products** |
| 14 | + * is strictly prohibited. |
| 15 | + * |
| 16 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, |
| 17 | + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR |
| 18 | + * PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE |
| 19 | + * FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR |
| 20 | + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
| 21 | + * DEALINGS IN THE SOFTWARE. |
| 22 | + * |
| 23 | + * SPDX-License-Identifier: LicenseRef-Espressif-Modified-MIT |
| 24 | + */ |
| 25 | + |
| 26 | +#pragma once |
| 27 | + |
| 28 | +#ifdef __cplusplus |
| 29 | +extern "C" { |
| 30 | +#endif /* __cplusplus */ |
| 31 | + |
| 32 | + |
| 33 | +// Convert string to character code |
| 34 | +static inline uint64_t gmf_str_to_cc(const char *str, int max_len) |
| 35 | +{ |
| 36 | + uint64_t result = 0; |
| 37 | + if (str && strlen(str) <= max_len) { |
| 38 | + memcpy(&result, str, strlen(str)); |
| 39 | + } |
| 40 | + return result; |
| 41 | +} |
| 42 | + |
| 43 | +// Convert 64-bit EIGHTCC to string |
| 44 | +static inline void gmf_eightcc_to_str(uint64_t eightcc, char out[9]) |
| 45 | +{ |
| 46 | + for (int i = 0; i < 8; i++) { |
| 47 | + out[i] = (char)((eightcc >> (i * 8)) & 0xFF); |
| 48 | + } |
| 49 | + out[8] = '\0'; // Null-terminate the string |
| 50 | +} |
| 51 | + |
| 52 | +// Macro to convert a string to an 8-byte identifier (EIGHTCC) |
| 53 | +#define STR_2_EIGHTCC(str) gmf_str_to_cc(str, 8) |
| 54 | + |
| 55 | +// Macro to convert a string to an 4-byte identifier (FOURCC) |
| 56 | +#define STR_2_FOURTCC(str) gmf_str_to_cc(str, 4) |
| 57 | + |
| 58 | +// Macro to convert an EIGHTCC code to a string |
| 59 | +#define EIGHTCC_2_STR(eightcc) ({ \ |
| 60 | + static char eightcc_str[9]; \ |
| 61 | + gmf_eightcc_to_str(eightcc, eightcc_str); \ |
| 62 | + eightcc_str; \ |
| 63 | +}) |
| 64 | + |
| 65 | +/***************************************************************************/ |
| 66 | +/* Definition of Audio Capabilities */ |
| 67 | +/***************************************************************************/ |
| 68 | +#define ESP_GMF_CAPS_AUDIO_DECODER STR_2_EIGHTCC("AUDDEC") |
| 69 | +#define ESP_GMF_CAPS_AUDIO_ENCODER STR_2_EIGHTCC("AUDENC") |
| 70 | +#define ESP_GMF_CAPS_AUDIO_ALC STR_2_EIGHTCC("AUDALC") |
| 71 | +#define ESP_GMF_CAPS_AUDIO_BIT_CONVERT STR_2_EIGHTCC("AUDBTCVT") |
| 72 | +#define ESP_GMF_CAPS_AUDIO_CHANNEL_CONVERT STR_2_EIGHTCC("AUDCHCVT") |
| 73 | +#define ESP_GMF_CAPS_AUDIO_RATE_CONVERT STR_2_EIGHTCC("AUDRTCVT") |
| 74 | +#define ESP_GMF_CAPS_AUDIO_MIXER STR_2_EIGHTCC("AUDMIXER") |
| 75 | +#define ESP_GMF_CAPS_AUDIO_EQUALIZER STR_2_EIGHTCC("AUDEQ") |
| 76 | +#define ESP_GMF_CAPS_AUDIO_SONIC STR_2_EIGHTCC("AUDSONIC") |
| 77 | +#define ESP_GMF_CAPS_AUDIO_FADE STR_2_EIGHTCC("AUDFADE") |
| 78 | +#define ESP_GMF_CAPS_AUDIO_DEINTERLEAVE STR_2_EIGHTCC("AUDDITLV") |
| 79 | +#define ESP_GMF_CAPS_AUDIO_INTERLEAVE STR_2_EIGHTCC("AUDINTLV") |
| 80 | + |
| 81 | + |
| 82 | +/***************************************************************************/ |
| 83 | +/* Definition of Video Capabilities */ |
| 84 | +/***************************************************************************/ |
| 85 | +#define ESP_GMF_CAPS_VIDEO_DECODER STR_2_EIGHTCC("VIDDEC") |
| 86 | +#define ESP_GMF_CAPS_VIDEO_ENCODER STR_2_EIGHTCC("VIDENC") |
| 87 | + |
| 88 | + |
| 89 | +#ifdef __cplusplus |
| 90 | +} |
| 91 | +#endif /* __cplusplus */ |
0 commit comments