| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /* | ||
| 2 | * This file is part of FFmpeg. | ||
| 3 | * | ||
| 4 | * FFmpeg is free software; you can redistribute it and/or | ||
| 5 | * modify it under the terms of the GNU Lesser General Public | ||
| 6 | * License as published by the Free Software Foundation; either | ||
| 7 | * version 2.1 of the License, or (at your option) any later version. | ||
| 8 | * | ||
| 9 | * FFmpeg is distributed in the hope that it will be useful, | ||
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 12 | * Lesser General Public License for more details. | ||
| 13 | * | ||
| 14 | * You should have received a copy of the GNU Lesser General Public | ||
| 15 | * License along with FFmpeg; if not, write to the Free Software | ||
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 17 | */ | ||
| 18 | |||
| 19 | #include <stdio.h> | ||
| 20 | #include <string.h> | ||
| 21 | |||
| 22 | #include "libavcodec/packet.h" | ||
| 23 | #include "libavcodec/packet_internal.h" | ||
| 24 | |||
| 25 | #define HANDLE_CHARS "abcdefghijklmnopqrstuvwxyz0123456789_" | ||
| 26 | |||
| 27 | #define SET_HANDLE(type, handle) \ | ||
| 28 | if (handles[AV_PKT_DATA_ ## type]) { \ | ||
| 29 | printf("%s: second handle %s\n", #type, handle); \ | ||
| 30 | ret = 1; \ | ||
| 31 | } \ | ||
| 32 | handles[AV_PKT_DATA_ ## type] = handle; | ||
| 33 | |||
| 34 | /* | ||
| 35 | * Every side data type needs exactly one handle, and no two types may share | ||
| 36 | * one. A handle is typed in options, where '+' and '-' have a meaning, so it | ||
| 37 | * is made of [a-z0-9_] only. The handles are printed and compared with the | ||
| 38 | * reference, since a released handle must not change. | ||
| 39 | */ | ||
| 40 | 1 | int main(void) | |
| 41 | { | ||
| 42 | 1 | const char *handles[AV_PKT_DATA_NB] = { NULL }; | |
| 43 | 1 | int ret = 0; | |
| 44 | |||
| 45 |
44/88✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
✗ Branch 18 not taken.
✓ Branch 19 taken 1 times.
✗ Branch 21 not taken.
✓ Branch 22 taken 1 times.
✗ Branch 24 not taken.
✓ Branch 25 taken 1 times.
✗ Branch 27 not taken.
✓ Branch 28 taken 1 times.
✗ Branch 30 not taken.
✓ Branch 31 taken 1 times.
✗ Branch 33 not taken.
✓ Branch 34 taken 1 times.
✗ Branch 36 not taken.
✓ Branch 37 taken 1 times.
✗ Branch 39 not taken.
✓ Branch 40 taken 1 times.
✗ Branch 42 not taken.
✓ Branch 43 taken 1 times.
✗ Branch 45 not taken.
✓ Branch 46 taken 1 times.
✗ Branch 48 not taken.
✓ Branch 49 taken 1 times.
✗ Branch 51 not taken.
✓ Branch 52 taken 1 times.
✗ Branch 54 not taken.
✓ Branch 55 taken 1 times.
✗ Branch 57 not taken.
✓ Branch 58 taken 1 times.
✗ Branch 60 not taken.
✓ Branch 61 taken 1 times.
✗ Branch 63 not taken.
✓ Branch 64 taken 1 times.
✗ Branch 66 not taken.
✓ Branch 67 taken 1 times.
✗ Branch 69 not taken.
✓ Branch 70 taken 1 times.
✗ Branch 72 not taken.
✓ Branch 73 taken 1 times.
✗ Branch 75 not taken.
✓ Branch 76 taken 1 times.
✗ Branch 78 not taken.
✓ Branch 79 taken 1 times.
✗ Branch 81 not taken.
✓ Branch 82 taken 1 times.
✗ Branch 84 not taken.
✓ Branch 85 taken 1 times.
✗ Branch 87 not taken.
✓ Branch 88 taken 1 times.
✗ Branch 90 not taken.
✓ Branch 91 taken 1 times.
✗ Branch 93 not taken.
✓ Branch 94 taken 1 times.
✗ Branch 96 not taken.
✓ Branch 97 taken 1 times.
✗ Branch 99 not taken.
✓ Branch 100 taken 1 times.
✗ Branch 102 not taken.
✓ Branch 103 taken 1 times.
✗ Branch 105 not taken.
✓ Branch 106 taken 1 times.
✗ Branch 108 not taken.
✓ Branch 109 taken 1 times.
✗ Branch 111 not taken.
✓ Branch 112 taken 1 times.
✗ Branch 114 not taken.
✓ Branch 115 taken 1 times.
✗ Branch 117 not taken.
✓ Branch 118 taken 1 times.
✗ Branch 120 not taken.
✓ Branch 121 taken 1 times.
✗ Branch 123 not taken.
✓ Branch 124 taken 1 times.
✗ Branch 126 not taken.
✓ Branch 127 taken 1 times.
✗ Branch 129 not taken.
✓ Branch 130 taken 1 times.
|
1 | FF_PACKET_SIDE_DATA_HANDLES(SET_HANDLE) |
| 46 | |||
| 47 |
2/2✓ Branch 0 taken 44 times.
✓ Branch 1 taken 1 times.
|
45 | for (int type = 0; type < AV_PKT_DATA_NB; type++) { |
| 48 |
1/2✓ Branch 0 taken 44 times.
✗ Branch 1 not taken.
|
44 | printf("%2d: %s\n", type, handles[type] ? handles[type] : "(none)"); |
| 49 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 44 times.
|
44 | if (!handles[type]) |
| 50 | ✗ | ret = 1; | |
| 51 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 44 times.
|
44 | else if (strspn(handles[type], HANDLE_CHARS) != strlen(handles[type])) { |
| 52 | ✗ | printf("%2d: character outside of [a-z0-9_]\n", type); | |
| 53 | ✗ | ret = 1; | |
| 54 | } | ||
| 55 | |||
| 56 |
3/4✓ Branch 0 taken 990 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 946 times.
✓ Branch 3 taken 44 times.
|
990 | for (int other = 0; handles[type] && other < type; other++) { |
| 57 |
2/4✓ Branch 0 taken 946 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 946 times.
|
946 | if (handles[other] && !strcmp(handles[type], handles[other])) { |
| 58 | ✗ | printf("%2d: handle of type %d\n", type, other); | |
| 59 | ✗ | ret = 1; | |
| 60 | } | ||
| 61 | } | ||
| 62 | } | ||
| 63 | |||
| 64 | 1 | return ret; | |
| 65 | } | ||
| 66 |