Lines Matching refs:bc
41 static int get_str(AVIOContext *bc, char *string, unsigned int maxlen)
43 unsigned int len = ffio_read_varlen(bc);
46 avio_read(bc, string, FFMIN(len, maxlen));
48 avio_r8(bc);
61 static int64_t get_s(AVIOContext *bc)
63 int64_t v = ffio_read_varlen(bc) + 1;
71 static uint64_t get_fourcc(AVIOContext *bc)
73 unsigned int len = ffio_read_varlen(bc);
76 return avio_rl16(bc);
78 return avio_rl32(bc);
86 static inline uint64_t get_v_trace(AVIOContext *bc, const char *file,
89 uint64_t v = ffio_read_varlen(bc);
96 static inline int64_t get_s_trace(AVIOContext *bc, const char *file,
99 int64_t v = get_s(bc);
106 static inline uint64_t get_4cc_trace(AVIOContext *bc, char *file,
109 uint64_t v = get_fourcc(bc);
115 #define ffio_read_varlen(bc) get_v_trace(bc, __FILE__, __PRETTY_FUNCTION__, __LINE__)
116 #define get_s(bc) get_s_trace(bc, __FILE__, __PRETTY_FUNCTION__, __LINE__)
117 #define get_fourcc(bc) get_4cc_trace(bc, __FILE__, __PRETTY_FUNCTION__, __LINE__)
120 static int get_packetheader(NUTContext *nut, AVIOContext *bc,
124 // start = avio_tell(bc) - 8;
129 ffio_init_checksum(bc, ff_crc04C11DB7_update, startcode);
130 size = ffio_read_varlen(bc);
132 avio_rb32(bc);
133 if (ffio_get_checksum(bc) && size > 4096)
136 ffio_init_checksum(bc, calculate_checksum ? ff_crc04C11DB7_update : NULL, 0);
141 static uint64_t find_any_startcode(AVIOContext *bc, int64_t pos)
148 avio_seek(bc, pos, SEEK_SET);
149 while (!url_feof(bc)) {
150 state = (state << 8) | avio_r8(bc);
172 static int64_t find_startcode(AVIOContext *bc, uint64_t code, int64_t pos)
175 uint64_t startcode = find_any_startcode(bc, pos);
177 return avio_tell(bc) - 8;
199 tmp = ffio_read_varlen(bc); \
207 static int skip_reserved(AVIOContext *bc, int64_t pos)
209 pos -= avio_tell(bc);
211 avio_seek(bc, pos, SEEK_CUR);
215 avio_r8(bc);
223 AVIOContext *bc = s->pb;
229 end = get_packetheader(nut, bc, 1, MAIN_STARTCODE);
230 end += avio_tell(bc);
232 nut->version = ffio_read_varlen(bc);
240 nut->minor_version = ffio_read_varlen(bc);
244 nut->max_distance = ffio_read_varlen(bc);
268 int tmp_flags = ffio_read_varlen(bc);
269 int tmp_fields = ffio_read_varlen(bc);
272 tmp_pts = get_s(bc);
274 tmp_mul = ffio_read_varlen(bc);
276 tmp_stream = ffio_read_varlen(bc);
278 tmp_size = ffio_read_varlen(bc);
282 tmp_res = ffio_read_varlen(bc);
286 count = ffio_read_varlen(bc);
290 get_s(bc);
292 tmp_head_idx = ffio_read_varlen(bc);
295 ffio_read_varlen(bc);
323 if (end > avio_tell(bc) + 4) {
338 avio_read(bc, hdr, nut->header_len[i]);
345 if (nut->version > 3 && end > avio_tell(bc) + 4) {
346 nut->flags = ffio_read_varlen(bc);
349 if (skip_reserved(bc, end) || ffio_get_checksum(bc)) {
366 AVIOContext *bc = s->pb;
372 end = get_packetheader(nut, bc, 1, STREAM_STARTCODE);
373 end += avio_tell(bc);
381 class = ffio_read_varlen(bc);
382 tmp = get_fourcc(bc);
424 stc->max_pts_distance = ffio_read_varlen(bc);
427 ffio_read_varlen(bc); // stream flags
431 if (ff_get_extradata(st->codec, bc, st->codec->extradata_size) < 0)
438 st->sample_aspect_ratio.num = ffio_read_varlen(bc);
439 st->sample_aspect_ratio.den = ffio_read_varlen(bc);
445 ffio_read_varlen(bc); /* csp type */
448 ffio_read_varlen(bc); // samplerate_den
451 if (skip_reserved(bc, end) || ffio_get_checksum(bc)) {
480 AVIOContext *bc = s->pb;
491 end = get_packetheader(nut, bc, 1, INFO_STARTCODE);
492 end += avio_tell(bc);
495 chapter_id = get_s(bc);
496 chapter_start = ffio_read_varlen(bc);
497 chapter_len = ffio_read_varlen(bc);
498 count = ffio_read_varlen(bc);
514 get_str(bc, name, sizeof(name));
515 value = get_s(bc);
518 get_str(bc, str_value, sizeof(str_value));
520 get_str(bc, type_str, sizeof(type_str));
522 get_str(bc, str_value, sizeof(str_value));
525 value = get_s(bc);
528 value = ffio_read_varlen(bc);
531 get_s(bc);
560 if (skip_reserved(bc, end) || ffio_get_checksum(bc)) {
570 AVIOContext *bc = s->pb;
575 nut->last_syncpoint_pos = avio_tell(bc) - 8;
577 end = get_packetheader(nut, bc, 1, SYNCPOINT_STARTCODE);
578 end += avio_tell(bc);
580 tmp = ffio_read_varlen(bc);
581 *back_ptr = nut->last_syncpoint_pos - 16 * ffio_read_varlen(bc);
589 tmp = ffio_read_varlen(bc);
596 if (skip_reserved(bc, end) || ffio_get_checksum(bc)) {
626 AVIOContext *bc = s->pb;
629 int64_t filesize = avio_size(bc);
638 avio_seek(bc, filesize - 12, SEEK_SET);
639 avio_seek(bc, filesize - avio_rb64(bc), SEEK_SET);
640 if (avio_rb64(bc) != INDEX_STARTCODE) {
648 end = get_packetheader(nut, bc, 1, INDEX_STARTCODE);
649 end += avio_tell(bc);
651 max_pts = ffio_read_varlen(bc);
665 syncpoints[i] = ffio_read_varlen(bc);
675 uint64_t x = ffio_read_varlen(bc);
706 uint64_t B, A = ffio_read_varlen(bc);
708 A = ffio_read_varlen(bc);
709 B = ffio_read_varlen(bc);
721 if (skip_reserved(bc, end) || ffio_get_checksum(bc)) {
736 AVIOContext *bc = s->pb;
745 pos = find_startcode(bc, MAIN_STARTCODE, pos) + 1;
755 pos = find_startcode(bc, STREAM_STARTCODE, pos) + 1;
767 uint64_t startcode = find_any_startcode(bc, pos);
768 pos = avio_tell(bc);
785 if (bc->seekable) {
786 int64_t orig_pos = avio_tell(bc);
788 avio_seek(bc, orig_pos, SEEK_SET);
797 static int read_sm_data(AVFormatContext *s, AVIOContext *bc, AVPacket *pkt, int is_meta, int64_t maxpos)
799 int count = ffio_read_varlen(bc);
812 if (avio_tell(bc) >= maxpos)
814 get_str(bc, name, sizeof(name));
815 value = get_s(bc);
818 get_str(bc, str_value, sizeof(str_value));
824 get_str(bc, type_str, sizeof(type_str));
825 value_len = ffio_read_varlen(bc);
826 if (avio_tell(bc) + value_len >= maxpos)
839 channel_layout = avio_rl64(bc);
843 avio_skip(bc, value_len);
848 avio_read(bc, dst, value_len);
850 value = get_s(bc);
852 value = ffio_read_varlen(bc);
854 get_s(bc);
911 AVIOContext *bc = s->pb;
917 avio_tell(bc) > nut->last_syncpoint_pos + nut->max_distance) {
920 avio_tell(bc), nut->last_syncpoint_pos, nut->max_distance);
935 flags ^= ffio_read_varlen(bc);
941 int coded_pts = ffio_read_varlen(bc);
950 size += size_mul * ffio_read_varlen(bc);
952 get_s(bc);
954 *header_idx = ffio_read_varlen(bc);
956 reserved_count = ffio_read_varlen(bc);
958 ffio_read_varlen(bc);
969 avio_rb32(bc); // FIXME check this
986 AVIOContext *bc = s->pb;
1009 avio_skip(bc, size);
1016 pkt->pos = avio_tell(bc); // FIXME
1019 if (read_sm_data(s, bc, pkt, 0, pkt->pos + size) < 0)
1021 if (read_sm_data(s, bc, pkt, 1, pkt->pos + size) < 0)
1023 sm_size = avio_tell(bc) - pkt->pos;
1028 ret = avio_read(bc, pkt->data + nut->header_len[header_idx], size);
1046 AVIOContext *bc = s->pb;
1051 int64_t pos = avio_tell(bc);
1058 frame_code = avio_r8(bc);
1059 if (url_feof(bc))
1064 tmp = (tmp << 8) + avio_r8(bc);
1071 skip = get_packetheader(nut, bc, 0, tmp);
1072 avio_skip(bc, skip);
1081 frame_code = avio_r8(bc);
1091 tmp = find_any_startcode(bc, nut->last_syncpoint_pos + 1);
1104 AVIOContext *bc = s->pb;
1111 pos = find_startcode(bc, SYNCPOINT_STARTCODE, pos) + 1;