• Home
  • Raw
  • Download

Lines Matching refs:wf

72     WtvFile *wf = opaque;  in wtvfile_read_packet()  local
73 AVIOContext *pb = wf->pb_filesystem; in wtvfile_read_packet()
76 if (wf->error || pb->error) in wtvfile_read_packet()
78 if (wf->position >= wf->length || avio_feof(pb)) in wtvfile_read_packet()
81 buf_size = FFMIN(buf_size, wf->length - wf->position); in wtvfile_read_packet()
83 … int remaining_in_sector = (1 << wf->sector_bits) - (wf->position & ((1 << wf->sector_bits) - 1)); in wtvfile_read_packet()
91 wf->position += n; in wtvfile_read_packet()
93 int i = wf->position >> wf->sector_bits; in wtvfile_read_packet()
94 if (i >= wf->nb_sectors || in wtvfile_read_packet()
95 … (wf->sectors[i] != wf->sectors[i - 1] + (1 << (wf->sector_bits - WTV_SECTOR_BITS)) && in wtvfile_read_packet()
96 seek_by_sector(pb, wf->sectors[i], 0) < 0)) { in wtvfile_read_packet()
97 wf->error = 1; in wtvfile_read_packet()
110 WtvFile *wf = opaque; in wtvfile_seek() local
111 AVIOContext *pb = wf->pb_filesystem; in wtvfile_seek()
114 return wf->length; in wtvfile_seek()
116 offset = wf->position + offset; in wtvfile_seek()
118 offset = wf->length; in wtvfile_seek()
120 wf->error = offset < 0 || offset >= wf->length || in wtvfile_seek()
121 seek_by_sector(pb, wf->sectors[offset >> wf->sector_bits], in wtvfile_seek()
122 offset & ((1 << wf->sector_bits) - 1)) < 0; in wtvfile_seek()
123 wf->position = offset; in wtvfile_seek()
154 WtvFile *wf; in wtvfile_open_sector() local
161 wf = av_mallocz(sizeof(WtvFile)); in wtvfile_open_sector()
162 if (!wf) in wtvfile_open_sector()
166 wf->sectors = av_malloc(sizeof(uint32_t)); in wtvfile_open_sector()
167 if (!wf->sectors) { in wtvfile_open_sector()
168 av_free(wf); in wtvfile_open_sector()
171 wf->sectors[0] = first_sector; in wtvfile_open_sector()
172 wf->nb_sectors = 1; in wtvfile_open_sector()
174 wf->sectors = av_malloc(WTV_SECTOR_SIZE); in wtvfile_open_sector()
175 if (!wf->sectors) { in wtvfile_open_sector()
176 av_free(wf); in wtvfile_open_sector()
179 wf->nb_sectors = read_ints(s->pb, wf->sectors, WTV_SECTOR_SIZE / 4); in wtvfile_open_sector()
185 wf->sectors = av_malloc_array(nb_sectors1, 1 << WTV_SECTOR_BITS); in wtvfile_open_sector()
186 if (!wf->sectors) { in wtvfile_open_sector()
187 av_free(wf); in wtvfile_open_sector()
190 wf->nb_sectors = 0; in wtvfile_open_sector()
194wf->nb_sectors += read_ints(s->pb, wf->sectors + i * WTV_SECTOR_SIZE / 4, WTV_SECTOR_SIZE / 4); in wtvfile_open_sector()
198 av_free(wf); in wtvfile_open_sector()
201 wf->sector_bits = length & (1ULL<<63) ? WTV_SECTOR_BITS : WTV_BIGSECTOR_BITS; in wtvfile_open_sector()
203 if (!wf->nb_sectors) { in wtvfile_open_sector()
204 av_freep(&wf->sectors); in wtvfile_open_sector()
205 av_freep(&wf); in wtvfile_open_sector()
210 if (size >= 0 && (int64_t)wf->sectors[wf->nb_sectors - 1] << WTV_SECTOR_BITS > size) in wtvfile_open_sector()
215 if (length > ((int64_t)wf->nb_sectors << wf->sector_bits)) { in wtvfile_open_sector()
216 …ds number of available sectors (0x%"PRIx64")\n", length, (int64_t)wf->nb_sectors << wf->sector_bit… in wtvfile_open_sector()
217 length = (int64_t)wf->nb_sectors << wf->sector_bits; in wtvfile_open_sector()
219 wf->length = length; in wtvfile_open_sector()
222 wf->position = 0; in wtvfile_open_sector()
223 if (seek_by_sector(s->pb, wf->sectors[0], 0) < 0) { in wtvfile_open_sector()
224 av_freep(&wf->sectors); in wtvfile_open_sector()
225 av_freep(&wf); in wtvfile_open_sector()
229 wf->pb_filesystem = s->pb; in wtvfile_open_sector()
230 buffer = av_malloc(1 << wf->sector_bits); in wtvfile_open_sector()
232 av_freep(&wf->sectors); in wtvfile_open_sector()
233 av_freep(&wf); in wtvfile_open_sector()
237 pb = avio_alloc_context(buffer, 1 << wf->sector_bits, 0, wf, in wtvfile_open_sector()
241 av_freep(&wf->sectors); in wtvfile_open_sector()
242 av_freep(&wf); in wtvfile_open_sector()
308 WtvFile *wf = pb->opaque; in wtvfile_close() local
309 av_freep(&wf->sectors); in wtvfile_close()