FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libavformat/nut.c
Date: 2022-12-05 03:11:11
Exec Total Coverage
Lines: 35 41 85.4%
Functions: 6 7 85.7%
Branches: 7 10 70.0%

Line Branch Exec Source
1 /*
2 * nut
3 * Copyright (c) 2004-2007 Michael Niedermayer
4 *
5 * This file is part of FFmpeg.
6 *
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22 #include "libavutil/mathematics.h"
23 #include "libavutil/tree.h"
24 #include "nut.h"
25 #include "riff.h"
26 #include "internal.h"
27
28 const AVCodecTag ff_nut_subtitle_tags[] = {
29 { AV_CODEC_ID_TEXT, MKTAG('U', 'T', 'F', '8') },
30 { AV_CODEC_ID_ASS, MKTAG('S', 'S', 'A', 0 ) },
31 { AV_CODEC_ID_ASS, MKTAG('A', 'S', 'S', 0 ) },
32 { AV_CODEC_ID_DVD_SUBTITLE, MKTAG('D', 'V', 'D', 'S') },
33 { AV_CODEC_ID_DVB_SUBTITLE, MKTAG('D', 'V', 'B', 'S') },
34 { AV_CODEC_ID_DVB_TELETEXT, MKTAG('D', 'V', 'B', 'T') },
35 { AV_CODEC_ID_NONE, 0 }
36 };
37
38 const AVCodecTag ff_nut_data_tags[] = {
39 { AV_CODEC_ID_TEXT, MKTAG('U', 'T', 'F', '8') },
40 { AV_CODEC_ID_NONE, 0 }
41 };
42
43 const AVCodecTag ff_nut_video_tags[] = {
44 { AV_CODEC_ID_GIF, MKTAG('G', 'I', 'F', 0 ) },
45 { AV_CODEC_ID_XFACE, MKTAG('X', 'F', 'A', 'C') },
46 { AV_CODEC_ID_VP9, MKTAG('V', 'P', '9', '0') },
47 { AV_CODEC_ID_HEVC, MKTAG('H', 'E', 'V', 'C') },
48 { AV_CODEC_ID_CPIA, MKTAG('C', 'P', 'i', 'A') },
49 { AV_CODEC_ID_RAWVIDEO, MKTAG('R', 'G', 'B', 15 ) },
50 { AV_CODEC_ID_RAWVIDEO, MKTAG('B', 'G', 'R', 15 ) },
51 { AV_CODEC_ID_RAWVIDEO, MKTAG('R', 'G', 'B', 16 ) },
52 { AV_CODEC_ID_RAWVIDEO, MKTAG('B', 'G', 'R', 16 ) },
53 { AV_CODEC_ID_RAWVIDEO, MKTAG(15 , 'B', 'G', 'R') },
54 { AV_CODEC_ID_RAWVIDEO, MKTAG(15 , 'R', 'G', 'B') },
55 { AV_CODEC_ID_RAWVIDEO, MKTAG(16 , 'B', 'G', 'R') },
56 { AV_CODEC_ID_RAWVIDEO, MKTAG(16 , 'R', 'G', 'B') },
57 { AV_CODEC_ID_RAWVIDEO, MKTAG('R', 'G', 'B', 12 ) },
58 { AV_CODEC_ID_RAWVIDEO, MKTAG('B', 'G', 'R', 12 ) },
59 { AV_CODEC_ID_RAWVIDEO, MKTAG(12 , 'B', 'G', 'R') },
60 { AV_CODEC_ID_RAWVIDEO, MKTAG(12 , 'R', 'G', 'B') },
61 { AV_CODEC_ID_RAWVIDEO, MKTAG('R', 'G', 'B', 'A') },
62 { AV_CODEC_ID_RAWVIDEO, MKTAG('R', 'G', 'B', 0 ) },
63 { AV_CODEC_ID_RAWVIDEO, MKTAG('B', 'G', 'R', 'A') },
64 { AV_CODEC_ID_RAWVIDEO, MKTAG('B', 'G', 'R', 0 ) },
65 { AV_CODEC_ID_RAWVIDEO, MKTAG('A', 'B', 'G', 'R') },
66 { AV_CODEC_ID_RAWVIDEO, MKTAG( 0 , 'B', 'G', 'R') },
67 { AV_CODEC_ID_RAWVIDEO, MKTAG('A', 'R', 'G', 'B') },
68 { AV_CODEC_ID_RAWVIDEO, MKTAG( 0 , 'R', 'G', 'B') },
69 { AV_CODEC_ID_RAWVIDEO, MKTAG('R', 'G', 'B', 24 ) },
70 { AV_CODEC_ID_RAWVIDEO, MKTAG('B', 'G', 'R', 24 ) },
71 { AV_CODEC_ID_RAWVIDEO, MKTAG('4', '1', '1', 'P') },
72 { AV_CODEC_ID_RAWVIDEO, MKTAG('4', '2', '2', 'P') },
73 { AV_CODEC_ID_RAWVIDEO, MKTAG('4', '2', '2', 'P') },
74 { AV_CODEC_ID_RAWVIDEO, MKTAG('4', '4', '0', 'P') },
75 { AV_CODEC_ID_RAWVIDEO, MKTAG('4', '4', '0', 'P') },
76 { AV_CODEC_ID_RAWVIDEO, MKTAG('4', '4', '4', 'P') },
77 { AV_CODEC_ID_RAWVIDEO, MKTAG('4', '4', '4', 'P') },
78 { AV_CODEC_ID_RAWVIDEO, MKTAG('B', '1', 'W', '0') },
79 { AV_CODEC_ID_RAWVIDEO, MKTAG('B', '0', 'W', '1') },
80 { AV_CODEC_ID_RAWVIDEO, MKTAG('B', 'G', 'R', 8 ) },
81 { AV_CODEC_ID_RAWVIDEO, MKTAG('R', 'G', 'B', 8 ) },
82 { AV_CODEC_ID_RAWVIDEO, MKTAG('B', 'G', 'R', 4 ) },
83 { AV_CODEC_ID_RAWVIDEO, MKTAG('R', 'G', 'B', 4 ) },
84 { AV_CODEC_ID_RAWVIDEO, MKTAG('B', '4', 'B', 'Y') },
85 { AV_CODEC_ID_RAWVIDEO, MKTAG('R', '4', 'B', 'Y') },
86 { AV_CODEC_ID_RAWVIDEO, MKTAG('B', 'G', 'R', 48 ) },
87 { AV_CODEC_ID_RAWVIDEO, MKTAG('R', 'G', 'B', 48 ) },
88 { AV_CODEC_ID_RAWVIDEO, MKTAG(48 , 'B', 'G', 'R') },
89 { AV_CODEC_ID_RAWVIDEO, MKTAG(48 , 'R', 'G', 'B') },
90 { AV_CODEC_ID_RAWVIDEO, MKTAG('R', 'B', 'A', 64 ) },
91 { AV_CODEC_ID_RAWVIDEO, MKTAG('B', 'R', 'A', 64 ) },
92 { AV_CODEC_ID_RAWVIDEO, MKTAG(64 , 'R', 'B', 'A') },
93 { AV_CODEC_ID_RAWVIDEO, MKTAG(64 , 'B', 'R', 'A') },
94 { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '3', 11 , 9 ) },
95 { AV_CODEC_ID_RAWVIDEO, MKTAG( 9 , 11 , '3', 'Y') },
96 { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '3', 10 , 9 ) },
97 { AV_CODEC_ID_RAWVIDEO, MKTAG( 9 , 10 , '3', 'Y') },
98 { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '3', 0 , 9 ) },
99 { AV_CODEC_ID_RAWVIDEO, MKTAG( 9 , 0 , '3', 'Y') },
100 { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '3', 11 , 10 ) },
101 { AV_CODEC_ID_RAWVIDEO, MKTAG(10 , 11 , '3', 'Y') },
102 { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '3', 10 , 10 ) },
103 { AV_CODEC_ID_RAWVIDEO, MKTAG(10 , 10 , '3', 'Y') },
104 { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '3', 0 , 10 ) },
105 { AV_CODEC_ID_RAWVIDEO, MKTAG(10 , 0 , '3', 'Y') },
106 { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '3', 11 , 12 ) },
107 { AV_CODEC_ID_RAWVIDEO, MKTAG(12 , 11 , '3', 'Y') },
108 { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '3', 10 , 12 ) },
109 { AV_CODEC_ID_RAWVIDEO, MKTAG(12 , 10 , '3', 'Y') },
110 { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '3', 0 , 12 ) },
111 { AV_CODEC_ID_RAWVIDEO, MKTAG(12 , 0 , '3', 'Y') },
112 { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '3', 11 , 14 ) },
113 { AV_CODEC_ID_RAWVIDEO, MKTAG(14 , 11 , '3', 'Y') },
114 { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '3', 10 , 14 ) },
115 { AV_CODEC_ID_RAWVIDEO, MKTAG(14 , 10 , '3', 'Y') },
116 { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '3', 0 , 14 ) },
117 { AV_CODEC_ID_RAWVIDEO, MKTAG(14 , 0 , '3', 'Y') },
118 { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '1', 0 , 16 ) },
119 { AV_CODEC_ID_RAWVIDEO, MKTAG(16 , 0 , '1', 'Y') },
120 { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '3', 11 , 16 ) },
121 { AV_CODEC_ID_RAWVIDEO, MKTAG(16 , 11 , '3', 'Y') },
122 { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '3', 10 , 16 ) },
123 { AV_CODEC_ID_RAWVIDEO, MKTAG(16 , 10 , '3', 'Y') },
124 { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '3', 0 , 16 ) },
125 { AV_CODEC_ID_RAWVIDEO, MKTAG(16 , 0 , '3', 'Y') },
126 { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '4', 11 , 8 ) },
127 { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '4', 10 , 8 ) },
128 { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '4', 0 , 8 ) },
129 { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '2', 0 , 8 ) },
130
131 { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '1', 0, 9) },
132 { AV_CODEC_ID_RAWVIDEO, MKTAG(9, 0, '1', 'Y') },
133 { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '4', 11, 9) },
134 { AV_CODEC_ID_RAWVIDEO, MKTAG(9, 11, '4', 'Y') },
135 { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '4', 10, 9) },
136 { AV_CODEC_ID_RAWVIDEO, MKTAG(9, 10, '4', 'Y') },
137 { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '4', 0, 9) },
138 { AV_CODEC_ID_RAWVIDEO, MKTAG(9, 0, '4', 'Y') },
139
140 { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '1', 0, 10) },
141 { AV_CODEC_ID_RAWVIDEO, MKTAG(10, 0, '1', 'Y') },
142 { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '4', 11, 10) },
143 { AV_CODEC_ID_RAWVIDEO, MKTAG(10, 11, '4', 'Y') },
144 { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '4', 10, 10) },
145 { AV_CODEC_ID_RAWVIDEO, MKTAG(10, 10, '4', 'Y') },
146 { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '4', 0, 10) },
147 { AV_CODEC_ID_RAWVIDEO, MKTAG(10, 0, '4', 'Y') },
148
149 { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '4', 0, 12) },
150 { AV_CODEC_ID_RAWVIDEO, MKTAG(12, 0, '4', 'Y') },
151 { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '4', 10, 12) },
152 { AV_CODEC_ID_RAWVIDEO, MKTAG(12, 10, '4', 'Y') },
153
154 { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '1', 0, 12) },
155 { AV_CODEC_ID_RAWVIDEO, MKTAG(12, 0, '1', 'Y') },
156 { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '1', 0, 16) },
157 { AV_CODEC_ID_RAWVIDEO, MKTAG(16, 0, '1', 'Y') },
158 { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '4', 11, 16) },
159 { AV_CODEC_ID_RAWVIDEO, MKTAG(16, 11, '4', 'Y') },
160 { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '4', 10, 16) },
161 { AV_CODEC_ID_RAWVIDEO, MKTAG(16, 10, '4', 'Y') },
162 { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '4', 0, 16) },
163 { AV_CODEC_ID_RAWVIDEO, MKTAG(16, 0, '4', 'Y') },
164
165 { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '1', 0, 14) },
166 { AV_CODEC_ID_RAWVIDEO, MKTAG(14, 0, '1', 'Y') },
167
168 { AV_CODEC_ID_RAWVIDEO, MKTAG('G', '3', 0, 8) },
169
170 { AV_CODEC_ID_RAWVIDEO, MKTAG('G', '3', 0, 9) },
171 { AV_CODEC_ID_RAWVIDEO, MKTAG( 9, 0, '3', 'G') },
172 { AV_CODEC_ID_RAWVIDEO, MKTAG('G', '3', 0, 10) },
173 { AV_CODEC_ID_RAWVIDEO, MKTAG(10, 0, '3', 'G') },
174 { AV_CODEC_ID_RAWVIDEO, MKTAG('G', '3', 0, 12) },
175 { AV_CODEC_ID_RAWVIDEO, MKTAG(12, 0, '3', 'G') },
176 { AV_CODEC_ID_RAWVIDEO, MKTAG('G', '3', 0, 14) },
177 { AV_CODEC_ID_RAWVIDEO, MKTAG(14, 0, '3', 'G') },
178 { AV_CODEC_ID_RAWVIDEO, MKTAG('G', '3', 0, 16) },
179 { AV_CODEC_ID_RAWVIDEO, MKTAG(16, 0, '3', 'G') },
180
181 { AV_CODEC_ID_RAWVIDEO, MKTAG('G', '4', 0, 8) },
182
183 { AV_CODEC_ID_RAWVIDEO, MKTAG('G', '4', 00 , 10 ) },
184 { AV_CODEC_ID_RAWVIDEO, MKTAG(10 , 00 , '4', 'G') },
185 { AV_CODEC_ID_RAWVIDEO, MKTAG('G', '4', 00 , 12 ) },
186 { AV_CODEC_ID_RAWVIDEO, MKTAG(12 , 00 , '4', 'G') },
187 { AV_CODEC_ID_RAWVIDEO, MKTAG('G', '4', 00 , 16 ) },
188 { AV_CODEC_ID_RAWVIDEO, MKTAG(16 , 00 , '4', 'G') },
189
190 { AV_CODEC_ID_RAWVIDEO, MKTAG('X', 'Y', 'Z' , 36 ) },
191 { AV_CODEC_ID_RAWVIDEO, MKTAG(36 , 'Z' , 'Y', 'X') },
192
193 { AV_CODEC_ID_RAWVIDEO, MKTAG('P', 'A', 'L', 8 ) },
194
195 { AV_CODEC_ID_RAWVIDEO, MKTAG(0xBA, 'B', 'G', 8 ) },
196 { AV_CODEC_ID_RAWVIDEO, MKTAG(0xBA, 'B', 'G', 16 ) },
197 { AV_CODEC_ID_RAWVIDEO, MKTAG(16 , 'G', 'B', 0xBA) },
198 { AV_CODEC_ID_RAWVIDEO, MKTAG(0xBA, 'R', 'G', 8 ) },
199 { AV_CODEC_ID_RAWVIDEO, MKTAG(0xBA, 'R', 'G', 16 ) },
200 { AV_CODEC_ID_RAWVIDEO, MKTAG(16 , 'G', 'R', 0xBA) },
201 { AV_CODEC_ID_RAWVIDEO, MKTAG(0xBA, 'G', 'B', 8 ) },
202 { AV_CODEC_ID_RAWVIDEO, MKTAG(0xBA, 'G', 'B', 16 ) },
203 { AV_CODEC_ID_RAWVIDEO, MKTAG(16, 'B', 'G', 0xBA) },
204 { AV_CODEC_ID_RAWVIDEO, MKTAG(0xBA, 'G', 'R', 8 ) },
205 { AV_CODEC_ID_RAWVIDEO, MKTAG(0xBA, 'G', 'R', 16 ) },
206 { AV_CODEC_ID_RAWVIDEO, MKTAG(16, 'R', 'G', 0xBA) },
207
208 { AV_CODEC_ID_NONE, 0 }
209 };
210
211 const AVCodecTag ff_nut_audio_extra_tags[] = {
212 { AV_CODEC_ID_COMFORT_NOISE, MKTAG('3', '3', '8', '9') },
213 { AV_CODEC_ID_PCM_ALAW, MKTAG('A', 'L', 'A', 'W') },
214 { AV_CODEC_ID_PCM_MULAW, MKTAG('U', 'L', 'A', 'W') },
215 { AV_CODEC_ID_MP3, MKTAG('M', 'P', '3', ' ') },
216 { AV_CODEC_ID_OPUS, MKTAG('O', 'p', 'u', 's') },
217 { AV_CODEC_ID_WAVPACK, MKTAG('w', 'v', 'p', 'k') },
218 { AV_CODEC_ID_NONE, 0 }
219 };
220
221 const AVCodecTag ff_nut_audio_tags[] = {
222 { AV_CODEC_ID_PCM_F32BE, MKTAG(32 , 'D', 'F', 'P') },
223 { AV_CODEC_ID_PCM_F32LE, MKTAG('P', 'F', 'D', 32 ) },
224 { AV_CODEC_ID_PCM_F64BE, MKTAG(64 , 'D', 'F', 'P') },
225 { AV_CODEC_ID_PCM_F64LE, MKTAG('P', 'F', 'D', 64 ) },
226 { AV_CODEC_ID_PCM_S16BE, MKTAG(16 , 'D', 'S', 'P') },
227 { AV_CODEC_ID_PCM_S16LE, MKTAG('P', 'S', 'D', 16 ) },
228 { AV_CODEC_ID_PCM_S24BE, MKTAG(24 , 'D', 'S', 'P') },
229 { AV_CODEC_ID_PCM_S24LE, MKTAG('P', 'S', 'D', 24 ) },
230 { AV_CODEC_ID_PCM_S32BE, MKTAG(32 , 'D', 'S', 'P') },
231 { AV_CODEC_ID_PCM_S32LE, MKTAG('P', 'S', 'D', 32 ) },
232 { AV_CODEC_ID_PCM_S64BE, MKTAG(64 , 'D', 'S', 'P') },
233 { AV_CODEC_ID_PCM_S64LE, MKTAG('P', 'S', 'D', 64 ) },
234 { AV_CODEC_ID_PCM_S8, MKTAG('P', 'S', 'D', 8 ) },
235 { AV_CODEC_ID_PCM_U16BE, MKTAG(16 , 'D', 'U', 'P') },
236 { AV_CODEC_ID_PCM_U16LE, MKTAG('P', 'U', 'D', 16 ) },
237 { AV_CODEC_ID_PCM_U24BE, MKTAG(24 , 'D', 'U', 'P') },
238 { AV_CODEC_ID_PCM_U24LE, MKTAG('P', 'U', 'D', 24 ) },
239 { AV_CODEC_ID_PCM_U32BE, MKTAG(32 , 'D', 'U', 'P') },
240 { AV_CODEC_ID_PCM_U32LE, MKTAG('P', 'U', 'D', 32 ) },
241 { AV_CODEC_ID_PCM_U8, MKTAG('P', 'U', 'D', 8 ) },
242 { AV_CODEC_ID_PCM_S8_PLANAR, MKTAG('P', 'S', 'P', 8 ) },
243 { AV_CODEC_ID_PCM_S16BE_PLANAR, MKTAG(16 , 'P', 'S', 'P') },
244 { AV_CODEC_ID_PCM_S16LE_PLANAR, MKTAG('P', 'S', 'P', 16 ) },
245 { AV_CODEC_ID_PCM_S24LE_PLANAR, MKTAG('P', 'S', 'P', 24 ) },
246 { AV_CODEC_ID_PCM_S32LE_PLANAR, MKTAG('P', 'S', 'P', 32 ) },
247 { AV_CODEC_ID_NONE, 0 }
248 };
249
250 const AVCodecTag * const ff_nut_codec_tags[] = {
251 ff_nut_video_tags, ff_nut_audio_tags, ff_nut_subtitle_tags,
252 ff_codec_bmp_tags, ff_codec_wav_tags, ff_nut_audio_extra_tags, ff_nut_data_tags, 0
253 };
254
255 4950 void ff_nut_reset_ts(NUTContext *nut, AVRational time_base, int64_t val)
256 {
257 int i;
258
2/2
✓ Branch 0 taken 5227 times.
✓ Branch 1 taken 4950 times.
10177 for (i = 0; i < nut->avf->nb_streams; i++)
259 5227 nut->stream[i].last_pts =
260 5227 av_rescale_rnd(val,
261 5227 time_base.num * (int64_t)nut->stream[i].time_base->den,
262 5227 time_base.den * (int64_t)nut->stream[i].time_base->num,
263 AV_ROUND_DOWN);
264 4950 }
265
266 9978 int64_t ff_lsb2full(StreamContext *stream, int64_t lsb)
267 {
268 9978 int64_t mask = (1ULL << stream->msb_pts_shift) - 1;
269 9978 int64_t delta = stream->last_pts - mask / 2;
270 9978 return ((lsb - delta) & mask) + delta;
271 }
272
273 21915 int ff_nut_sp_pos_cmp(const void *a, const void *b)
274 {
275 21915 const Syncpoint *va = a, *vb = b;
276 21915 return ((va->pos - vb->pos) >> 32) - ((vb->pos - va->pos) >> 32);
277 }
278
279 int ff_nut_sp_pts_cmp(const void *a, const void *b)
280 {
281 const Syncpoint *va = a, *vb = b;
282 return ((va->ts - vb->ts) >> 32) - ((vb->ts - va->ts) >> 32);
283 }
284
285 4950 int ff_nut_add_sp(NUTContext *nut, int64_t pos, int64_t back_ptr, int64_t ts)
286 {
287 4950 Syncpoint *sp = av_mallocz(sizeof(Syncpoint));
288 4950 struct AVTreeNode *node = av_tree_node_alloc();
289
290
2/4
✓ Branch 0 taken 4950 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 4950 times.
4950 if (!sp || !node) {
291 av_freep(&sp);
292 av_freep(&node);
293 return AVERROR(ENOMEM);
294 }
295
296 4950 nut->sp_count++;
297
298 4950 sp->pos = pos;
299 4950 sp->back_ptr = back_ptr;
300 4950 sp->ts = ts;
301 4950 av_tree_insert(&nut->syncpoints, sp, ff_nut_sp_pos_cmp, &node);
302
2/2
✓ Branch 0 taken 23 times.
✓ Branch 1 taken 4927 times.
4950 if (node) {
303 23 av_free(sp);
304 23 av_free(node);
305 }
306
307 4950 return 0;
308 }
309
310 4927 static int enu_free(void *opaque, void *elem)
311 {
312 4927 av_free(elem);
313 4927 return 0;
314 }
315
316 2329 void ff_nut_free_sp(NUTContext *nut)
317 {
318
1/2
✓ Branch 0 taken 2329 times.
✗ Branch 1 not taken.
2329 if (nut->syncpoints) {
319 2329 av_tree_enumerate(nut->syncpoints, NULL, NULL, enu_free);
320 2329 av_tree_destroy(nut->syncpoints);
321 }
322 2329 }
323
324 const Dispositions ff_nut_dispositions[] = {
325 { "default", AV_DISPOSITION_DEFAULT },
326 { "dub", AV_DISPOSITION_DUB },
327 { "original", AV_DISPOSITION_ORIGINAL },
328 { "comment", AV_DISPOSITION_COMMENT },
329 { "lyrics", AV_DISPOSITION_LYRICS },
330 { "karaoke", AV_DISPOSITION_KARAOKE },
331 { "", 0 }
332 };
333
334 const AVMetadataConv ff_nut_metadata_conv[] = {
335 { "Author", "artist" },
336 { "X-CreationTime", "date" },
337 { "CreationTime", "date" },
338 { "SourceFilename", "filename" },
339 { "X-Language", "language" },
340 { "X-Disposition", "disposition" },
341 { "X-Replaces", "replaces" },
342 { "X-Depends", "depends" },
343 { "X-Uses", "uses" },
344 { "X-UsesFont", "usesfont" },
345 { 0 },
346 };
347