1 /*
2 * "NUT" Container Format demuxer
3 * Copyright (c) 2004-2006 Michael Niedermayer
4 * Copyright (c) 2003 Alex Beregszaszi
5 *
6 * This file is part of FFmpeg.
7 *
8 * FFmpeg is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * FFmpeg is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with FFmpeg; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
35
36 #define NUT_MAX_STREAMS 256 /* arbitrary sanity check value */
37
39 int64_t *pos_arg, int64_t pos_limit);
40
42 {
44
45 if (len && maxlen)
47 while (len > maxlen) {
49 len--;
51 len = maxlen;
52 }
53
54 if (maxlen)
55 string[
FFMIN(len, maxlen - 1)] = 0;
56
59 if (maxlen == len)
60 return -1;
61 else
62 return 0;
63 }
64
66 {
68
69 if (v & 1)
70 return -(v >> 1);
71 else
72 return (v >> 1);
73 }
74
76 {
78
79 if (len == 2)
81 else if (len == 4)
83 else {
85 return -1;
86 }
87 }
88
89 #ifdef TRACE
90 static inline uint64_t get_v_trace(
AVIOContext *bc,
const char *file,
92 {
94
96 v, v, file, func, line);
97 return v;
98 }
99
100 static inline int64_t get_s_trace(
AVIOContext *bc,
const char *file,
102 {
103 int64_t v =
get_s(bc);
104
106 v, v, file, func, line);
107 return v;
108 }
109
110 static inline uint64_t get_4cc_trace(
AVIOContext *bc,
char *file,
112 {
114
116 v, v, file, func, line);
117 return v;
118 }
119 #define ffio_read_varlen(bc) get_v_trace(bc, __FILE__, __PRETTY_FUNCTION__, __LINE__)
120 #define get_s(bc) get_s_trace(bc, __FILE__, __PRETTY_FUNCTION__, __LINE__)
121 #define get_fourcc(bc) get_4cc_trace(bc, __FILE__, __PRETTY_FUNCTION__, __LINE__)
122 #endif
123
125 int calculate_checksum, uint64_t startcode)
126 {
128 // start = avio_tell(bc) - 8;
129
132
135 if (size > 4096)
138 return -1;
139
141
143 }
144
146 {
148
149 if (pos >= 0)
150 /* Note, this may fail if the stream is not seekable, but that should
151 * not matter, as in this case we simply start where we currently are */
154 state = (state << 8) |
avio_r8(bc);
155 if ((state >> 56) != 'N')
156 continue;
157 switch (state) {
164 }
165 }
166
167 return 0;
168 }
169
170 /**
171 * Find the given startcode.
172 * @param code the startcode
173 * @param pos the start position of the search, or -1 if the current position
174 * @return the position of the startcode or -1 if not found
175 */
177 {
178 for (;;) {
180 if (startcode == code)
182 else if (startcode == 0)
183 return -1;
184 pos = -1;
185 }
186 }
187
189 {
190 int i;
191
192 for (i = 0; i < p->
buf_size-8; i++) {
194 continue;
197 }
198 return 0;
199 }
200
201 #define GET_V(dst, check) \
202 do { \
203 tmp = ffio_read_varlen(bc); \
204 if (!(check)) { \
205 av_log(s, AV_LOG_ERROR, "Error " #dst " is (%"PRId64")\n", tmp); \
206 ret = AVERROR_INVALIDDATA; \
207 goto fail; \
208 } \
209 dst = tmp; \
210 } while (0)
211
213 {
215 if (pos < 0) {
218 } else {
219 while (pos--) {
223 }
224 return 0;
225 }
226 }
227
229 {
233 unsigned int stream_count;
234 int i, j,
count, ret;
235 int tmp_stream, tmp_mul, tmp_pts, tmp_size, tmp_res, tmp_head_idx;
236
239
246 }
249
251
256 }
257
262
272 }
273 }
274 tmp_pts = 0;
275 tmp_mul = 1;
276 tmp_stream = 0;
277 tmp_head_idx = 0;
278 for (i = 0; i < 256;) {
281
282 if (tmp_fields > 0)
284 if (tmp_fields > 1)
286 if (tmp_fields > 2)
288 if (tmp_fields > 3)
290 else
291 tmp_size = 0;
292 if (tmp_fields > 4)
294 else
295 tmp_res = 0;
296 if (tmp_fields > 5)
298 else
299 count = tmp_mul - tmp_size;
300 if (tmp_fields > 6)
302 if (tmp_fields > 7)
304
305 while (tmp_fields-- > 8) {
310 }
312 }
313
318 }
319 if (tmp_stream >= stream_count) {
321 tmp_stream, stream_count);
324 }
325
326 for (j = 0; j <
count; j++, i++) {
327 if (i == 'N') {
329 j--;
330 continue;
331 }
339 }
340 }
342
344 int rem = 1024;
350 if (rem < nut->header_len[i]) {
352 "invalid elision header %d : %d > %d\n",
356 }
359 if (!hdr) {
362 }
365 }
367 }
368
369 // flags had been effectively introduced in version 4
372 }
373
378 }
379
384 }
385 for (i = 0; i < stream_count; i++)
387
388 return 0;
393 }
395 return ret;
396 }
397
399 {
403 int class, stream_id, ret;
406
409
411 stc = &nut->
stream[stream_id];
413 if (!st)
415
416 class = ffio_read_varlen(bc);
419 switch (class) {
420 case 0:
426 0
427 },
428 tmp);
429 break;
430 case 1:
436 0
437 },
438 tmp);
439 break;
440 case 2:
443 break;
444 case 3:
447 break;
448 default:
451 }
454 "Unknown codec tag '0x%04x' for stream number %d\n",
455 (unsigned int) tmp, stream_id);
456
460 GET_V(stc->
decode_delay, tmp < 1000);
// sanity limit, raise this if Moore's law is true
463
468 }
469
480 }
486 }
489 "stream header %d checksum mismatch\n", stream_id);
492 }
496 return 0;
498 if (st && st->
codec) {
501 }
502 return ret;
503 }
504
506 int stream_id)
507 {
509
513 if (!flag)
516 if (stream_id == i || stream_id == -1)
518 }
519
521 {
524 uint64_t tmp, chapter_start, chapter_len;
525 unsigned int stream_id_plus1,
count;
526 int chapter_id, i, ret = 0;
528 char name[256], str_value[1024], type_str[256];
530 int *event_flags =
NULL;
534 int metadata_flag = 0;
535
538
540 chapter_id =
get_s(bc);
544
545 if (chapter_id && !stream_id_plus1) {
550 start, start + chapter_len,
NULL);
551 if (!chapter) {
554 }
556 } else if (stream_id_plus1) {
557 st = s->
streams[stream_id_plus1 - 1];
561 } else {
565 }
566
567 for (i = 0; i <
count; i++) {
568 ret =
get_str(bc, name,
sizeof(name));
569 if (ret < 0) {
571 return ret;
572 }
574 str_value[0] = 0;
575
576 if (value == -1) {
577 type = "UTF-8";
578 ret =
get_str(bc, str_value,
sizeof(str_value));
579 } else if (value == -2) {
580 ret =
get_str(bc, type_str,
sizeof(type_str));
581 if (ret < 0) {
583 return ret;
584 }
585 type = type_str;
586 ret =
get_str(bc, str_value,
sizeof(str_value));
587 } else if (value == -3) {
588 type = "s";
590 } else if (value == -4) {
591 type = "t";
593 } else if (value < -4) {
594 type = "r";
596 } else {
597 type = "v";
598 }
599
600 if (ret < 0) {
602 return ret;
603 }
604
607 "invalid stream id %d for info packet\n",
608 stream_id_plus1);
609 continue;
610 }
611
612 if (!strcmp(type, "UTF-8")) {
613 if (chapter_id == 0 && !strcmp(name, "Disposition")) {
615 continue;
616 }
617
618 if (stream_id_plus1 && !strcmp(name, "r_frame_rate")) {
623 continue;
624 }
625
628 if (event_flags)
629 *event_flags |= metadata_flag;
631 }
632 }
633 }
634
638 }
640 return FFMIN(ret, 0);
641 }
642
644 {
648 uint64_t tmp;
649 int ret;
650
652
655
658 if (*back_ptr < 0)
660
663
670 }
671
675 }
676
679
681 return ret;
682
683 return 0;
684 }
685
686 //FIXME calculate exactly, this is just a good approximation.
688 {
691
693
694 if(duration > 0)
697 }
698
700 {
704 int i, j, syncpoint_count;
706 int64_t *syncpoints =
NULL;
707 uint64_t max_pts;
708 int8_t *has_keyframe =
NULL;
710
711 if(filesize <= 0)
712 return -1;
713
718
721 return ret;
722 }
723
726
732
733 GET_V(syncpoint_count, tmp < INT_MAX / 8 && tmp > 0);
736 if (!syncpoints || !has_keyframe) {
739 }
740 for (i = 0; i < syncpoint_count; i++) {
742 if (syncpoints[i] <= 0)
744 if (i)
745 syncpoints[i] += syncpoints[i - 1];
746 }
747
750 for (j = 0; j < syncpoint_count;) {
754 x >>= 1;
755 if (type) {
757 x >>= 1;
758 if (n + x >= syncpoint_count + 1) {
759 av_log(s,
AV_LOG_ERROR,
"index overflow A %d + %"PRIu64
" >= %d\n", n, x, syncpoint_count + 1);
761 }
762 while (x--)
763 has_keyframe[n++] =
flag;
764 has_keyframe[n++] = !
flag;
765 } else {
766 if (x <= 1) {
769 }
770 while (x != 1) {
771 if (n >= syncpoint_count + 1) {
774 }
775 has_keyframe[n++] = x & 1;
776 x >>= 1;
777 }
778 }
779 if (has_keyframe[0]) {
782 }
784 for (; j < n && j < syncpoint_count; j++) {
785 if (has_keyframe[j]) {
787 if (!A) {
790 // eor_pts[j][i] = last_pts + A + B
791 } else
792 B = 0;
796 }
797 }
798 }
799 }
800
804 }
805 ret = 0;
806
810 return ret;
811 }
812
814 {
816 int i;
817
823
824 return 0;
825 }
826
828 {
831 int64_t pos;
832 int initialized_stream_count;
833
835
836 /* main header */
837 pos = 0;
838 do {
840 if (pos < 0 + 1) {
843 }
845
846 /* stream headers */
847 pos = 0;
848 for (initialized_stream_count = 0; initialized_stream_count < s->
nb_streams;) {
850 if (pos < 0 + 1) {
853 }
855 initialized_stream_count++;
856 }
857
858 /* info headers */
859 pos = 0;
860 for (;;) {
863
864 if (startcode == 0) {
869 break;
871 continue;
872 }
873
875 }
876
878
883 }
885
887
888 return 0;
889
892
894 }
895
897 {
899 int skip_start = 0;
900 int skip_end = 0;
901 int channels = 0;
902 int64_t channel_layout = 0;
906 int i, ret;
907
908 for (i=0; i<
count; i++) {
913 ret =
get_str(bc, name,
sizeof(name));
914 if (ret < 0) {
916 return ret;
917 }
919
920 if (value == -1) {
921 ret =
get_str(bc, str_value,
sizeof(str_value));
922 if (ret < 0) {
924 return ret;
925 }
927 } else if (value == -2) {
929 int64_t v64, value_len;
930
931 ret =
get_str(bc, type_str,
sizeof(type_str));
932 if (ret < 0) {
934 return ret;
935 }
937 if (value_len < 0 || value_len >= maxpos -
avio_tell(bc))
939 if (!strcmp(name, "Palette")) {
941 } else if (!strcmp(name, "Extradata")) {
943 } else if (sscanf(name, "CodecSpecificSide%"SCNd64"", &v64) == 1) {
945 if(!dst)
948 dst += 8;
949 } else if (!strcmp(name, "ChannelLayout") && value_len == 8) {
951 continue;
952 } else {
955 continue;
956 }
957 if(!dst)
960 } else if (value == -3) {
962 } else if (value == -4) {
964 } else if (value < -4) {
966 } else {
967 if (!strcmp(name, "SkipStart")) {
969 } else if (!strcmp(name, "SkipEnd")) {
971 } else if (!strcmp(name, "Channels")) {
973 } else if (!strcmp(name, "SampleRate")) {
975 } else if (!strcmp(name, "Width")) {
977 } else if (!strcmp(name, "Height")) {
979 } else {
981 }
982 }
983 }
984
985 if (channels || channel_layout || sample_rate || width || height) {
987 if (!dst)
989 bytestream_put_le32(&dst,
994 );
995 if (channels)
996 bytestream_put_le32(&dst, channels);
997 if (channel_layout)
998 bytestream_put_le64(&dst, channel_layout);
999 if (sample_rate)
1000 bytestream_put_le32(&dst, sample_rate);
1001 if (width || height){
1002 bytestream_put_le32(&dst, width);
1003 bytestream_put_le32(&dst, height);
1004 }
1005 }
1006
1007 if (skip_start || skip_end) {
1009 if (!dst)
1013 }
1014
1017
1018 return 0;
1019 }
1020
1022 uint8_t *header_idx,
int frame_code)
1023 {
1027 int size,
flags, size_mul, pts_delta, i, reserved_count, ret;
1028 uint64_t tmp;
1029
1033 "Last frame must have been damaged %"PRId64" > %"PRId64" + %d\n",
1036 }
1037
1045
1052 }
1053 stc = &nut->
stream[*stream_id];
1056 // FIXME check last_pts validity?
1059 } else
1061 } else
1071 for (i = 0; i < reserved_count; i++) {
1075 }
1077 }
1078
1082 }
1083 if (size > 4096)
1084 *header_idx = 0;
1086
1094 }
1095
1098
1101 return ret;
1102 }
1103
1105 {
1108 int size, stream_id, discard, ret;
1109 int64_t
pts, last_IP_pts;
1112
1114 if (size < 0)
1116
1117 stc = &nut->
stream[stream_id];
1118
1121
1126 last_IP_pts > pts) ||
1130 return 1;
1131 }
1132
1134 if (ret < 0)
1135 return ret;
1136 if (nut->
header[header_idx])
1140 int sm_size;
1144 }
1148 }
1150 size -= sm_size;
1151 pkt->
size -= sm_size;
1152 }
1153
1155 if (ret != size) {
1156 if (ret < 0)
1158 }
1160
1165
1166 return 0;
1169 return ret;
1170 }
1171
1173 {
1176 int i, frame_code = 0, ret, skip;
1177 int64_t ts, back_ptr;
1178
1179 for (;;) {
1183
1184 if (tmp) {
1185 pos -= 8;
1186 } else {
1190 if (frame_code == 'N') {
1191 tmp = frame_code;
1192 for (i = 1; i < 8; i++)
1193 tmp = (tmp << 8) +
avio_r8(bc);
1194 }
1195 }
1196 switch (tmp) {
1202 break;
1206 break;
1211 case 0:
1213 if (ret == 0)
1214 return 0;
1215 else if (ret == 1) // OK but discard packet
1216 break;
1217 default:
1222 if (tmp == 0)
1226 }
1227 }
1228 }
1229
1231 int64_t *pos_arg, int64_t pos_limit)
1232 {
1235 int64_t pos,
pts, back_ptr;
1237 stream_index, *pos_arg, pos_limit);
1238
1239 pos = *pos_arg;
1240 do {
1242 if (pos < 1) {
1245 }
1247 *pos_arg = pos - 1;
1249
1251 if (stream_index == -2)
1252 return back_ptr;
1255 }
1256
1259 {
1264 Syncpoint *
sp, *next_node[2] = { &nopts_sp, &nopts_sp };
1265 int64_t pos, pos2, ts;
1266 int i;
1267
1270 }
1271
1274 if (index < 0)
1276 if (index < 0)
1277 return -1;
1278
1281 } else {
1283 (void **) next_node);
1285 next_node[0]->pos, next_node[1]->pos, next_node[0]->ts,
1286 next_node[1]->ts);
1288 next_node[1]->
pos, next_node[1]->
pos,
1289 next_node[0]->
ts, next_node[1]->
ts,
1291 if (pos < 0)
1292 return pos;
1293
1295 dummy.
pos = pos + 16;
1296 next_node[1] = &nopts_sp;
1298 (void **) next_node);
1300 next_node[1]->
pos, next_node[1]->
pos,
1303 if (pos2 >= 0)
1304 pos = pos2;
1305 // FIXME dir but I think it does not matter
1306 }
1310
1313 }
1319 if (pos2 > pos || pos2 + 15 < pos)
1323
1325
1326 return 0;
1327 }
1328
1339 .extensions = "nut",
1341 };
uint64_t ffio_read_varlen(AVIOContext *bc)
discard all frames except keyframes
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
int64_t avio_size(AVIOContext *s)
Get the filesize.
int64_t last_syncpoint_pos
int av_add_index_entry(AVStream *st, int64_t pos, int64_t timestamp, int size, int distance, int flags)
Add an index entry into a sorted list.
enum AVDurationEstimationMethod duration_estimation_method
The duration field can be estimated through various ways, and this field can be used to know how the ...
#define AV_LOG_WARNING
Something somehow does not look correct.
int64_t pos
byte position in stream, -1 if unknown
void av_shrink_packet(AVPacket *pkt, int size)
Reduce packet size, correctly zeroing padding.
const AVCodecTag ff_nut_audio_extra_tags[]
int event_flags
Flags for the user to detect events happening on the stream.
static int get_str(AVIOContext *bc, char *string, unsigned int maxlen)
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown)
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
AVIndexEntry * index_entries
Only used if the format does not support seeking natively.
AVFormatInternal * internal
An opaque field for libavformat internal usage.
int event_flags
Flags for the user to detect events happening on the file.
static void set_disposition_bits(AVFormatContext *avf, char *value, int stream_id)
void * av_tree_find(const AVTreeNode *t, void *key, int(*cmp)(const void *key, const void *b), void *next[2])
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
int ff_nut_sp_pos_cmp(const void *a, const void *b)
static int decode_main_header(NUTContext *nut)
const uint8_t * header[128]
static int decode_frame_header(NUTContext *nut, int64_t *pts, int *stream_id, uint8_t *header_idx, int frame_code)
static int64_t nut_read_timestamp(AVFormatContext *s, int stream_index, int64_t *pos_arg, int64_t pos_limit)
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Opaque data information usually continuous.
static int nut_probe(AVProbeData *p)
enum AVCodecID av_codec_get_id(const struct AVCodecTag *const *tags, unsigned int tag)
Get the AVCodecID for the given codec tag tag.
const AVCodecTag ff_codec_movvideo_tags[]
unsigned int avio_rb32(AVIOContext *s)
static av_cold int end(AVCodecContext *avctx)
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_RB32
AVStream ** streams
A list of all streams in the file.
const AVMetadataConv ff_nut_metadata_conv[]
static double av_q2d(AVRational a)
Convert rational to double.
static int decode_frame(NUTContext *nut, AVPacket *pkt, int frame_code)
int ff_nut_sp_pts_cmp(const void *a, const void *b)
#define AVERROR_EOF
End of file.
static av_cold int read_close(AVFormatContext *ctx)
#define AV_LOG_VERBOSE
Detailed information.
const AVCodecTag ff_nut_data_tags[]
uint64_t avio_rb64(AVIOContext *s)
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
AVDictionary * metadata
Metadata that applies to the whole file.
int has_b_frames
Size of the frame reordering buffer in the decoder.
void ff_nut_free_sp(NUTContext *nut)
int av_index_search_timestamp(AVStream *st, int64_t timestamp, int flags)
Get the index for a specific timestamp.
unsigned int avio_rl32(AVIOContext *s)
discard all bidirectional frames
An AV_PKT_DATA_PARAM_CHANGE side data packet is laid out as follows:
int64_t timestamp
Timestamp in AVStream.time_base units, preferably the time from which on correctly decoded frames are...
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
simple assert() macros that are a bit more flexible than ISO C assert().
int64_t av_gcd(int64_t a, int64_t b)
Compute the greatest common divisor of a and b.
static int nut_read_packet(AVFormatContext *s, AVPacket *pkt)
const AVCodecTag ff_nut_audio_tags[]
static int decode_stream_header(NUTContext *nut)
const AVCodecTag ff_codec_wav_tags[]
int flags
A combination of AV_PKT_FLAG values.
int avio_r8(AVIOContext *s)
AVCodecContext * codec
Codec context associated with this stream.
static int nut_read_close(AVFormatContext *s)
int buf_size
Size of buf except extra allocated bytes.
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
void ffio_init_checksum(AVIOContext *s, unsigned long(*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len), unsigned long checksum)
int seekable
A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable.
void ff_nut_reset_ts(NUTContext *nut, AVRational time_base, int64_t val)
#define AV_TIME_BASE
Internal time base represented as integer.
const AVCodecTag ff_codec_bmp_tags[]
int av_strcasecmp(const char *a, const char *b)
Locale-independent case-insensitive compare.
int width
picture width / height.
static uint64_t find_any_startcode(AVIOContext *bc, int64_t pos)
GLsizei GLboolean const GLfloat * value
unsigned long ff_crc04C11DB7_update(unsigned long checksum, const uint8_t *buf, unsigned int len)
static int find_and_decode_index(NUTContext *nut)
int64_t ff_lsb2full(StreamContext *stream, int64_t lsb)
internal header for RIFF based (de)muxers do NOT include this in end user applications ...
static uint64_t get_fourcc(AVIOContext *bc)
static int get_packetheader(NUTContext *nut, AVIOContext *bc, int calculate_checksum, uint64_t startcode)
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
struct AVTreeNode * syncpoints
static int nut_read_header(AVFormatContext *s)
static int read_header(FFV1Context *f)
static int decode_syncpoint(NUTContext *nut, int64_t *ts, int64_t *back_ptr)
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
static int read_sm_data(AVFormatContext *s, AVIOContext *bc, AVPacket *pkt, int is_meta, int64_t maxpos)
#define AV_LOG_INFO
Standard information.
enum AVMediaType codec_type
const AVCodecTag ff_nut_subtitle_tags[]
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
int sample_rate
samples per second
AVIOContext * pb
I/O context.
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
Data found in BlockAdditional element of matroska container.
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
#define GET_V(dst, check)
BYTE int const BYTE int int int height
rational number numerator/denominator
Recommmends skipping the specified number of samples.
unsigned long ffio_get_checksum(AVIOContext *s)
int(* func)(AVBPrint *dst, const char *in, const char *arg)
static int skip_reserved(AVIOContext *bc, int64_t pos)
static int64_t find_startcode(AVIOContext *bc, uint64_t code, int64_t pos)
Find the given startcode.
This structure contains the data a format has to probe a file.
static int read_seek(AVFormatContext *s, int stream_index, int64_t pts, int flags)
void * av_calloc(size_t nmemb, size_t size)
Allocate a block of nmemb * size bytes with alignment suitable for all memory accesses (including vec...
static int64_t pts
Global timestamp for the audio frames.
static int64_t find_duration(NUTContext *nut, int64_t filesize)
const Dispositions ff_nut_dispositions[]
unsigned int avio_rl16(AVIOContext *s)
static int decode_info_header(NUTContext *nut)
FrameCode frame_code[256]
int disposition
AV_DISPOSITION_* bit field.
const AVCodecTag ff_nut_video_tags[]
int ff_nut_add_sp(NUTContext *nut, int64_t pos, int64_t back_ptr, int64_t ts)
#define SYNCPOINT_STARTCODE
int eof_reached
true if eof reached
AVInputFormat ff_nut_demuxer
int channels
number of audio channels
static int64_t get_s(AVIOContext *bc)
void * priv_data
Format private data.
int64_t duration
Duration of the stream, in AV_TIME_BASE fractional seconds.
#define av_malloc_array(a, b)
int avio_feof(AVIOContext *s)
feof() equivalent for AVIOContext.
uint8_t * av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type, int size)
Allocate new information of a packet.
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
enum AVDiscard discard
Selects which packets can be discarded at will and do not need to be demuxed.
AVRational r_frame_rate
Real base framerate of the stream.
const AVCodecTag *const ff_nut_codec_tags[]
This structure stores compressed data.
uint64_t avio_rl64(AVIOContext *s)
unsigned int time_base_count
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
#define AV_NOPTS_VALUE
Undefined timestamp value.
unsigned int max_distance