3 * Copyright (c) 2004-2007 Michael Niedermayer
5 * This file is part of FFmpeg.
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.
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.
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
22 #include "libavutil/mathematics.h"
23 #include "libavutil/mem.h"
24 #include "libavutil/tree.h"
29 const AVCodecTag ff_nut_subtitle_tags
[] = {
30 { AV_CODEC_ID_TEXT
, MKTAG('U', 'T', 'F', '8') },
31 { AV_CODEC_ID_ASS
, MKTAG('S', 'S', 'A', 0 ) },
32 { AV_CODEC_ID_ASS
, MKTAG('A', 'S', 'S', 0 ) },
33 { AV_CODEC_ID_DVD_SUBTITLE
, MKTAG('D', 'V', 'D', 'S') },
34 { AV_CODEC_ID_DVB_SUBTITLE
, MKTAG('D', 'V', 'B', 'S') },
35 { AV_CODEC_ID_DVB_TELETEXT
, MKTAG('D', 'V', 'B', 'T') },
36 { AV_CODEC_ID_NONE
, 0 }
39 const AVCodecTag ff_nut_data_tags
[] = {
40 { AV_CODEC_ID_TEXT
, MKTAG('U', 'T', 'F', '8') },
41 { AV_CODEC_ID_NONE
, 0 }
44 const AVCodecTag ff_nut_video_tags
[] = {
45 { AV_CODEC_ID_GIF
, MKTAG('G', 'I', 'F', 0 ) },
46 { AV_CODEC_ID_XFACE
, MKTAG('X', 'F', 'A', 'C') },
47 { AV_CODEC_ID_VP9
, MKTAG('V', 'P', '9', '0') },
48 { AV_CODEC_ID_HEVC
, MKTAG('H', 'E', 'V', 'C') },
49 { AV_CODEC_ID_CPIA
, MKTAG('C', 'P', 'i', 'A') },
50 { AV_CODEC_ID_RAWVIDEO
, MKTAG('R', 'G', 'B', 15 ) },
51 { AV_CODEC_ID_RAWVIDEO
, MKTAG('B', 'G', 'R', 15 ) },
52 { AV_CODEC_ID_RAWVIDEO
, MKTAG('R', 'G', 'B', 16 ) },
53 { AV_CODEC_ID_RAWVIDEO
, MKTAG('B', 'G', 'R', 16 ) },
54 { AV_CODEC_ID_RAWVIDEO
, MKTAG(15 , 'B', 'G', 'R') },
55 { AV_CODEC_ID_RAWVIDEO
, MKTAG(15 , 'R', 'G', 'B') },
56 { AV_CODEC_ID_RAWVIDEO
, MKTAG(16 , 'B', 'G', 'R') },
57 { AV_CODEC_ID_RAWVIDEO
, MKTAG(16 , 'R', 'G', 'B') },
58 { AV_CODEC_ID_RAWVIDEO
, MKTAG('R', 'G', 'B', 12 ) },
59 { AV_CODEC_ID_RAWVIDEO
, MKTAG('B', 'G', 'R', 12 ) },
60 { AV_CODEC_ID_RAWVIDEO
, MKTAG(12 , 'B', 'G', 'R') },
61 { AV_CODEC_ID_RAWVIDEO
, MKTAG(12 , 'R', 'G', 'B') },
62 { AV_CODEC_ID_RAWVIDEO
, MKTAG('R', 'G', 'B', 'A') },
63 { AV_CODEC_ID_RAWVIDEO
, MKTAG('R', 'G', 'B', 0 ) },
64 { AV_CODEC_ID_RAWVIDEO
, MKTAG('B', 'G', 'R', 'A') },
65 { AV_CODEC_ID_RAWVIDEO
, MKTAG('B', 'G', 'R', 0 ) },
66 { AV_CODEC_ID_RAWVIDEO
, MKTAG('A', 'B', 'G', 'R') },
67 { AV_CODEC_ID_RAWVIDEO
, MKTAG( 0 , 'B', 'G', 'R') },
68 { AV_CODEC_ID_RAWVIDEO
, MKTAG('A', 'R', 'G', 'B') },
69 { AV_CODEC_ID_RAWVIDEO
, MKTAG( 0 , 'R', 'G', 'B') },
70 { AV_CODEC_ID_RAWVIDEO
, MKTAG('R', 'G', 'B', 24 ) },
71 { AV_CODEC_ID_RAWVIDEO
, MKTAG('B', 'G', 'R', 24 ) },
72 { AV_CODEC_ID_RAWVIDEO
, MKTAG('4', '1', '1', 'P') },
73 { AV_CODEC_ID_RAWVIDEO
, MKTAG('4', '2', '2', 'P') },
74 { AV_CODEC_ID_RAWVIDEO
, MKTAG('4', '2', '2', 'P') },
75 { AV_CODEC_ID_RAWVIDEO
, MKTAG('4', '4', '0', 'P') },
76 { AV_CODEC_ID_RAWVIDEO
, MKTAG('4', '4', '0', 'P') },
77 { AV_CODEC_ID_RAWVIDEO
, MKTAG('4', '4', '4', 'P') },
78 { AV_CODEC_ID_RAWVIDEO
, MKTAG('4', '4', '4', 'P') },
79 { AV_CODEC_ID_RAWVIDEO
, MKTAG('B', '1', 'W', '0') },
80 { AV_CODEC_ID_RAWVIDEO
, MKTAG('B', '0', 'W', '1') },
81 { AV_CODEC_ID_RAWVIDEO
, MKTAG('B', 'G', 'R', 8 ) },
82 { AV_CODEC_ID_RAWVIDEO
, MKTAG('R', 'G', 'B', 8 ) },
83 { AV_CODEC_ID_RAWVIDEO
, MKTAG('B', 'G', 'R', 4 ) },
84 { AV_CODEC_ID_RAWVIDEO
, MKTAG('R', 'G', 'B', 4 ) },
85 { AV_CODEC_ID_RAWVIDEO
, MKTAG('B', '4', 'B', 'Y') },
86 { AV_CODEC_ID_RAWVIDEO
, MKTAG('R', '4', 'B', 'Y') },
87 { AV_CODEC_ID_RAWVIDEO
, MKTAG('B', 'G', 'R', 48 ) },
88 { AV_CODEC_ID_RAWVIDEO
, MKTAG('R', 'G', 'B', 48 ) },
89 { AV_CODEC_ID_RAWVIDEO
, MKTAG(48 , 'B', 'G', 'R') },
90 { AV_CODEC_ID_RAWVIDEO
, MKTAG(48 , 'R', 'G', 'B') },
91 { AV_CODEC_ID_RAWVIDEO
, MKTAG('R', 'B', 'A', 64 ) },
92 { AV_CODEC_ID_RAWVIDEO
, MKTAG('B', 'R', 'A', 64 ) },
93 { AV_CODEC_ID_RAWVIDEO
, MKTAG(64 , 'R', 'B', 'A') },
94 { AV_CODEC_ID_RAWVIDEO
, MKTAG(64 , 'B', 'R', 'A') },
95 { AV_CODEC_ID_RAWVIDEO
, MKTAG('Y', '3', 11 , 9 ) },
96 { AV_CODEC_ID_RAWVIDEO
, MKTAG( 9 , 11 , '3', 'Y') },
97 { AV_CODEC_ID_RAWVIDEO
, MKTAG('Y', '3', 10 , 9 ) },
98 { AV_CODEC_ID_RAWVIDEO
, MKTAG( 9 , 10 , '3', 'Y') },
99 { AV_CODEC_ID_RAWVIDEO
, MKTAG('Y', '3', 0 , 9 ) },
100 { AV_CODEC_ID_RAWVIDEO
, MKTAG( 9 , 0 , '3', 'Y') },
101 { AV_CODEC_ID_RAWVIDEO
, MKTAG('Y', '3', 11 , 10 ) },
102 { AV_CODEC_ID_RAWVIDEO
, MKTAG(10 , 11 , '3', 'Y') },
103 { AV_CODEC_ID_RAWVIDEO
, MKTAG('Y', '3', 10 , 10 ) },
104 { AV_CODEC_ID_RAWVIDEO
, MKTAG(10 , 10 , '3', 'Y') },
105 { AV_CODEC_ID_RAWVIDEO
, MKTAG('Y', '3', 0 , 10 ) },
106 { AV_CODEC_ID_RAWVIDEO
, MKTAG(10 , 0 , '3', 'Y') },
107 { AV_CODEC_ID_RAWVIDEO
, MKTAG('Y', '3', 11 , 12 ) },
108 { AV_CODEC_ID_RAWVIDEO
, MKTAG(12 , 11 , '3', 'Y') },
109 { AV_CODEC_ID_RAWVIDEO
, MKTAG('Y', '3', 10 , 12 ) },
110 { AV_CODEC_ID_RAWVIDEO
, MKTAG(12 , 10 , '3', 'Y') },
111 { AV_CODEC_ID_RAWVIDEO
, MKTAG('Y', '3', 0 , 12 ) },
112 { AV_CODEC_ID_RAWVIDEO
, MKTAG(12 , 0 , '3', 'Y') },
113 { AV_CODEC_ID_RAWVIDEO
, MKTAG('Y', '3', 11 , 14 ) },
114 { AV_CODEC_ID_RAWVIDEO
, MKTAG(14 , 11 , '3', 'Y') },
115 { AV_CODEC_ID_RAWVIDEO
, MKTAG('Y', '3', 10 , 14 ) },
116 { AV_CODEC_ID_RAWVIDEO
, MKTAG(14 , 10 , '3', 'Y') },
117 { AV_CODEC_ID_RAWVIDEO
, MKTAG('Y', '3', 0 , 14 ) },
118 { AV_CODEC_ID_RAWVIDEO
, MKTAG(14 , 0 , '3', 'Y') },
119 { AV_CODEC_ID_RAWVIDEO
, MKTAG('Y', '1', 0 , 16 ) },
120 { AV_CODEC_ID_RAWVIDEO
, MKTAG(16 , 0 , '1', 'Y') },
121 { AV_CODEC_ID_RAWVIDEO
, MKTAG('Y', '3', 11 , 16 ) },
122 { AV_CODEC_ID_RAWVIDEO
, MKTAG(16 , 11 , '3', 'Y') },
123 { AV_CODEC_ID_RAWVIDEO
, MKTAG('Y', '3', 10 , 16 ) },
124 { AV_CODEC_ID_RAWVIDEO
, MKTAG(16 , 10 , '3', 'Y') },
125 { AV_CODEC_ID_RAWVIDEO
, MKTAG('Y', '3', 0 , 16 ) },
126 { AV_CODEC_ID_RAWVIDEO
, MKTAG(16 , 0 , '3', 'Y') },
127 { AV_CODEC_ID_RAWVIDEO
, MKTAG('Y', '4', 11 , 8 ) },
128 { AV_CODEC_ID_RAWVIDEO
, MKTAG('Y', '4', 10 , 8 ) },
129 { AV_CODEC_ID_RAWVIDEO
, MKTAG('Y', '4', 0 , 8 ) },
130 { AV_CODEC_ID_RAWVIDEO
, MKTAG('Y', '2', 0 , 8 ) },
132 { AV_CODEC_ID_RAWVIDEO
, MKTAG('Y', '1', 0, 9) },
133 { AV_CODEC_ID_RAWVIDEO
, MKTAG(9, 0, '1', 'Y') },
134 { AV_CODEC_ID_RAWVIDEO
, MKTAG('Y', '4', 11, 9) },
135 { AV_CODEC_ID_RAWVIDEO
, MKTAG(9, 11, '4', 'Y') },
136 { AV_CODEC_ID_RAWVIDEO
, MKTAG('Y', '4', 10, 9) },
137 { AV_CODEC_ID_RAWVIDEO
, MKTAG(9, 10, '4', 'Y') },
138 { AV_CODEC_ID_RAWVIDEO
, MKTAG('Y', '4', 0, 9) },
139 { AV_CODEC_ID_RAWVIDEO
, MKTAG(9, 0, '4', 'Y') },
141 { AV_CODEC_ID_RAWVIDEO
, MKTAG('Y', '1', 0, 10) },
142 { AV_CODEC_ID_RAWVIDEO
, MKTAG(10, 0, '1', 'Y') },
143 { AV_CODEC_ID_RAWVIDEO
, MKTAG('Y', '4', 11, 10) },
144 { AV_CODEC_ID_RAWVIDEO
, MKTAG(10, 11, '4', 'Y') },
145 { AV_CODEC_ID_RAWVIDEO
, MKTAG('Y', '4', 10, 10) },
146 { AV_CODEC_ID_RAWVIDEO
, MKTAG(10, 10, '4', 'Y') },
147 { AV_CODEC_ID_RAWVIDEO
, MKTAG('Y', '4', 0, 10) },
148 { AV_CODEC_ID_RAWVIDEO
, MKTAG(10, 0, '4', 'Y') },
150 { AV_CODEC_ID_RAWVIDEO
, MKTAG('Y', '4', 0, 12) },
151 { AV_CODEC_ID_RAWVIDEO
, MKTAG(12, 0, '4', 'Y') },
152 { AV_CODEC_ID_RAWVIDEO
, MKTAG('Y', '4', 10, 12) },
153 { AV_CODEC_ID_RAWVIDEO
, MKTAG(12, 10, '4', 'Y') },
155 { AV_CODEC_ID_RAWVIDEO
, MKTAG('Y', '1', 0, 12) },
156 { AV_CODEC_ID_RAWVIDEO
, MKTAG(12, 0, '1', 'Y') },
157 { AV_CODEC_ID_RAWVIDEO
, MKTAG('Y', '1', 0, 16) },
158 { AV_CODEC_ID_RAWVIDEO
, MKTAG(16, 0, '1', 'Y') },
159 { AV_CODEC_ID_RAWVIDEO
, MKTAG('Y', '4', 11, 16) },
160 { AV_CODEC_ID_RAWVIDEO
, MKTAG(16, 11, '4', 'Y') },
161 { AV_CODEC_ID_RAWVIDEO
, MKTAG('Y', '4', 10, 16) },
162 { AV_CODEC_ID_RAWVIDEO
, MKTAG(16, 10, '4', 'Y') },
163 { AV_CODEC_ID_RAWVIDEO
, MKTAG('Y', '4', 0, 16) },
164 { AV_CODEC_ID_RAWVIDEO
, MKTAG(16, 0, '4', 'Y') },
166 { AV_CODEC_ID_RAWVIDEO
, MKTAG('Y', '1', 0, 14) },
167 { AV_CODEC_ID_RAWVIDEO
, MKTAG(14, 0, '1', 'Y') },
169 { AV_CODEC_ID_RAWVIDEO
, MKTAG('G', '3', 0, 8) },
171 { AV_CODEC_ID_RAWVIDEO
, MKTAG('G', '3', 0, 9) },
172 { AV_CODEC_ID_RAWVIDEO
, MKTAG( 9, 0, '3', 'G') },
173 { AV_CODEC_ID_RAWVIDEO
, MKTAG('G', '3', 0, 10) },
174 { AV_CODEC_ID_RAWVIDEO
, MKTAG(10, 0, '3', 'G') },
175 { AV_CODEC_ID_RAWVIDEO
, MKTAG('G', '3', 0, 12) },
176 { AV_CODEC_ID_RAWVIDEO
, MKTAG(12, 0, '3', 'G') },
177 { AV_CODEC_ID_RAWVIDEO
, MKTAG('G', '3', 0, 14) },
178 { AV_CODEC_ID_RAWVIDEO
, MKTAG(14, 0, '3', 'G') },
179 { AV_CODEC_ID_RAWVIDEO
, MKTAG('G', '3', 0, 16) },
180 { AV_CODEC_ID_RAWVIDEO
, MKTAG(16, 0, '3', 'G') },
181 { AV_CODEC_ID_RAWVIDEO
, MKTAG('G', '3', 0, 17) },
182 { AV_CODEC_ID_RAWVIDEO
, MKTAG(17 , 0 , '3', 'G') },
183 { AV_CODEC_ID_RAWVIDEO
, MKTAG('G', '3', 0, 33) },
184 { AV_CODEC_ID_RAWVIDEO
, MKTAG(33 , 0 , '3', 'G') },
186 { AV_CODEC_ID_RAWVIDEO
, MKTAG('G', '4', 0, 8) },
188 { AV_CODEC_ID_RAWVIDEO
, MKTAG('G', '4', 00 , 10 ) },
189 { AV_CODEC_ID_RAWVIDEO
, MKTAG(10 , 00 , '4', 'G') },
190 { AV_CODEC_ID_RAWVIDEO
, MKTAG('G', '4', 00 , 12 ) },
191 { AV_CODEC_ID_RAWVIDEO
, MKTAG(12 , 00 , '4', 'G') },
192 { AV_CODEC_ID_RAWVIDEO
, MKTAG('G', '4', 00 , 14 ) },
193 { AV_CODEC_ID_RAWVIDEO
, MKTAG(14 , 00 , '4', 'G') },
194 { AV_CODEC_ID_RAWVIDEO
, MKTAG('G', '4', 00 , 16 ) },
195 { AV_CODEC_ID_RAWVIDEO
, MKTAG(16 , 00 , '4', 'G') },
196 { AV_CODEC_ID_RAWVIDEO
, MKTAG('G', '4', 0, 17) },
197 { AV_CODEC_ID_RAWVIDEO
, MKTAG(17 , 0 , '4', 'G') },
198 { AV_CODEC_ID_RAWVIDEO
, MKTAG('G', '4', 0, 33) },
199 { AV_CODEC_ID_RAWVIDEO
, MKTAG(33 , 0 , '4', 'G') },
201 { AV_CODEC_ID_RAWVIDEO
, MKTAG('X', 'Y', 'Z' , 36 ) },
202 { AV_CODEC_ID_RAWVIDEO
, MKTAG(36 , 'Z' , 'Y', 'X') },
204 { AV_CODEC_ID_RAWVIDEO
, MKTAG('P', 'A', 'L', 8 ) },
206 { AV_CODEC_ID_RAWVIDEO
, MKTAG(0xBA, 'B', 'G', 8 ) },
207 { AV_CODEC_ID_RAWVIDEO
, MKTAG(0xBA, 'B', 'G', 16 ) },
208 { AV_CODEC_ID_RAWVIDEO
, MKTAG(16 , 'G', 'B', 0xBA) },
209 { AV_CODEC_ID_RAWVIDEO
, MKTAG(0xBA, 'R', 'G', 8 ) },
210 { AV_CODEC_ID_RAWVIDEO
, MKTAG(0xBA, 'R', 'G', 16 ) },
211 { AV_CODEC_ID_RAWVIDEO
, MKTAG(16 , 'G', 'R', 0xBA) },
212 { AV_CODEC_ID_RAWVIDEO
, MKTAG(0xBA, 'G', 'B', 8 ) },
213 { AV_CODEC_ID_RAWVIDEO
, MKTAG(0xBA, 'G', 'B', 16 ) },
214 { AV_CODEC_ID_RAWVIDEO
, MKTAG(16, 'B', 'G', 0xBA) },
215 { AV_CODEC_ID_RAWVIDEO
, MKTAG(0xBA, 'G', 'R', 8 ) },
216 { AV_CODEC_ID_RAWVIDEO
, MKTAG(0xBA, 'G', 'R', 16 ) },
217 { AV_CODEC_ID_RAWVIDEO
, MKTAG(16, 'R', 'G', 0xBA) },
219 { AV_CODEC_ID_NONE
, 0 }
222 const AVCodecTag ff_nut_audio_extra_tags
[] = {
223 { AV_CODEC_ID_COMFORT_NOISE
, MKTAG('3', '3', '8', '9') },
224 { AV_CODEC_ID_PCM_ALAW
, MKTAG('A', 'L', 'A', 'W') },
225 { AV_CODEC_ID_PCM_MULAW
, MKTAG('U', 'L', 'A', 'W') },
226 { AV_CODEC_ID_MP3
, MKTAG('M', 'P', '3', ' ') },
227 { AV_CODEC_ID_OPUS
, MKTAG('O', 'p', 'u', 's') },
228 { AV_CODEC_ID_WAVPACK
, MKTAG('w', 'v', 'p', 'k') },
229 { AV_CODEC_ID_NONE
, 0 }
232 const AVCodecTag ff_nut_audio_tags
[] = {
233 { AV_CODEC_ID_PCM_F32BE
, MKTAG(32 , 'D', 'F', 'P') },
234 { AV_CODEC_ID_PCM_F32LE
, MKTAG('P', 'F', 'D', 32 ) },
235 { AV_CODEC_ID_PCM_F64BE
, MKTAG(64 , 'D', 'F', 'P') },
236 { AV_CODEC_ID_PCM_F64LE
, MKTAG('P', 'F', 'D', 64 ) },
237 { AV_CODEC_ID_PCM_S16BE
, MKTAG(16 , 'D', 'S', 'P') },
238 { AV_CODEC_ID_PCM_S16LE
, MKTAG('P', 'S', 'D', 16 ) },
239 { AV_CODEC_ID_PCM_S24BE
, MKTAG(24 , 'D', 'S', 'P') },
240 { AV_CODEC_ID_PCM_S24LE
, MKTAG('P', 'S', 'D', 24 ) },
241 { AV_CODEC_ID_PCM_S32BE
, MKTAG(32 , 'D', 'S', 'P') },
242 { AV_CODEC_ID_PCM_S32LE
, MKTAG('P', 'S', 'D', 32 ) },
243 { AV_CODEC_ID_PCM_S64BE
, MKTAG(64 , 'D', 'S', 'P') },
244 { AV_CODEC_ID_PCM_S64LE
, MKTAG('P', 'S', 'D', 64 ) },
245 { AV_CODEC_ID_PCM_S8
, MKTAG('P', 'S', 'D', 8 ) },
246 { AV_CODEC_ID_PCM_U16BE
, MKTAG(16 , 'D', 'U', 'P') },
247 { AV_CODEC_ID_PCM_U16LE
, MKTAG('P', 'U', 'D', 16 ) },
248 { AV_CODEC_ID_PCM_U24BE
, MKTAG(24 , 'D', 'U', 'P') },
249 { AV_CODEC_ID_PCM_U24LE
, MKTAG('P', 'U', 'D', 24 ) },
250 { AV_CODEC_ID_PCM_U32BE
, MKTAG(32 , 'D', 'U', 'P') },
251 { AV_CODEC_ID_PCM_U32LE
, MKTAG('P', 'U', 'D', 32 ) },
252 { AV_CODEC_ID_PCM_U8
, MKTAG('P', 'U', 'D', 8 ) },
253 { AV_CODEC_ID_PCM_S8_PLANAR
, MKTAG('P', 'S', 'P', 8 ) },
254 { AV_CODEC_ID_PCM_S16BE_PLANAR
, MKTAG(16 , 'P', 'S', 'P') },
255 { AV_CODEC_ID_PCM_S16LE_PLANAR
, MKTAG('P', 'S', 'P', 16 ) },
256 { AV_CODEC_ID_PCM_S24LE_PLANAR
, MKTAG('P', 'S', 'P', 24 ) },
257 { AV_CODEC_ID_PCM_S32LE_PLANAR
, MKTAG('P', 'S', 'P', 32 ) },
258 { AV_CODEC_ID_NONE
, 0 }
261 const AVCodecTag
* const ff_nut_codec_tags
[] = {
262 ff_nut_video_tags
, ff_nut_audio_tags
, ff_nut_subtitle_tags
,
263 ff_codec_bmp_tags
, ff_codec_wav_tags
, ff_nut_audio_extra_tags
, ff_nut_data_tags
, 0
266 void ff_nut_reset_ts(NUTContext
*nut
, AVRational time_base
, int64_t val
)
269 for (i
= 0; i
< nut
->avf
->nb_streams
; i
++)
270 nut
->stream
[i
].last_pts
=
272 time_base
.num
* (int64_t)nut
->stream
[i
].time_base
->den
,
273 time_base
.den
* (int64_t)nut
->stream
[i
].time_base
->num
,
277 int64_t ff_lsb2full(StreamContext
*stream
, int64_t lsb
)
279 int64_t mask
= (1ULL << stream
->msb_pts_shift
) - 1;
280 int64_t delta
= stream
->last_pts
- mask
/ 2;
281 return ((lsb
- delta
) & mask
) + delta
;
284 int ff_nut_sp_pos_cmp(const void *a
, const void *b
)
286 const Syncpoint
*va
= a
, *vb
= b
;
287 return ((va
->pos
- vb
->pos
) >> 32) - ((vb
->pos
- va
->pos
) >> 32);
290 int ff_nut_sp_pts_cmp(const void *a
, const void *b
)
292 const Syncpoint
*va
= a
, *vb
= b
;
293 return ((va
->ts
- vb
->ts
) >> 32) - ((vb
->ts
- va
->ts
) >> 32);
296 int ff_nut_add_sp(NUTContext
*nut
, int64_t pos
, int64_t back_ptr
, int64_t ts
)
298 Syncpoint
*sp
= av_mallocz(sizeof(Syncpoint
));
299 struct AVTreeNode
*node
= av_tree_node_alloc();
304 return AVERROR(ENOMEM
);
310 sp
->back_ptr
= back_ptr
;
312 av_tree_insert(&nut
->syncpoints
, sp
, ff_nut_sp_pos_cmp
, &node
);
321 static int enu_free(void *opaque
, void *elem
)
327 void ff_nut_free_sp(NUTContext
*nut
)
329 if (nut
->syncpoints
) {
330 av_tree_enumerate(nut
->syncpoints
, NULL
, NULL
, enu_free
);
331 av_tree_destroy(nut
->syncpoints
);
335 const Dispositions ff_nut_dispositions
[] = {
336 { "default", AV_DISPOSITION_DEFAULT
},
337 { "dub", AV_DISPOSITION_DUB
},
338 { "original", AV_DISPOSITION_ORIGINAL
},
339 { "comment", AV_DISPOSITION_COMMENT
},
340 { "lyrics", AV_DISPOSITION_LYRICS
},
341 { "karaoke", AV_DISPOSITION_KARAOKE
},
345 const AVMetadataConv ff_nut_metadata_conv
[] = {
346 { "Author", "artist" },
347 { "X-CreationTime", "date" },
348 { "CreationTime", "date" },
349 { "SourceFilename", "filename" },
350 { "X-Language", "language" },
351 { "X-Disposition", "disposition" },
352 { "X-Replaces", "replaces" },
353 { "X-Depends", "depends" },
354 { "X-Uses", "uses" },
355 { "X-UsesFont", "usesfont" },