Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
(cherry picked from commit a2704c9712ad35cc22e7e0d8a79b581c07fa383b)
| ... | ... |
@@ -1365,7 +1365,7 @@ static void print_report(AVFormatContext **output_files, |
| 1365 | 1365 |
|
| 1366 | 1366 |
total_size = url_fsize(oc->pb); |
| 1367 | 1367 |
if(total_size<0) // FIXME improve url_fsize() so it works with non seekable output too |
| 1368 |
- total_size= url_ftell(oc->pb); |
|
| 1368 |
+ total_size= avio_tell(oc->pb); |
|
| 1369 | 1369 |
|
| 1370 | 1370 |
buf[0] = '\0'; |
| 1371 | 1371 |
ti1 = 1e10; |
| ... | ... |
@@ -2571,7 +2571,7 @@ static int transcode(AVFormatContext **output_files, |
| 2571 | 2571 |
} |
| 2572 | 2572 |
|
| 2573 | 2573 |
/* finish if limit size exhausted */ |
| 2574 |
- if (limit_filesize != 0 && limit_filesize <= url_ftell(output_files[0]->pb)) |
|
| 2574 |
+ if (limit_filesize != 0 && limit_filesize <= avio_tell(output_files[0]->pb)) |
|
| 2575 | 2575 |
break; |
| 2576 | 2576 |
|
| 2577 | 2577 |
/* read a frame from it and output it in the fifo */ |
| ... | ... |
@@ -2809,7 +2809,7 @@ static void event_loop(void) |
| 2809 | 2809 |
}else if(cur_stream->audio_stream >= 0 && cur_stream->audio_pkt.pos>=0){
|
| 2810 | 2810 |
pos= cur_stream->audio_pkt.pos; |
| 2811 | 2811 |
}else |
| 2812 |
- pos = url_ftell(cur_stream->ic->pb); |
|
| 2812 |
+ pos = avio_tell(cur_stream->ic->pb); |
|
| 2813 | 2813 |
if (cur_stream->ic->bit_rate) |
| 2814 | 2814 |
incr *= cur_stream->ic->bit_rate / 8.0; |
| 2815 | 2815 |
else |
| ... | ... |
@@ -283,7 +283,7 @@ static int fourxm_read_packet(AVFormatContext *s, |
| 283 | 283 |
return AVERROR(EIO); |
| 284 | 284 |
pkt->stream_index = fourxm->video_stream_index; |
| 285 | 285 |
pkt->pts = fourxm->video_pts; |
| 286 |
- pkt->pos = url_ftell(s->pb); |
|
| 286 |
+ pkt->pos = avio_tell(s->pb); |
|
| 287 | 287 |
memcpy(pkt->data, header, 8); |
| 288 | 288 |
ret = avio_read(s->pb, &pkt->data[8], size); |
| 289 | 289 |
|
| ... | ... |
@@ -232,10 +232,10 @@ static int aiff_read_header(AVFormatContext *s, |
| 232 | 232 |
get_meta(s, "comment" , size); |
| 233 | 233 |
break; |
| 234 | 234 |
case MKTAG('S', 'S', 'N', 'D'): /* Sampled sound chunk */
|
| 235 |
- aiff->data_end = url_ftell(pb) + size; |
|
| 235 |
+ aiff->data_end = avio_tell(pb) + size; |
|
| 236 | 236 |
offset = avio_rb32(pb); /* Offset of sound data */ |
| 237 | 237 |
avio_rb32(pb); /* BlockSize... don't care */ |
| 238 |
- offset += url_ftell(pb); /* Compute absolute data offset */ |
|
| 238 |
+ offset += avio_tell(pb); /* Compute absolute data offset */ |
|
| 239 | 239 |
if (st->codec->block_align) /* Assume COMM already parsed */ |
| 240 | 240 |
goto got_sound; |
| 241 | 241 |
if (url_is_streamed(pb)) {
|
| ... | ... |
@@ -292,7 +292,7 @@ static int aiff_read_packet(AVFormatContext *s, |
| 292 | 292 |
int res, size; |
| 293 | 293 |
|
| 294 | 294 |
/* calculate size of remaining data */ |
| 295 |
- max_size = aiff->data_end - url_ftell(s->pb); |
|
| 295 |
+ max_size = aiff->data_end - avio_tell(s->pb); |
|
| 296 | 296 |
if (max_size <= 0) |
| 297 | 297 |
return AVERROR_EOF; |
| 298 | 298 |
|
| ... | ... |
@@ -45,7 +45,7 @@ static int aiff_write_header(AVFormatContext *s) |
| 45 | 45 |
|
| 46 | 46 |
/* FORM AIFF header */ |
| 47 | 47 |
ffio_wfourcc(pb, "FORM"); |
| 48 |
- aiff->form = url_ftell(pb); |
|
| 48 |
+ aiff->form = avio_tell(pb); |
|
| 49 | 49 |
avio_wb32(pb, 0); /* file length */ |
| 50 | 50 |
ffio_wfourcc(pb, aifc ? "AIFC" : "AIFF"); |
| 51 | 51 |
|
| ... | ... |
@@ -66,7 +66,7 @@ static int aiff_write_header(AVFormatContext *s) |
| 66 | 66 |
avio_wb32(pb, aifc ? 24 : 18); /* size */ |
| 67 | 67 |
avio_wb16(pb, enc->channels); /* Number of channels */ |
| 68 | 68 |
|
| 69 |
- aiff->frames = url_ftell(pb); |
|
| 69 |
+ aiff->frames = avio_tell(pb); |
|
| 70 | 70 |
avio_wb32(pb, 0); /* Number of frames */ |
| 71 | 71 |
|
| 72 | 72 |
if (!enc->bits_per_coded_sample) |
| ... | ... |
@@ -90,7 +90,7 @@ static int aiff_write_header(AVFormatContext *s) |
| 90 | 90 |
|
| 91 | 91 |
/* Sound data chunk */ |
| 92 | 92 |
ffio_wfourcc(pb, "SSND"); |
| 93 |
- aiff->ssnd = url_ftell(pb); /* Sound chunk size */ |
|
| 93 |
+ aiff->ssnd = avio_tell(pb); /* Sound chunk size */ |
|
| 94 | 94 |
avio_wb32(pb, 0); /* Sound samples data size */ |
| 95 | 95 |
avio_wb32(pb, 0); /* Data offset */ |
| 96 | 96 |
avio_wb32(pb, 0); /* Block-size (block align) */ |
| ... | ... |
@@ -118,7 +118,7 @@ static int aiff_write_trailer(AVFormatContext *s) |
| 118 | 118 |
|
| 119 | 119 |
/* Chunks sizes must be even */ |
| 120 | 120 |
int64_t file_size, end_size; |
| 121 |
- end_size = file_size = url_ftell(pb); |
|
| 121 |
+ end_size = file_size = avio_tell(pb); |
|
| 122 | 122 |
if (file_size & 1) {
|
| 123 | 123 |
avio_w8(pb, 0); |
| 124 | 124 |
end_size++; |
| ... | ... |
@@ -154,7 +154,7 @@ static int amr_read_packet(AVFormatContext *s, |
| 154 | 154 |
} |
| 155 | 155 |
|
| 156 | 156 |
pkt->stream_index = 0; |
| 157 |
- pkt->pos= url_ftell(s->pb); |
|
| 157 |
+ pkt->pos= avio_tell(s->pb); |
|
| 158 | 158 |
pkt->data[0]=toc; |
| 159 | 159 |
pkt->duration= enc->codec_id == CODEC_ID_AMR_NB ? 160 : 320; |
| 160 | 160 |
read = avio_read(s->pb, pkt->data+1, size-1); |
| ... | ... |
@@ -160,7 +160,7 @@ static int get_value(AVIOContext *pb, int type){
|
| 160 | 160 |
static void get_tag(AVFormatContext *s, const char *key, int type, int len) |
| 161 | 161 |
{
|
| 162 | 162 |
char *value; |
| 163 |
- int64_t off = url_ftell(s->pb); |
|
| 163 |
+ int64_t off = avio_tell(s->pb); |
|
| 164 | 164 |
|
| 165 | 165 |
if ((unsigned)len >= (UINT_MAX - 1)/2) |
| 166 | 166 |
return; |
| ... | ... |
@@ -225,7 +225,7 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size) |
| 225 | 225 |
return AVERROR(EINVAL); |
| 226 | 226 |
} |
| 227 | 227 |
|
| 228 |
- pos1 = url_ftell(pb); |
|
| 228 |
+ pos1 = avio_tell(pb); |
|
| 229 | 229 |
|
| 230 | 230 |
st = av_new_stream(s, 0); |
| 231 | 231 |
if (!st) |
| ... | ... |
@@ -300,7 +300,7 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size) |
| 300 | 300 |
st->need_parsing = AVSTREAM_PARSE_FULL; |
| 301 | 301 |
} |
| 302 | 302 |
/* We have to init the frame size at some point .... */ |
| 303 |
- pos2 = url_ftell(pb); |
|
| 303 |
+ pos2 = avio_tell(pb); |
|
| 304 | 304 |
if (size >= (pos2 + 8 - pos1 + 24)) {
|
| 305 | 305 |
asf_st->ds_span = avio_r8(pb); |
| 306 | 306 |
asf_st->ds_packet_size = avio_rl16(pb); |
| ... | ... |
@@ -337,7 +337,7 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size) |
| 337 | 337 |
break; |
| 338 | 338 |
} |
| 339 | 339 |
} else if (type == AVMEDIA_TYPE_VIDEO && |
| 340 |
- size - (url_ftell(pb) - pos1 + 24) >= 51) {
|
|
| 340 |
+ size - (avio_tell(pb) - pos1 + 24) >= 51) {
|
|
| 341 | 341 |
avio_rl32(pb); |
| 342 | 342 |
avio_rl32(pb); |
| 343 | 343 |
avio_r8(pb); |
| ... | ... |
@@ -386,7 +386,7 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size) |
| 386 | 386 |
if(st->codec->codec_id == CODEC_ID_H264) |
| 387 | 387 |
st->need_parsing = AVSTREAM_PARSE_FULL_ONCE; |
| 388 | 388 |
} |
| 389 |
- pos2 = url_ftell(pb); |
|
| 389 |
+ pos2 = avio_tell(pb); |
|
| 390 | 390 |
avio_seek(pb, size - (pos2 - pos1 + 24), SEEK_CUR); |
| 391 | 391 |
|
| 392 | 392 |
return 0; |
| ... | ... |
@@ -594,14 +594,14 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 594 | 594 |
avio_r8(pb); |
| 595 | 595 |
memset(&asf->asfid2avid, -1, sizeof(asf->asfid2avid)); |
| 596 | 596 |
for(;;) {
|
| 597 |
- uint64_t gpos= url_ftell(pb); |
|
| 597 |
+ uint64_t gpos= avio_tell(pb); |
|
| 598 | 598 |
ff_get_guid(pb, &g); |
| 599 | 599 |
gsize = avio_rl64(pb); |
| 600 | 600 |
av_dlog(s, "%08"PRIx64": ", gpos); |
| 601 | 601 |
print_guid(&g); |
| 602 | 602 |
av_dlog(s, " size=0x%"PRIx64"\n", gsize); |
| 603 | 603 |
if (!ff_guidcmp(&g, &ff_asf_data_header)) {
|
| 604 |
- asf->data_object_offset = url_ftell(pb); |
|
| 604 |
+ asf->data_object_offset = avio_tell(pb); |
|
| 605 | 605 |
// if not streaming, gsize is not unlimited (how?), and there is enough space in the file.. |
| 606 | 606 |
if (!(asf->hdr.flags & 0x01) && gsize >= 100) {
|
| 607 | 607 |
asf->data_object_size = gsize - 24; |
| ... | ... |
@@ -651,8 +651,8 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 651 | 651 |
} |
| 652 | 652 |
} |
| 653 | 653 |
} |
| 654 |
- if(url_ftell(pb) != gpos + gsize) |
|
| 655 |
- av_log(s, AV_LOG_DEBUG, "gpos mismatch our pos=%"PRIu64", end=%"PRIu64"\n", url_ftell(pb)-gpos, gsize); |
|
| 654 |
+ if(avio_tell(pb) != gpos + gsize) |
|
| 655 |
+ av_log(s, AV_LOG_DEBUG, "gpos mismatch our pos=%"PRIu64", end=%"PRIu64"\n", avio_tell(pb)-gpos, gsize); |
|
| 656 | 656 |
avio_seek(pb, gpos + gsize, SEEK_SET); |
| 657 | 657 |
} |
| 658 | 658 |
ff_get_guid(pb, &g); |
| ... | ... |
@@ -661,7 +661,7 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 661 | 661 |
avio_r8(pb); |
| 662 | 662 |
if (url_feof(pb)) |
| 663 | 663 |
return -1; |
| 664 |
- asf->data_offset = url_ftell(pb); |
|
| 664 |
+ asf->data_offset = avio_tell(pb); |
|
| 665 | 665 |
asf->packet_size_left = 0; |
| 666 | 666 |
|
| 667 | 667 |
|
| ... | ... |
@@ -725,7 +725,7 @@ static int ff_asf_get_packet(AVFormatContext *s, AVIOContext *pb) |
| 725 | 725 |
// if we do not know packet size, allow skipping up to 32 kB |
| 726 | 726 |
off= 32768; |
| 727 | 727 |
if (s->packet_size > 0) |
| 728 |
- off= (url_ftell(pb) - s->data_offset) % s->packet_size + 3; |
|
| 728 |
+ off= (avio_tell(pb) - s->data_offset) % s->packet_size + 3; |
|
| 729 | 729 |
|
| 730 | 730 |
c=d=e=-1; |
| 731 | 731 |
while(off-- > 0){
|
| ... | ... |
@@ -745,7 +745,7 @@ static int ff_asf_get_packet(AVFormatContext *s, AVIOContext *pb) |
| 745 | 745 |
if (url_ferror(pb) == AVERROR(EAGAIN)) |
| 746 | 746 |
return AVERROR(EAGAIN); |
| 747 | 747 |
if (!url_feof(pb)) |
| 748 |
- av_log(s, AV_LOG_ERROR, "ff asf bad header %x at:%"PRId64"\n", c, url_ftell(pb)); |
|
| 748 |
+ av_log(s, AV_LOG_ERROR, "ff asf bad header %x at:%"PRId64"\n", c, avio_tell(pb)); |
|
| 749 | 749 |
} |
| 750 | 750 |
if ((c & 0x8f) == 0x82) {
|
| 751 | 751 |
if (d || e) {
|
| ... | ... |
@@ -769,11 +769,11 @@ static int ff_asf_get_packet(AVFormatContext *s, AVIOContext *pb) |
| 769 | 769 |
|
| 770 | 770 |
//the following checks prevent overflows and infinite loops |
| 771 | 771 |
if(!packet_length || packet_length >= (1U<<29)){
|
| 772 |
- av_log(s, AV_LOG_ERROR, "invalid packet_length %d at:%"PRId64"\n", packet_length, url_ftell(pb)); |
|
| 772 |
+ av_log(s, AV_LOG_ERROR, "invalid packet_length %d at:%"PRId64"\n", packet_length, avio_tell(pb)); |
|
| 773 | 773 |
return -1; |
| 774 | 774 |
} |
| 775 | 775 |
if(padsize >= packet_length){
|
| 776 |
- av_log(s, AV_LOG_ERROR, "invalid padsize %d at:%"PRId64"\n", padsize, url_ftell(pb)); |
|
| 776 |
+ av_log(s, AV_LOG_ERROR, "invalid padsize %d at:%"PRId64"\n", padsize, avio_tell(pb)); |
|
| 777 | 777 |
return -1; |
| 778 | 778 |
} |
| 779 | 779 |
|
| ... | ... |
@@ -891,12 +891,12 @@ static int ff_asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pk |
| 891 | 891 |
|| asf->packet_segments < 1) {
|
| 892 | 892 |
//asf->packet_size_left <= asf->packet_padsize) {
|
| 893 | 893 |
int ret = asf->packet_size_left + asf->packet_padsize; |
| 894 |
- //printf("PacketLeftSize:%d Pad:%d Pos:%"PRId64"\n", asf->packet_size_left, asf->packet_padsize, url_ftell(pb));
|
|
| 894 |
+ //printf("PacketLeftSize:%d Pad:%d Pos:%"PRId64"\n", asf->packet_size_left, asf->packet_padsize, avio_tell(pb));
|
|
| 895 | 895 |
assert(ret>=0); |
| 896 | 896 |
/* fail safe */ |
| 897 | 897 |
avio_seek(pb, ret, SEEK_CUR); |
| 898 | 898 |
|
| 899 |
- asf->packet_pos= url_ftell(pb); |
|
| 899 |
+ asf->packet_pos= avio_tell(pb); |
|
| 900 | 900 |
if (asf->data_object_size != (uint64_t)-1 && |
| 901 | 901 |
(asf->packet_pos - asf->data_object_offset >= asf->data_object_size)) |
| 902 | 902 |
return AVERROR_EOF; /* Do not exceed the size of the data object */ |
| ... | ... |
@@ -1184,7 +1184,7 @@ static void asf_build_simple_index(AVFormatContext *s, int stream_index) |
| 1184 | 1184 |
{
|
| 1185 | 1185 |
ff_asf_guid g; |
| 1186 | 1186 |
ASFContext *asf = s->priv_data; |
| 1187 |
- int64_t current_pos= url_ftell(s->pb); |
|
| 1187 |
+ int64_t current_pos= avio_tell(s->pb); |
|
| 1188 | 1188 |
int i; |
| 1189 | 1189 |
|
| 1190 | 1190 |
avio_seek(s->pb, asf->data_object_offset + asf->data_object_size, SEEK_SET); |
| ... | ... |
@@ -1267,7 +1267,7 @@ static int asf_read_seek(AVFormatContext *s, int stream_index, int64_t pts, int |
| 1267 | 1267 |
// avio_seek(s->pb, pos, SEEK_SET); |
| 1268 | 1268 |
// key_pos = pos; |
| 1269 | 1269 |
// for(i=0;i<16;i++){
|
| 1270 |
- // pos = url_ftell(s->pb); |
|
| 1270 |
+ // pos = avio_tell(s->pb); |
|
| 1271 | 1271 |
// if (av_read_frame(s, &pkt) < 0){
|
| 1272 | 1272 |
// av_log(s, AV_LOG_INFO, "seek failed\n"); |
| 1273 | 1273 |
// return -1; |
| ... | ... |
@@ -248,7 +248,7 @@ static int64_t put_header(AVIOContext *pb, const ff_asf_guid *g) |
| 248 | 248 |
{
|
| 249 | 249 |
int64_t pos; |
| 250 | 250 |
|
| 251 |
- pos = url_ftell(pb); |
|
| 251 |
+ pos = avio_tell(pb); |
|
| 252 | 252 |
put_guid(pb, g); |
| 253 | 253 |
avio_wl64(pb, 24); |
| 254 | 254 |
return pos; |
| ... | ... |
@@ -259,7 +259,7 @@ static void end_header(AVIOContext *pb, int64_t pos) |
| 259 | 259 |
{
|
| 260 | 260 |
int64_t pos1; |
| 261 | 261 |
|
| 262 |
- pos1 = url_ftell(pb); |
|
| 262 |
+ pos1 = avio_tell(pb); |
|
| 263 | 263 |
avio_seek(pb, pos + 16, SEEK_SET); |
| 264 | 264 |
avio_wl64(pb, pos1 - pos); |
| 265 | 265 |
avio_seek(pb, pos1, SEEK_SET); |
| ... | ... |
@@ -337,7 +337,7 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data |
| 337 | 337 |
avio_w8(pb, 2); /* ??? */ |
| 338 | 338 |
|
| 339 | 339 |
/* file header */ |
| 340 |
- header_offset = url_ftell(pb); |
|
| 340 |
+ header_offset = avio_tell(pb); |
|
| 341 | 341 |
hpos = put_header(pb, &ff_asf_file_header); |
| 342 | 342 |
put_guid(pb, &ff_asf_my_guid); |
| 343 | 343 |
avio_wl64(pb, file_size); |
| ... | ... |
@@ -425,7 +425,7 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data |
| 425 | 425 |
put_guid(pb, &ff_asf_video_conceal_none); |
| 426 | 426 |
} |
| 427 | 427 |
avio_wl64(pb, 0); /* ??? */ |
| 428 |
- es_pos = url_ftell(pb); |
|
| 428 |
+ es_pos = avio_tell(pb); |
|
| 429 | 429 |
avio_wl32(pb, extra_size); /* wav header len */ |
| 430 | 430 |
avio_wl32(pb, extra_size2); /* additional data len */ |
| 431 | 431 |
avio_wl16(pb, n + 1); /* stream number */ |
| ... | ... |
@@ -442,7 +442,7 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data |
| 442 | 442 |
if (wavsize < 0) |
| 443 | 443 |
return -1; |
| 444 | 444 |
if (wavsize != extra_size) {
|
| 445 |
- cur_pos = url_ftell(pb); |
|
| 445 |
+ cur_pos = avio_tell(pb); |
|
| 446 | 446 |
avio_seek(pb, es_pos, SEEK_SET); |
| 447 | 447 |
avio_wl32(pb, wavsize); /* wav header len */ |
| 448 | 448 |
avio_seek(pb, cur_pos, SEEK_SET); |
| ... | ... |
@@ -525,7 +525,7 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data |
| 525 | 525 |
|
| 526 | 526 |
/* patch the header size fields */ |
| 527 | 527 |
|
| 528 |
- cur_pos = url_ftell(pb); |
|
| 528 |
+ cur_pos = avio_tell(pb); |
|
| 529 | 529 |
header_size = cur_pos - header_offset; |
| 530 | 530 |
if (asf->is_streamed) {
|
| 531 | 531 |
header_size += 8 + 30 + 50; |
| ... | ... |
@@ -605,7 +605,7 @@ static int put_payload_parsing_info( |
| 605 | 605 |
ASFContext *asf = s->priv_data; |
| 606 | 606 |
AVIOContext *pb = s->pb; |
| 607 | 607 |
int ppi_size, i; |
| 608 |
- int64_t start= url_ftell(pb); |
|
| 608 |
+ int64_t start= avio_tell(pb); |
|
| 609 | 609 |
|
| 610 | 610 |
int iLengthTypeFlags = ASF_PPI_LENGTH_TYPE_FLAGS; |
| 611 | 611 |
|
| ... | ... |
@@ -642,7 +642,7 @@ static int put_payload_parsing_info( |
| 642 | 642 |
if (asf->multi_payloads_present) |
| 643 | 643 |
avio_w8(pb, nb_payloads | ASF_PAYLOAD_FLAGS); |
| 644 | 644 |
|
| 645 |
- ppi_size = url_ftell(pb) - start; |
|
| 645 |
+ ppi_size = avio_tell(pb) - start; |
|
| 646 | 646 |
|
| 647 | 647 |
return ppi_size; |
| 648 | 648 |
} |
| ... | ... |
@@ -860,7 +860,7 @@ static int asf_write_trailer(AVFormatContext *s) |
| 860 | 860 |
flush_packet(s); |
| 861 | 861 |
|
| 862 | 862 |
/* write index */ |
| 863 |
- data_size = url_ftell(s->pb); |
|
| 863 |
+ data_size = avio_tell(s->pb); |
|
| 864 | 864 |
if ((!asf->is_streamed) && (asf->nb_index_count != 0)) {
|
| 865 | 865 |
asf_write_index(s, asf->index_ptr, asf->maximum_packet, asf->nb_index_count); |
| 866 | 866 |
} |
| ... | ... |
@@ -870,7 +870,7 @@ static int asf_write_trailer(AVFormatContext *s) |
| 870 | 870 |
put_chunk(s, 0x4524, 0, 0); /* end of stream */ |
| 871 | 871 |
} else {
|
| 872 | 872 |
/* rewrite an updated header */ |
| 873 |
- file_size = url_ftell(s->pb); |
|
| 873 |
+ file_size = avio_tell(s->pb); |
|
| 874 | 874 |
avio_seek(s->pb, 0, SEEK_SET); |
| 875 | 875 |
asf_write_header1(s, file_size, data_size - asf->data_offset); |
| 876 | 876 |
} |
| ... | ... |
@@ -94,7 +94,7 @@ static int au_write_trailer(AVFormatContext *s) |
| 94 | 94 |
if (!url_is_streamed(s->pb)) {
|
| 95 | 95 |
|
| 96 | 96 |
/* update file size */ |
| 97 |
- file_size = url_ftell(pb); |
|
| 97 |
+ file_size = avio_tell(pb); |
|
| 98 | 98 |
avio_seek(pb, 8, SEEK_SET); |
| 99 | 99 |
avio_wb32(pb, (uint32_t)(file_size - 24)); |
| 100 | 100 |
avio_seek(pb, file_size, SEEK_SET); |
| ... | ... |
@@ -109,7 +109,7 @@ static int get_riff(AVFormatContext *s, AVIOContext *pb) |
| 109 | 109 |
/* check RIFF header */ |
| 110 | 110 |
avio_read(pb, header, 4); |
| 111 | 111 |
avi->riff_end = avio_rl32(pb); /* RIFF chunk size */ |
| 112 |
- avi->riff_end += url_ftell(pb); /* RIFF chunk end */ |
|
| 112 |
+ avi->riff_end += avio_tell(pb); /* RIFF chunk end */ |
|
| 113 | 113 |
avio_read(pb, header+4, 4); |
| 114 | 114 |
|
| 115 | 115 |
for(i=0; avi_headers[i][0]; i++) |
| ... | ... |
@@ -198,7 +198,7 @@ static int read_braindead_odml_indx(AVFormatContext *s, int frame_num){
|
| 198 | 198 |
if(url_feof(pb)) |
| 199 | 199 |
return -1; |
| 200 | 200 |
|
| 201 |
- pos = url_ftell(pb); |
|
| 201 |
+ pos = avio_tell(pb); |
|
| 202 | 202 |
|
| 203 | 203 |
if(avi->odml_depth > MAX_ODML_DEPTH){
|
| 204 | 204 |
av_log(s, AV_LOG_ERROR, "Too deeply nested ODML indexes\n"); |
| ... | ... |
@@ -267,7 +267,7 @@ static int avi_read_tag(AVFormatContext *s, AVStream *st, uint32_t tag, uint32_t |
| 267 | 267 |
|
| 268 | 268 |
static void avi_read_info(AVFormatContext *s, uint64_t end) |
| 269 | 269 |
{
|
| 270 |
- while (url_ftell(s->pb) < end) {
|
|
| 270 |
+ while (avio_tell(s->pb) < end) {
|
|
| 271 | 271 |
uint32_t tag = avio_rl32(s->pb); |
| 272 | 272 |
uint32_t size = avio_rl32(s->pb); |
| 273 | 273 |
avi_read_tag(s, NULL, tag, size); |
| ... | ... |
@@ -298,13 +298,13 @@ static void avi_metadata_creation_time(AVMetadata **metadata, char *date) |
| 298 | 298 |
|
| 299 | 299 |
static void avi_read_nikon(AVFormatContext *s, uint64_t end) |
| 300 | 300 |
{
|
| 301 |
- while (url_ftell(s->pb) < end) {
|
|
| 301 |
+ while (avio_tell(s->pb) < end) {
|
|
| 302 | 302 |
uint32_t tag = avio_rl32(s->pb); |
| 303 | 303 |
uint32_t size = avio_rl32(s->pb); |
| 304 | 304 |
switch (tag) {
|
| 305 | 305 |
case MKTAG('n', 'c', 't', 'g'): { /* Nikon Tags */
|
| 306 |
- uint64_t tag_end = url_ftell(s->pb) + size; |
|
| 307 |
- while (url_ftell(s->pb) < tag_end) {
|
|
| 306 |
+ uint64_t tag_end = avio_tell(s->pb) + size; |
|
| 307 |
+ while (avio_tell(s->pb) < tag_end) {
|
|
| 308 | 308 |
uint16_t tag = avio_rl16(s->pb); |
| 309 | 309 |
uint16_t size = avio_rl16(s->pb); |
| 310 | 310 |
const char *name = NULL; |
| ... | ... |
@@ -369,14 +369,14 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 369 | 369 |
|
| 370 | 370 |
switch(tag) {
|
| 371 | 371 |
case MKTAG('L', 'I', 'S', 'T'):
|
| 372 |
- list_end = url_ftell(pb) + size; |
|
| 372 |
+ list_end = avio_tell(pb) + size; |
|
| 373 | 373 |
/* Ignored, except at start of video packets. */ |
| 374 | 374 |
tag1 = avio_rl32(pb); |
| 375 | 375 |
|
| 376 | 376 |
print_tag("list", tag1, 0);
|
| 377 | 377 |
|
| 378 | 378 |
if (tag1 == MKTAG('m', 'o', 'v', 'i')) {
|
| 379 |
- avi->movi_list = url_ftell(pb) - 4; |
|
| 379 |
+ avi->movi_list = avio_tell(pb) - 4; |
|
| 380 | 380 |
if(size) avi->movi_end = avi->movi_list + size + (size & 1); |
| 381 | 381 |
else avi->movi_end = url_fsize(pb); |
| 382 | 382 |
av_dlog(NULL, "movi end=%"PRIx64"\n", avi->movi_end); |
| ... | ... |
@@ -549,7 +549,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 549 | 549 |
if (stream_index >= (unsigned)s->nb_streams || avi->dv_demux) {
|
| 550 | 550 |
avio_seek(pb, size, SEEK_CUR); |
| 551 | 551 |
} else {
|
| 552 |
- uint64_t cur_pos = url_ftell(pb); |
|
| 552 |
+ uint64_t cur_pos = avio_tell(pb); |
|
| 553 | 553 |
if (cur_pos < list_end) |
| 554 | 554 |
size = FFMIN(size, list_end - cur_pos); |
| 555 | 555 |
st = s->streams[stream_index]; |
| ... | ... |
@@ -664,7 +664,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 664 | 664 |
} |
| 665 | 665 |
break; |
| 666 | 666 |
case MKTAG('i', 'n', 'd', 'x'):
|
| 667 |
- i= url_ftell(pb); |
|
| 667 |
+ i= avio_tell(pb); |
|
| 668 | 668 |
if(!url_is_streamed(pb) && !(s->flags & AVFMT_FLAG_IGNIDX)){
|
| 669 | 669 |
read_braindead_odml_indx(s, 0); |
| 670 | 670 |
} |
| ... | ... |
@@ -704,7 +704,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 704 | 704 |
if(size > 1000000){
|
| 705 | 705 |
av_log(s, AV_LOG_ERROR, "Something went wrong during header parsing, " |
| 706 | 706 |
"I will ignore it and try to continue anyway.\n"); |
| 707 |
- avi->movi_list = url_ftell(pb) - 4; |
|
| 707 |
+ avi->movi_list = avio_tell(pb) - 4; |
|
| 708 | 708 |
avi->movi_end = url_fsize(pb); |
| 709 | 709 |
goto end_of_header; |
| 710 | 710 |
} |
| ... | ... |
@@ -923,7 +923,7 @@ resync: |
| 923 | 923 |
|
| 924 | 924 |
if(size > ast->remaining) |
| 925 | 925 |
size= ast->remaining; |
| 926 |
- avi->last_pkt_pos= url_ftell(pb); |
|
| 926 |
+ avi->last_pkt_pos= avio_tell(pb); |
|
| 927 | 927 |
err= av_get_packet(pb, pkt, size); |
| 928 | 928 |
if(err<0) |
| 929 | 929 |
return err; |
| ... | ... |
@@ -989,7 +989,7 @@ resync: |
| 989 | 989 |
} |
| 990 | 990 |
|
| 991 | 991 |
memset(d, -1, sizeof(int)*8); |
| 992 |
- for(i=sync=url_ftell(pb); !url_feof(pb); i++) {
|
|
| 992 |
+ for(i=sync=avio_tell(pb); !url_feof(pb); i++) {
|
|
| 993 | 993 |
int j; |
| 994 | 994 |
|
| 995 | 995 |
for(j=0; j<7; j++) |
| ... | ... |
@@ -1092,7 +1092,7 @@ resync: |
| 1092 | 1092 |
ast->remaining= size; |
| 1093 | 1093 |
|
| 1094 | 1094 |
if(size || !ast->sample_size){
|
| 1095 |
- uint64_t pos= url_ftell(pb) - 8; |
|
| 1095 |
+ uint64_t pos= avio_tell(pb) - 8; |
|
| 1096 | 1096 |
if(!st->index_entries || !st->nb_index_entries || st->index_entries[st->nb_index_entries - 1].pos < pos){
|
| 1097 | 1097 |
av_add_index_entry(st, pos, ast->frame_offset, size, 0, AVINDEX_KEYFRAME); |
| 1098 | 1098 |
} |
| ... | ... |
@@ -1162,7 +1162,7 @@ static int guess_ni_flag(AVFormatContext *s){
|
| 1162 | 1162 |
int i; |
| 1163 | 1163 |
int64_t last_start=0; |
| 1164 | 1164 |
int64_t first_end= INT64_MAX; |
| 1165 |
- int64_t oldpos= url_ftell(s->pb); |
|
| 1165 |
+ int64_t oldpos= avio_tell(s->pb); |
|
| 1166 | 1166 |
|
| 1167 | 1167 |
for(i=0; i<s->nb_streams; i++){
|
| 1168 | 1168 |
AVStream *st = s->streams[i]; |
| ... | ... |
@@ -1194,7 +1194,7 @@ static int avi_load_index(AVFormatContext *s) |
| 1194 | 1194 |
AVIContext *avi = s->priv_data; |
| 1195 | 1195 |
AVIOContext *pb = s->pb; |
| 1196 | 1196 |
uint32_t tag, size; |
| 1197 |
- int64_t pos= url_ftell(pb); |
|
| 1197 |
+ int64_t pos= avio_tell(pb); |
|
| 1198 | 1198 |
int ret = -1; |
| 1199 | 1199 |
|
| 1200 | 1200 |
if (avio_seek(pb, avi->movi_end, SEEK_SET) < 0) |
| ... | ... |
@@ -124,7 +124,7 @@ static int avi_write_counters(AVFormatContext* s, int riff_id) |
| 124 | 124 |
int64_t file_size; |
| 125 | 125 |
AVCodecContext* stream; |
| 126 | 126 |
|
| 127 |
- file_size = url_ftell(pb); |
|
| 127 |
+ file_size = avio_tell(pb); |
|
| 128 | 128 |
for(n = 0; n < s->nb_streams; n++) {
|
| 129 | 129 |
AVIStream *avist= s->streams[n]->priv_data; |
| 130 | 130 |
|
| ... | ... |
@@ -201,7 +201,7 @@ static int avi_write_header(AVFormatContext *s) |
| 201 | 201 |
avio_wl32(pb, AVIF_TRUSTCKTYPE | AVIF_ISINTERLEAVED); /* flags */ |
| 202 | 202 |
else |
| 203 | 203 |
avio_wl32(pb, AVIF_TRUSTCKTYPE | AVIF_HASINDEX | AVIF_ISINTERLEAVED); /* flags */ |
| 204 |
- avi->frames_hdr_all = url_ftell(pb); /* remember this offset to fill later */ |
|
| 204 |
+ avi->frames_hdr_all = avio_tell(pb); /* remember this offset to fill later */ |
|
| 205 | 205 |
avio_wl32(pb, nb_frames); /* nb frames, filled later */ |
| 206 | 206 |
avio_wl32(pb, 0); /* initial frame */ |
| 207 | 207 |
avio_wl32(pb, s->nb_streams); /* nb streams */ |
| ... | ... |
@@ -258,7 +258,7 @@ static int avi_write_header(AVFormatContext *s) |
| 258 | 258 |
av_set_pts_info(s->streams[i], 64, au_scale, au_byterate); |
| 259 | 259 |
|
| 260 | 260 |
avio_wl32(pb, 0); /* start */ |
| 261 |
- avist->frames_hdr_strm = url_ftell(pb); /* remember this offset to fill later */ |
|
| 261 |
+ avist->frames_hdr_strm = avio_tell(pb); /* remember this offset to fill later */ |
|
| 262 | 262 |
if (url_is_streamed(pb)) |
| 263 | 263 |
avio_wl32(pb, AVI_MAX_RIFF_SIZE); /* FIXME: this may be broken, but who cares */ |
| 264 | 264 |
else |
| ... | ... |
@@ -419,7 +419,7 @@ static int avi_write_ix(AVFormatContext *s) |
| 419 | 419 |
ix_tag[3] = '0' + i; |
| 420 | 420 |
|
| 421 | 421 |
/* Writing AVI OpenDML leaf index chunk */ |
| 422 |
- ix = url_ftell(pb); |
|
| 422 |
+ ix = avio_tell(pb); |
|
| 423 | 423 |
ffio_wfourcc(pb, ix_tag); /* ix?? */ |
| 424 | 424 |
avio_wl32(pb, avist->indexes.entry * 8 + 24); |
| 425 | 425 |
/* chunk size */ |
| ... | ... |
@@ -439,7 +439,7 @@ static int avi_write_ix(AVFormatContext *s) |
| 439 | 439 |
(ie->flags & 0x10 ? 0 : 0x80000000)); |
| 440 | 440 |
} |
| 441 | 441 |
put_flush_packet(pb); |
| 442 |
- pos = url_ftell(pb); |
|
| 442 |
+ pos = avio_tell(pb); |
|
| 443 | 443 |
|
| 444 | 444 |
/* Updating one entry in the AVI OpenDML master index */ |
| 445 | 445 |
avio_seek(pb, avist->indexes.indx_start - 8, SEEK_SET); |
| ... | ... |
@@ -533,7 +533,7 @@ static int avi_write_packet(AVFormatContext *s, AVPacket *pkt) |
| 533 | 533 |
|
| 534 | 534 |
// Make sure to put an OpenDML chunk when the file size exceeds the limits |
| 535 | 535 |
if (!url_is_streamed(pb) && |
| 536 |
- (url_ftell(pb) - avi->riff_start > AVI_MAX_RIFF_SIZE)) {
|
|
| 536 |
+ (avio_tell(pb) - avi->riff_start > AVI_MAX_RIFF_SIZE)) {
|
|
| 537 | 537 |
|
| 538 | 538 |
avi_write_ix(s); |
| 539 | 539 |
ff_end_tag(pb, avi->movi_list); |
| ... | ... |
@@ -567,7 +567,7 @@ static int avi_write_packet(AVFormatContext *s, AVPacket *pkt) |
| 567 | 567 |
} |
| 568 | 568 |
|
| 569 | 569 |
idx->cluster[cl][id].flags = flags; |
| 570 |
- idx->cluster[cl][id].pos = url_ftell(pb) - avi->movi_list; |
|
| 570 |
+ idx->cluster[cl][id].pos = avio_tell(pb) - avi->movi_list; |
|
| 571 | 571 |
idx->cluster[cl][id].len = size; |
| 572 | 572 |
idx->entry++; |
| 573 | 573 |
} |
| ... | ... |
@@ -600,7 +600,7 @@ static int avi_write_trailer(AVFormatContext *s) |
| 600 | 600 |
ff_end_tag(pb, avi->movi_list); |
| 601 | 601 |
ff_end_tag(pb, avi->riff_start); |
| 602 | 602 |
|
| 603 |
- file_size = url_ftell(pb); |
|
| 603 |
+ file_size = avio_tell(pb); |
|
| 604 | 604 |
avio_seek(pb, avi->odml_list - 8, SEEK_SET); |
| 605 | 605 |
ffio_wfourcc(pb, "LIST"); /* Making this AVI OpenDML one */ |
| 606 | 606 |
avio_seek(pb, 16, SEEK_CUR); |
| ... | ... |
@@ -422,6 +422,7 @@ attribute_deprecated int url_fopen( AVIOContext **s, const char *url, int flags) |
| 422 | 422 |
attribute_deprecated int url_fclose(AVIOContext *s); |
| 423 | 423 |
attribute_deprecated int64_t url_fseek(AVIOContext *s, int64_t offset, int whence); |
| 424 | 424 |
attribute_deprecated int url_fskip(AVIOContext *s, int64_t offset); |
| 425 |
+attribute_deprecated int64_t url_ftell(AVIOContext *s); |
|
| 425 | 426 |
/** |
| 426 | 427 |
* @} |
| 427 | 428 |
*/ |
| ... | ... |
@@ -473,7 +474,7 @@ int64_t avio_seek(AVIOContext *s, int64_t offset, int whence); |
| 473 | 473 |
* ftell() equivalent for AVIOContext. |
| 474 | 474 |
* @return position or AVERROR. |
| 475 | 475 |
*/ |
| 476 |
-int64_t url_ftell(AVIOContext *s); |
|
| 476 |
+#define avio_tell(s) avio_seek((s), 0, SEEK_CUR) |
|
| 477 | 477 |
|
| 478 | 478 |
/** |
| 479 | 479 |
* Get the filesize. |
| ... | ... |
@@ -239,12 +239,12 @@ int url_fskip(AVIOContext *s, int64_t offset) |
| 239 | 239 |
int64_t ret = avio_seek(s, offset, SEEK_CUR); |
| 240 | 240 |
return ret < 0 ? ret : 0; |
| 241 | 241 |
} |
| 242 |
-#endif |
|
| 243 | 242 |
|
| 244 | 243 |
int64_t url_ftell(AVIOContext *s) |
| 245 | 244 |
{
|
| 246 | 245 |
return avio_seek(s, 0, SEEK_CUR); |
| 247 | 246 |
} |
| 247 |
+#endif |
|
| 248 | 248 |
|
| 249 | 249 |
int64_t url_fsize(AVIOContext *s) |
| 250 | 250 |
{
|
| ... | ... |
@@ -123,9 +123,9 @@ static int avs_read_audio_packet(AVFormatContext * s, AVPacket * pkt) |
| 123 | 123 |
AvsFormat *avs = s->priv_data; |
| 124 | 124 |
int ret, size; |
| 125 | 125 |
|
| 126 |
- size = url_ftell(s->pb); |
|
| 126 |
+ size = avio_tell(s->pb); |
|
| 127 | 127 |
ret = voc_get_packet(s, pkt, avs->st_audio, avs->remaining_audio_size); |
| 128 |
- size = url_ftell(s->pb) - size; |
|
| 128 |
+ size = avio_tell(s->pb) - size; |
|
| 129 | 129 |
avs->remaining_audio_size -= size; |
| 130 | 130 |
|
| 131 | 131 |
if (ret == AVERROR(EIO)) |
| ... | ... |
@@ -112,7 +112,7 @@ static int read_frame(BVID_DemuxContext *vid, AVIOContext *pb, AVPacket *pkt, |
| 112 | 112 |
return AVERROR(ENOMEM); |
| 113 | 113 |
|
| 114 | 114 |
// save the file position for the packet, include block type |
| 115 |
- position = url_ftell(pb) - 1; |
|
| 115 |
+ position = avio_tell(pb) - 1; |
|
| 116 | 116 |
|
| 117 | 117 |
vidbuf_start[vidbuf_nbytes++] = block_type; |
| 118 | 118 |
|
| ... | ... |
@@ -106,9 +106,9 @@ static int read_kuki_chunk(AVFormatContext *s, int64_t size) |
| 106 | 106 |
int strt, skip; |
| 107 | 107 |
MOVAtom atom; |
| 108 | 108 |
|
| 109 |
- strt = url_ftell(pb); |
|
| 109 |
+ strt = avio_tell(pb); |
|
| 110 | 110 |
ff_mov_read_esds(s, pb, atom); |
| 111 |
- skip = size - (url_ftell(pb) - strt); |
|
| 111 |
+ skip = size - (avio_tell(pb) - strt); |
|
| 112 | 112 |
if (skip < 0 || !st->codec->extradata || |
| 113 | 113 |
st->codec->codec_id != CODEC_ID_AAC) {
|
| 114 | 114 |
av_log(s, AV_LOG_ERROR, "invalid AAC magic cookie\n"); |
| ... | ... |
@@ -150,7 +150,7 @@ static int read_pakt_chunk(AVFormatContext *s, int64_t size) |
| 150 | 150 |
int64_t pos = 0, ccount; |
| 151 | 151 |
int num_packets, i; |
| 152 | 152 |
|
| 153 |
- ccount = url_ftell(pb); |
|
| 153 |
+ ccount = avio_tell(pb); |
|
| 154 | 154 |
|
| 155 | 155 |
num_packets = avio_rb64(pb); |
| 156 | 156 |
if (num_packets < 0 || INT32_MAX / sizeof(AVIndexEntry) < num_packets) |
| ... | ... |
@@ -167,7 +167,7 @@ static int read_pakt_chunk(AVFormatContext *s, int64_t size) |
| 167 | 167 |
st->duration += caf->frames_per_packet ? caf->frames_per_packet : ff_mp4_read_descr_len(pb); |
| 168 | 168 |
} |
| 169 | 169 |
|
| 170 |
- if (url_ftell(pb) - ccount != size) {
|
|
| 170 |
+ if (avio_tell(pb) - ccount != size) {
|
|
| 171 | 171 |
av_log(s, AV_LOG_ERROR, "error reading packet table\n"); |
| 172 | 172 |
return -1; |
| 173 | 173 |
} |
| ... | ... |
@@ -234,7 +234,7 @@ static int read_header(AVFormatContext *s, |
| 234 | 234 |
switch (tag) {
|
| 235 | 235 |
case MKBETAG('d','a','t','a'):
|
| 236 | 236 |
avio_seek(pb, 4, SEEK_CUR); /* edit count */ |
| 237 |
- caf->data_start = url_ftell(pb); |
|
| 237 |
+ caf->data_start = avio_tell(pb); |
|
| 238 | 238 |
caf->data_size = size < 0 ? -1 : size - 4; |
| 239 | 239 |
if (caf->data_size > 0 && !url_is_streamed(pb)) |
| 240 | 240 |
avio_seek(pb, caf->data_size, SEEK_CUR); |
| ... | ... |
@@ -312,7 +312,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) |
| 312 | 312 |
|
| 313 | 313 |
/* don't read past end of data chunk */ |
| 314 | 314 |
if (caf->data_size > 0) {
|
| 315 |
- left = (caf->data_start + caf->data_size) - url_ftell(pb); |
|
| 315 |
+ left = (caf->data_start + caf->data_size) - avio_tell(pb); |
|
| 316 | 316 |
if (left <= 0) |
| 317 | 317 |
return AVERROR(EIO); |
| 318 | 318 |
} |
| ... | ... |
@@ -417,8 +417,8 @@ static int dv_read_header(AVFormatContext *s, |
| 417 | 417 |
return -1; |
| 418 | 418 |
} |
| 419 | 419 |
if (state == 0x003f0700 || state == 0xff3f0700) |
| 420 |
- marker_pos = url_ftell(s->pb); |
|
| 421 |
- if (state == 0xff3f0701 && url_ftell(s->pb) - marker_pos == 80) {
|
|
| 420 |
+ marker_pos = avio_tell(s->pb); |
|
| 421 |
+ if (state == 0xff3f0701 && avio_tell(s->pb) - marker_pos == 80) {
|
|
| 422 | 422 |
avio_seek(s->pb, -163, SEEK_CUR); |
| 423 | 423 |
state = avio_rb32(s->pb); |
| 424 | 424 |
break; |
| ... | ... |
@@ -95,7 +95,7 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 95 | 95 |
uint32_t size, fsize; |
| 96 | 96 |
c->has_sound = 1; |
| 97 | 97 |
size = avio_rb32(pb); |
| 98 |
- c->vidpos = url_ftell(pb) + size; |
|
| 98 |
+ c->vidpos = avio_tell(pb) + size; |
|
| 99 | 99 |
avio_seek(pb, 16, SEEK_CUR); |
| 100 | 100 |
fsize = avio_rl32(pb); |
| 101 | 101 |
|
| ... | ... |
@@ -104,7 +104,7 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 104 | 104 |
return -1; |
| 105 | 105 |
ff_get_wav_header(pb, ast->codec, fsize); |
| 106 | 106 |
// find 'data' chunk |
| 107 |
- while(url_ftell(pb) < c->vidpos && !url_feof(pb)){
|
|
| 107 |
+ while(avio_tell(pb) < c->vidpos && !url_feof(pb)){
|
|
| 108 | 108 |
tag = avio_rl32(pb); |
| 109 | 109 |
fsize = avio_rl32(pb); |
| 110 | 110 |
if(tag == MKTAG('d', 'a', 't', 'a')) break;
|
| ... | ... |
@@ -114,7 +114,7 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 114 | 114 |
if(ast->codec->block_align) |
| 115 | 115 |
c->bpc = ((c->bpc + ast->codec->block_align - 1) / ast->codec->block_align) * ast->codec->block_align; |
| 116 | 116 |
c->bytes_left = fsize; |
| 117 |
- c->wavpos = url_ftell(pb); |
|
| 117 |
+ c->wavpos = avio_tell(pb); |
|
| 118 | 118 |
avio_seek(pb, c->vidpos, SEEK_SET); |
| 119 | 119 |
} |
| 120 | 120 |
|
| ... | ... |
@@ -133,7 +133,7 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 133 | 133 |
st->codec->height >>= 1; |
| 134 | 134 |
} |
| 135 | 135 |
c->readvid = !c->has_sound; |
| 136 |
- c->vidpos = url_ftell(pb); |
|
| 136 |
+ c->vidpos = avio_tell(pb); |
|
| 137 | 137 |
s->start_time = 0; |
| 138 | 138 |
s->duration = (int64_t)c->frames * AV_TIME_BASE * num / den; |
| 139 | 139 |
av_log(s, AV_LOG_DEBUG, "%d frame(s)\n",c->frames); |
| ... | ... |
@@ -158,7 +158,7 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt) |
| 158 | 158 |
if(ret != size) |
| 159 | 159 |
return AVERROR(EIO); |
| 160 | 160 |
c->bytes_left -= size; |
| 161 |
- c->wavpos = url_ftell(s->pb); |
|
| 161 |
+ c->wavpos = avio_tell(s->pb); |
|
| 162 | 162 |
return 0; |
| 163 | 163 |
} |
| 164 | 164 |
avio_seek(s->pb, c->vidpos, SEEK_SET); |
| ... | ... |
@@ -172,7 +172,7 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt) |
| 172 | 172 |
if(pal_size) memcpy(pkt->data, pal, pal_size); |
| 173 | 173 |
memcpy(pkt->data + pal_size, buf, 4); |
| 174 | 174 |
c->frames--; |
| 175 |
- c->vidpos = url_ftell(s->pb); |
|
| 175 |
+ c->vidpos = avio_tell(s->pb); |
|
| 176 | 176 |
c->readvid = 0; |
| 177 | 177 |
return 0; |
| 178 | 178 |
case MKTAG('C', 'M', 'A', 'P'):
|
| ... | ... |
@@ -198,7 +198,7 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt) |
| 198 | 198 |
if(pal_size) memcpy(pkt->data, pal, pal_size); |
| 199 | 199 |
pkt->stream_index = 0; |
| 200 | 200 |
c->frames--; |
| 201 |
- c->vidpos = url_ftell(s->pb); |
|
| 201 |
+ c->vidpos = avio_tell(s->pb); |
|
| 202 | 202 |
c->readvid = 0; |
| 203 | 203 |
return 0; |
| 204 | 204 |
default: |
| ... | ... |
@@ -293,7 +293,7 @@ static int process_ea_header(AVFormatContext *s) {
|
| 293 | 293 |
int i; |
| 294 | 294 |
|
| 295 | 295 |
for (i=0; i<5 && (!ea->audio_codec || !ea->video_codec); i++) {
|
| 296 |
- unsigned int startpos = url_ftell(pb); |
|
| 296 |
+ unsigned int startpos = avio_tell(pb); |
|
| 297 | 297 |
int err = 0; |
| 298 | 298 |
|
| 299 | 299 |
blockid = avio_rl32(pb); |
| ... | ... |
@@ -65,7 +65,7 @@ static int ffm_is_avail_data(AVFormatContext *s, int size) |
| 65 | 65 |
len = ffm->packet_end - ffm->packet_ptr; |
| 66 | 66 |
if (size <= len) |
| 67 | 67 |
return 1; |
| 68 |
- pos = url_ftell(s->pb); |
|
| 68 |
+ pos = avio_tell(s->pb); |
|
| 69 | 69 |
if (!ffm->write_index) {
|
| 70 | 70 |
if (pos == ffm->file_size) |
| 71 | 71 |
return AVERROR_EOF; |
| ... | ... |
@@ -117,7 +117,7 @@ static int ffm_read_data(AVFormatContext *s, |
| 117 | 117 |
if (len > size) |
| 118 | 118 |
len = size; |
| 119 | 119 |
if (len == 0) {
|
| 120 |
- if (url_ftell(pb) == ffm->file_size) |
|
| 120 |
+ if (avio_tell(pb) == ffm->file_size) |
|
| 121 | 121 |
avio_seek(pb, ffm->packet_size, SEEK_SET); |
| 122 | 122 |
retry_read: |
| 123 | 123 |
id = avio_rb16(pb); /* PACKET_ID */ |
| ... | ... |
@@ -136,7 +136,7 @@ static int ffm_read_data(AVFormatContext *s, |
| 136 | 136 |
if (ffm->first_packet || (frame_offset & 0x8000)) {
|
| 137 | 137 |
if (!frame_offset) {
|
| 138 | 138 |
/* This packet has no frame headers in it */ |
| 139 |
- if (url_ftell(pb) >= ffm->packet_size * 3) {
|
|
| 139 |
+ if (avio_tell(pb) >= ffm->packet_size * 3) {
|
|
| 140 | 140 |
avio_seek(pb, -ffm->packet_size * 2, SEEK_CUR); |
| 141 | 141 |
goto retry_read; |
| 142 | 142 |
} |
| ... | ... |
@@ -203,7 +203,7 @@ static void adjust_write_index(AVFormatContext *s) |
| 203 | 203 |
//int64_t orig_write_index = ffm->write_index; |
| 204 | 204 |
int64_t pos_min, pos_max; |
| 205 | 205 |
int64_t pts_start; |
| 206 |
- int64_t ptr = url_ftell(pb); |
|
| 206 |
+ int64_t ptr = avio_tell(pb); |
|
| 207 | 207 |
|
| 208 | 208 |
|
| 209 | 209 |
pos_min = 0; |
| ... | ... |
@@ -381,7 +381,7 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 381 | 381 |
} |
| 382 | 382 |
|
| 383 | 383 |
/* get until end of block reached */ |
| 384 |
- while ((url_ftell(pb) % ffm->packet_size) != 0) |
|
| 384 |
+ while ((avio_tell(pb) % ffm->packet_size) != 0) |
|
| 385 | 385 |
avio_r8(pb); |
| 386 | 386 |
|
| 387 | 387 |
/* init packet demux */ |
| ... | ... |
@@ -410,7 +410,7 @@ static int ffm_read_packet(AVFormatContext *s, AVPacket *pkt) |
| 410 | 410 |
return ret; |
| 411 | 411 |
|
| 412 | 412 |
av_dlog(s, "pos=%08"PRIx64" spos=%"PRIx64", write_index=%"PRIx64" size=%"PRIx64"\n", |
| 413 |
- url_ftell(s->pb), s->pb->pos, ffm->write_index, ffm->file_size); |
|
| 413 |
+ avio_tell(s->pb), s->pb->pos, ffm->write_index, ffm->file_size); |
|
| 414 | 414 |
if (ffm_read_data(s, ffm->header, FRAME_HEADER_SIZE, 1) != |
| 415 | 415 |
FRAME_HEADER_SIZE) |
| 416 | 416 |
return -1; |
| ... | ... |
@@ -437,7 +437,7 @@ static int ffm_read_packet(AVFormatContext *s, AVPacket *pkt) |
| 437 | 437 |
ffm->read_state = READ_HEADER; |
| 438 | 438 |
return -1; |
| 439 | 439 |
} |
| 440 |
- pkt->pos = url_ftell(s->pb); |
|
| 440 |
+ pkt->pos = avio_tell(s->pb); |
|
| 441 | 441 |
if (ffm->header[1] & FLAG_KEY_FRAME) |
| 442 | 442 |
pkt->flags |= AV_PKT_FLAG_KEY; |
| 443 | 443 |
|
| ... | ... |
@@ -32,7 +32,7 @@ static void flush_packet(AVFormatContext *s) |
| 32 | 32 |
fill_size = ffm->packet_end - ffm->packet_ptr; |
| 33 | 33 |
memset(ffm->packet_ptr, 0, fill_size); |
| 34 | 34 |
|
| 35 |
- if (url_ftell(pb) % ffm->packet_size) |
|
| 35 |
+ if (avio_tell(pb) % ffm->packet_size) |
|
| 36 | 36 |
av_abort(); |
| 37 | 37 |
|
| 38 | 38 |
/* put header */ |
| ... | ... |
@@ -184,7 +184,7 @@ static int ffm_write_header(AVFormatContext *s) |
| 184 | 184 |
} |
| 185 | 185 |
|
| 186 | 186 |
/* flush until end of block reached */ |
| 187 |
- while ((url_ftell(pb) % ffm->packet_size) != 0) |
|
| 187 |
+ while ((avio_tell(pb) % ffm->packet_size) != 0) |
|
| 188 | 188 |
avio_w8(pb, 0); |
| 189 | 189 |
|
| 190 | 190 |
put_flush_packet(pb); |
| ... | ... |
@@ -82,7 +82,7 @@ static int read_packet(AVFormatContext *s, |
| 82 | 82 |
|
| 83 | 83 |
if (url_feof(s->pb)) |
| 84 | 84 |
return AVERROR(EIO); |
| 85 |
- pkt->dts = url_ftell(s->pb) / (st->codec->width * (st->codec->height + film->leading) * 4); |
|
| 85 |
+ pkt->dts = avio_tell(s->pb) / (st->codec->width * (st->codec->height + film->leading) * 4); |
|
| 86 | 86 |
pkt->size = av_get_packet(s->pb, pkt, st->codec->width * st->codec->height * 4); |
| 87 | 87 |
avio_seek(s->pb, st->codec->width * film->leading * 4, SEEK_CUR); |
| 88 | 88 |
if (pkt->size < 0) |
| ... | ... |
@@ -100,7 +100,7 @@ static int flac_write_trailer(struct AVFormatContext *s) |
| 100 | 100 |
|
| 101 | 101 |
if (!url_is_streamed(pb)) {
|
| 102 | 102 |
/* rewrite the STREAMINFO header block data */ |
| 103 |
- file_size = url_ftell(pb); |
|
| 103 |
+ file_size = avio_tell(pb); |
|
| 104 | 104 |
avio_seek(pb, 8, SEEK_SET); |
| 105 | 105 |
avio_write(pb, streaminfo, FLAC_STREAMINFO_SIZE); |
| 106 | 106 |
avio_seek(pb, file_size, SEEK_SET); |
| ... | ... |
@@ -223,7 +223,7 @@ static int flic_read_packet(AVFormatContext *s, |
| 223 | 223 |
} |
| 224 | 224 |
pkt->stream_index = flic->video_stream_index; |
| 225 | 225 |
pkt->pts = flic->frame_number++; |
| 226 |
- pkt->pos = url_ftell(pb); |
|
| 226 |
+ pkt->pos = avio_tell(pb); |
|
| 227 | 227 |
memcpy(pkt->data, preamble, FLIC_PREAMBLE_SIZE); |
| 228 | 228 |
ret = avio_read(pb, pkt->data + FLIC_PREAMBLE_SIZE, |
| 229 | 229 |
size - FLIC_PREAMBLE_SIZE); |
| ... | ... |
@@ -242,7 +242,7 @@ static int flic_read_packet(AVFormatContext *s, |
| 242 | 242 |
avio_seek(pb, 10, SEEK_CUR); |
| 243 | 243 |
|
| 244 | 244 |
pkt->stream_index = flic->audio_stream_index; |
| 245 |
- pkt->pos = url_ftell(pb); |
|
| 245 |
+ pkt->pos = avio_tell(pb); |
|
| 246 | 246 |
ret = avio_read(pb, pkt->data, size); |
| 247 | 247 |
|
| 248 | 248 |
if (ret != size) {
|
| ... | ... |
@@ -148,7 +148,7 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst |
| 148 | 148 |
case AMF_DATA_TYPE_OBJECT: {
|
| 149 | 149 |
unsigned int keylen; |
| 150 | 150 |
|
| 151 |
- while(url_ftell(ioc) < max_pos - 2 && (keylen = avio_rb16(ioc))) {
|
|
| 151 |
+ while(avio_tell(ioc) < max_pos - 2 && (keylen = avio_rb16(ioc))) {
|
|
| 152 | 152 |
avio_seek(ioc, keylen, SEEK_CUR); //skip key string |
| 153 | 153 |
if(amf_parse_object(s, NULL, NULL, NULL, max_pos, depth + 1) < 0) |
| 154 | 154 |
return -1; //if we couldn't skip, bomb out. |
| ... | ... |
@@ -163,7 +163,7 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst |
| 163 | 163 |
break; //these take up no additional space |
| 164 | 164 |
case AMF_DATA_TYPE_MIXEDARRAY: |
| 165 | 165 |
avio_seek(ioc, 4, SEEK_CUR); //skip 32-bit max array index |
| 166 |
- while(url_ftell(ioc) < max_pos - 2 && amf_get_string(ioc, str_val, sizeof(str_val)) > 0) {
|
|
| 166 |
+ while(avio_tell(ioc) < max_pos - 2 && amf_get_string(ioc, str_val, sizeof(str_val)) > 0) {
|
|
| 167 | 167 |
//this is the only case in which we would want a nested parse to not skip over the object |
| 168 | 168 |
if(amf_parse_object(s, astream, vstream, str_val, max_pos, depth + 1) < 0) |
| 169 | 169 |
return -1; |
| ... | ... |
@@ -175,7 +175,7 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst |
| 175 | 175 |
unsigned int arraylen, i; |
| 176 | 176 |
|
| 177 | 177 |
arraylen = avio_rb32(ioc); |
| 178 |
- for(i = 0; i < arraylen && url_ftell(ioc) < max_pos - 1; i++) {
|
|
| 178 |
+ for(i = 0; i < arraylen && avio_tell(ioc) < max_pos - 1; i++) {
|
|
| 179 | 179 |
if(amf_parse_object(s, NULL, NULL, NULL, max_pos, depth + 1) < 0) |
| 180 | 180 |
return -1; //if we couldn't skip, bomb out. |
| 181 | 181 |
} |
| ... | ... |
@@ -305,7 +305,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) |
| 305 | 305 |
AVStream *st = NULL; |
| 306 | 306 |
|
| 307 | 307 |
for(;;avio_seek(s->pb, 4, SEEK_CUR)){ /* pkt size is repeated at end. skip it */
|
| 308 |
- pos = url_ftell(s->pb); |
|
| 308 |
+ pos = avio_tell(s->pb); |
|
| 309 | 309 |
type = avio_r8(s->pb); |
| 310 | 310 |
size = avio_rb24(s->pb); |
| 311 | 311 |
dts = avio_rb24(s->pb); |
| ... | ... |
@@ -319,7 +319,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) |
| 319 | 319 |
if(size == 0) |
| 320 | 320 |
continue; |
| 321 | 321 |
|
| 322 |
- next= size + url_ftell(s->pb); |
|
| 322 |
+ next= size + avio_tell(s->pb); |
|
| 323 | 323 |
|
| 324 | 324 |
if (type == FLV_TAG_TYPE_AUDIO) {
|
| 325 | 325 |
is_audio=1; |
| ... | ... |
@@ -372,7 +372,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) |
| 372 | 372 |
// if not streamed and no duration from metadata then seek to end to find the duration from the timestamps |
| 373 | 373 |
if(!url_is_streamed(s->pb) && (!s->duration || s->duration==AV_NOPTS_VALUE)){
|
| 374 | 374 |
int size; |
| 375 |
- const int64_t pos= url_ftell(s->pb); |
|
| 375 |
+ const int64_t pos= avio_tell(s->pb); |
|
| 376 | 376 |
const int64_t fsize= url_fsize(s->pb); |
| 377 | 377 |
avio_seek(s->pb, fsize-4, SEEK_SET); |
| 378 | 378 |
size= avio_rb32(s->pb); |
| ... | ... |
@@ -221,7 +221,7 @@ static int flv_write_header(AVFormatContext *s) |
| 221 | 221 |
|
| 222 | 222 |
/* write meta_tag */ |
| 223 | 223 |
avio_w8(pb, 18); // tag type META |
| 224 |
- metadata_size_pos= url_ftell(pb); |
|
| 224 |
+ metadata_size_pos= avio_tell(pb); |
|
| 225 | 225 |
avio_wb24(pb, 0); // size of data part (sum of all parts below) |
| 226 | 226 |
avio_wb24(pb, 0); // time stamp |
| 227 | 227 |
avio_wb32(pb, 0); // reserved |
| ... | ... |
@@ -237,7 +237,7 @@ static int flv_write_header(AVFormatContext *s) |
| 237 | 237 |
avio_wb32(pb, 5*!!video_enc + 5*!!audio_enc + 2); // +2 for duration and file size |
| 238 | 238 |
|
| 239 | 239 |
put_amf_string(pb, "duration"); |
| 240 |
- flv->duration_offset= url_ftell(pb); |
|
| 240 |
+ flv->duration_offset= avio_tell(pb); |
|
| 241 | 241 |
put_amf_double(pb, s->duration / AV_TIME_BASE); // fill in the guessed duration, it'll be corrected later if incorrect |
| 242 | 242 |
|
| 243 | 243 |
if(video_enc){
|
| ... | ... |
@@ -281,14 +281,14 @@ static int flv_write_header(AVFormatContext *s) |
| 281 | 281 |
} |
| 282 | 282 |
|
| 283 | 283 |
put_amf_string(pb, "filesize"); |
| 284 |
- flv->filesize_offset= url_ftell(pb); |
|
| 284 |
+ flv->filesize_offset= avio_tell(pb); |
|
| 285 | 285 |
put_amf_double(pb, 0); // delayed write |
| 286 | 286 |
|
| 287 | 287 |
put_amf_string(pb, ""); |
| 288 | 288 |
avio_w8(pb, AMF_END_OF_OBJECT); |
| 289 | 289 |
|
| 290 | 290 |
/* write total size of tag */ |
| 291 |
- data_size= url_ftell(pb) - metadata_size_pos - 10; |
|
| 291 |
+ data_size= avio_tell(pb) - metadata_size_pos - 10; |
|
| 292 | 292 |
avio_seek(pb, metadata_size_pos, SEEK_SET); |
| 293 | 293 |
avio_wb24(pb, data_size); |
| 294 | 294 |
avio_seek(pb, data_size + 10 - 3, SEEK_CUR); |
| ... | ... |
@@ -304,7 +304,7 @@ static int flv_write_header(AVFormatContext *s) |
| 304 | 304 |
avio_wb24(pb, 0); // ts |
| 305 | 305 |
avio_w8(pb, 0); // ts ext |
| 306 | 306 |
avio_wb24(pb, 0); // streamid |
| 307 |
- pos = url_ftell(pb); |
|
| 307 |
+ pos = avio_tell(pb); |
|
| 308 | 308 |
if (enc->codec_id == CODEC_ID_AAC) {
|
| 309 | 309 |
avio_w8(pb, get_audio_flags(enc)); |
| 310 | 310 |
avio_w8(pb, 0); // AAC sequence header |
| ... | ... |
@@ -315,7 +315,7 @@ static int flv_write_header(AVFormatContext *s) |
| 315 | 315 |
avio_wb24(pb, 0); // composition time |
| 316 | 316 |
ff_isom_write_avcc(pb, enc->extradata, enc->extradata_size); |
| 317 | 317 |
} |
| 318 |
- data_size = url_ftell(pb) - pos; |
|
| 318 |
+ data_size = avio_tell(pb) - pos; |
|
| 319 | 319 |
avio_seek(pb, -data_size - 10, SEEK_CUR); |
| 320 | 320 |
avio_wb24(pb, data_size); |
| 321 | 321 |
avio_seek(pb, data_size + 10 - 3, SEEK_CUR); |
| ... | ... |
@@ -343,7 +343,7 @@ static int flv_write_trailer(AVFormatContext *s) |
| 343 | 343 |
} |
| 344 | 344 |
} |
| 345 | 345 |
|
| 346 |
- file_size = url_ftell(pb); |
|
| 346 |
+ file_size = avio_tell(pb); |
|
| 347 | 347 |
|
| 348 | 348 |
/* update informations */ |
| 349 | 349 |
avio_seek(pb, flv->duration_offset, SEEK_SET); |
| ... | ... |
@@ -396,7 +396,7 @@ start: |
| 396 | 396 |
READ_ONE(); |
| 397 | 397 |
if (tmp != 1) |
| 398 | 398 |
goto start; |
| 399 |
- last_pos = url_ftell(pb); |
|
| 399 |
+ last_pos = avio_tell(pb); |
|
| 400 | 400 |
if (avio_seek(pb, -5, SEEK_CUR) < 0) |
| 401 | 401 |
goto out; |
| 402 | 402 |
if (!parse_packet_header(pb, &type, &len) || type != PKT_MEDIA) {
|
| ... | ... |
@@ -407,7 +407,7 @@ start: |
| 407 | 407 |
avio_r8(pb); |
| 408 | 408 |
cur_track = avio_r8(pb); |
| 409 | 409 |
cur_timestamp = avio_rb32(pb); |
| 410 |
- last_found_pos = url_ftell(pb) - 16 - 6; |
|
| 410 |
+ last_found_pos = avio_tell(pb) - 16 - 6; |
|
| 411 | 411 |
if ((track >= 0 && track != cur_track) || (timestamp >= 0 && timestamp > cur_timestamp)) {
|
| 412 | 412 |
if (avio_seek(pb, last_pos, SEEK_SET) >= 0) |
| 413 | 413 |
goto start; |
| ... | ... |
@@ -511,7 +511,7 @@ static int64_t gxf_read_timestamp(AVFormatContext *s, int stream_index, |
| 511 | 511 |
if (avio_seek(pb, *pos, SEEK_SET) < 0) |
| 512 | 512 |
return AV_NOPTS_VALUE; |
| 513 | 513 |
res = gxf_resync_media(s, pos_limit - *pos, -1, -1); |
| 514 |
- *pos = url_ftell(pb); |
|
| 514 |
+ *pos = avio_tell(pb); |
|
| 515 | 515 |
return res; |
| 516 | 516 |
} |
| 517 | 517 |
|
| ... | ... |
@@ -125,12 +125,12 @@ static int64_t updatePacketSize(AVIOContext *pb, int64_t pos) |
| 125 | 125 |
int64_t curpos; |
| 126 | 126 |
int size; |
| 127 | 127 |
|
| 128 |
- size = url_ftell(pb) - pos; |
|
| 128 |
+ size = avio_tell(pb) - pos; |
|
| 129 | 129 |
if (size % 4) {
|
| 130 | 130 |
gxf_write_padding(pb, 4 - size % 4); |
| 131 |
- size = url_ftell(pb) - pos; |
|
| 131 |
+ size = avio_tell(pb) - pos; |
|
| 132 | 132 |
} |
| 133 |
- curpos = url_ftell(pb); |
|
| 133 |
+ curpos = avio_tell(pb); |
|
| 134 | 134 |
avio_seek(pb, pos + 6, SEEK_SET); |
| 135 | 135 |
avio_wb32(pb, size); |
| 136 | 136 |
avio_seek(pb, curpos, SEEK_SET); |
| ... | ... |
@@ -141,7 +141,7 @@ static int64_t updateSize(AVIOContext *pb, int64_t pos) |
| 141 | 141 |
{
|
| 142 | 142 |
int64_t curpos; |
| 143 | 143 |
|
| 144 |
- curpos = url_ftell(pb); |
|
| 144 |
+ curpos = avio_tell(pb); |
|
| 145 | 145 |
avio_seek(pb, pos, SEEK_SET); |
| 146 | 146 |
avio_wb16(pb, curpos - pos - 2); |
| 147 | 147 |
avio_seek(pb, curpos, SEEK_SET); |
| ... | ... |
@@ -218,7 +218,7 @@ static int gxf_write_track_description(AVFormatContext *s, GXFStreamContext *sc, |
| 218 | 218 |
avio_w8(pb, sc->media_type + 0x80); |
| 219 | 219 |
avio_w8(pb, index + 0xC0); |
| 220 | 220 |
|
| 221 |
- pos = url_ftell(pb); |
|
| 221 |
+ pos = avio_tell(pb); |
|
| 222 | 222 |
avio_wb16(pb, 0); /* size */ |
| 223 | 223 |
|
| 224 | 224 |
/* media file name */ |
| ... | ... |
@@ -272,7 +272,7 @@ static int gxf_write_material_data_section(AVFormatContext *s) |
| 272 | 272 |
int len; |
| 273 | 273 |
const char *filename = strrchr(s->filename, '/'); |
| 274 | 274 |
|
| 275 |
- pos = url_ftell(pb); |
|
| 275 |
+ pos = avio_tell(pb); |
|
| 276 | 276 |
avio_wb16(pb, 0); /* size */ |
| 277 | 277 |
|
| 278 | 278 |
/* name */ |
| ... | ... |
@@ -322,7 +322,7 @@ static int gxf_write_track_description_section(AVFormatContext *s) |
| 322 | 322 |
int64_t pos; |
| 323 | 323 |
int i; |
| 324 | 324 |
|
| 325 |
- pos = url_ftell(pb); |
|
| 325 |
+ pos = avio_tell(pb); |
|
| 326 | 326 |
avio_wb16(pb, 0); /* size */ |
| 327 | 327 |
for (i = 0; i < s->nb_streams; ++i) |
| 328 | 328 |
gxf_write_track_description(s, s->streams[i]->priv_data, i); |
| ... | ... |
@@ -336,7 +336,7 @@ static int gxf_write_map_packet(AVFormatContext *s, int rewrite) |
| 336 | 336 |
{
|
| 337 | 337 |
GXFContext *gxf = s->priv_data; |
| 338 | 338 |
AVIOContext *pb = s->pb; |
| 339 |
- int64_t pos = url_ftell(pb); |
|
| 339 |
+ int64_t pos = avio_tell(pb); |
|
| 340 | 340 |
|
| 341 | 341 |
if (!rewrite) {
|
| 342 | 342 |
if (!(gxf->map_offsets_nb % 30)) {
|
| ... | ... |
@@ -366,7 +366,7 @@ static int gxf_write_flt_packet(AVFormatContext *s) |
| 366 | 366 |
{
|
| 367 | 367 |
GXFContext *gxf = s->priv_data; |
| 368 | 368 |
AVIOContext *pb = s->pb; |
| 369 |
- int64_t pos = url_ftell(pb); |
|
| 369 |
+ int64_t pos = avio_tell(pb); |
|
| 370 | 370 |
int fields_per_flt = (gxf->nb_fields+1) / 1000 + 1; |
| 371 | 371 |
int flt_entries = gxf->nb_fields / fields_per_flt; |
| 372 | 372 |
int i = 0; |
| ... | ... |
@@ -442,7 +442,7 @@ static int gxf_write_umf_track_description(AVFormatContext *s) |
| 442 | 442 |
{
|
| 443 | 443 |
AVIOContext *pb = s->pb; |
| 444 | 444 |
GXFContext *gxf = s->priv_data; |
| 445 |
- int64_t pos = url_ftell(pb); |
|
| 445 |
+ int64_t pos = avio_tell(pb); |
|
| 446 | 446 |
int i; |
| 447 | 447 |
|
| 448 | 448 |
gxf->umf_track_offset = pos - gxf->umf_start_offset; |
| ... | ... |
@@ -455,7 +455,7 @@ static int gxf_write_umf_track_description(AVFormatContext *s) |
| 455 | 455 |
avio_wl16(pb, gxf->timecode_track.media_info); |
| 456 | 456 |
avio_wl16(pb, 1); |
| 457 | 457 |
|
| 458 |
- return url_ftell(pb) - pos; |
|
| 458 |
+ return avio_tell(pb) - pos; |
|
| 459 | 459 |
} |
| 460 | 460 |
|
| 461 | 461 |
static int gxf_write_umf_media_mpeg(AVIOContext *pb, AVStream *st) |
| ... | ... |
@@ -533,7 +533,7 @@ static int gxf_write_umf_media_description(AVFormatContext *s) |
| 533 | 533 |
int64_t pos; |
| 534 | 534 |
int i, j; |
| 535 | 535 |
|
| 536 |
- pos = url_ftell(pb); |
|
| 536 |
+ pos = avio_tell(pb); |
|
| 537 | 537 |
gxf->umf_media_offset = pos - gxf->umf_start_offset; |
| 538 | 538 |
for (i = 0; i <= s->nb_streams; ++i) {
|
| 539 | 539 |
GXFStreamContext *sc; |
| ... | ... |
@@ -544,7 +544,7 @@ static int gxf_write_umf_media_description(AVFormatContext *s) |
| 544 | 544 |
else |
| 545 | 545 |
sc = s->streams[i]->priv_data; |
| 546 | 546 |
|
| 547 |
- startpos = url_ftell(pb); |
|
| 547 |
+ startpos = avio_tell(pb); |
|
| 548 | 548 |
avio_wl16(pb, 0); /* length */ |
| 549 | 549 |
avio_wl16(pb, sc->media_info); |
| 550 | 550 |
avio_wl16(pb, 0); /* reserved */ |
| ... | ... |
@@ -580,19 +580,19 @@ static int gxf_write_umf_media_description(AVFormatContext *s) |
| 580 | 580 |
} |
| 581 | 581 |
} |
| 582 | 582 |
|
| 583 |
- curpos = url_ftell(pb); |
|
| 583 |
+ curpos = avio_tell(pb); |
|
| 584 | 584 |
avio_seek(pb, startpos, SEEK_SET); |
| 585 | 585 |
avio_wl16(pb, curpos - startpos); |
| 586 | 586 |
avio_seek(pb, curpos, SEEK_SET); |
| 587 | 587 |
} |
| 588 |
- return url_ftell(pb) - pos; |
|
| 588 |
+ return avio_tell(pb) - pos; |
|
| 589 | 589 |
} |
| 590 | 590 |
|
| 591 | 591 |
static int gxf_write_umf_packet(AVFormatContext *s) |
| 592 | 592 |
{
|
| 593 | 593 |
GXFContext *gxf = s->priv_data; |
| 594 | 594 |
AVIOContext *pb = s->pb; |
| 595 |
- int64_t pos = url_ftell(pb); |
|
| 595 |
+ int64_t pos = avio_tell(pb); |
|
| 596 | 596 |
|
| 597 | 597 |
gxf_write_packet_header(pb, PKT_UMF); |
| 598 | 598 |
|
| ... | ... |
@@ -600,12 +600,12 @@ static int gxf_write_umf_packet(AVFormatContext *s) |
| 600 | 600 |
avio_w8(pb, 3); /* first and last (only) packet */ |
| 601 | 601 |
avio_wb32(pb, gxf->umf_length); /* data length */ |
| 602 | 602 |
|
| 603 |
- gxf->umf_start_offset = url_ftell(pb); |
|
| 603 |
+ gxf->umf_start_offset = avio_tell(pb); |
|
| 604 | 604 |
gxf_write_umf_payload(s); |
| 605 | 605 |
gxf_write_umf_material_description(s); |
| 606 | 606 |
gxf->umf_track_size = gxf_write_umf_track_description(s); |
| 607 | 607 |
gxf->umf_media_size = gxf_write_umf_media_description(s); |
| 608 |
- gxf->umf_length = url_ftell(pb) - gxf->umf_start_offset; |
|
| 608 |
+ gxf->umf_length = avio_tell(pb) - gxf->umf_start_offset; |
|
| 609 | 609 |
return updatePacketSize(pb, pos); |
| 610 | 610 |
} |
| 611 | 611 |
|
| ... | ... |
@@ -759,7 +759,7 @@ static int gxf_write_header(AVFormatContext *s) |
| 759 | 759 |
|
| 760 | 760 |
static int gxf_write_eos_packet(AVIOContext *pb) |
| 761 | 761 |
{
|
| 762 |
- int64_t pos = url_ftell(pb); |
|
| 762 |
+ int64_t pos = avio_tell(pb); |
|
| 763 | 763 |
|
| 764 | 764 |
gxf_write_packet_header(pb, PKT_EOS); |
| 765 | 765 |
return updatePacketSize(pb, pos); |
| ... | ... |
@@ -775,7 +775,7 @@ static int gxf_write_trailer(AVFormatContext *s) |
| 775 | 775 |
ff_audio_interleave_close(s); |
| 776 | 776 |
|
| 777 | 777 |
gxf_write_eos_packet(pb); |
| 778 |
- end = url_ftell(pb); |
|
| 778 |
+ end = avio_tell(pb); |
|
| 779 | 779 |
avio_seek(pb, 0, SEEK_SET); |
| 780 | 780 |
/* overwrite map, flt and umf packets with new values */ |
| 781 | 781 |
gxf_write_map_packet(s, 1); |
| ... | ... |
@@ -861,9 +861,9 @@ static int gxf_write_packet(AVFormatContext *s, AVPacket *pkt) |
| 861 | 861 |
GXFContext *gxf = s->priv_data; |
| 862 | 862 |
AVIOContext *pb = s->pb; |
| 863 | 863 |
AVStream *st = s->streams[pkt->stream_index]; |
| 864 |
- int64_t pos = url_ftell(pb); |
|
| 864 |
+ int64_t pos = avio_tell(pb); |
|
| 865 | 865 |
int padding = 0; |
| 866 |
- int packet_start_offset = url_ftell(pb) / 1024; |
|
| 866 |
+ int packet_start_offset = avio_tell(pb) / 1024; |
|
| 867 | 867 |
|
| 868 | 868 |
gxf_write_packet_header(pb, PKT_MEDIA); |
| 869 | 869 |
if (st->codec->codec_id == CODEC_ID_MPEG2VIDEO && pkt->size % 4) /* MPEG-2 frames must be padded */ |
| ... | ... |
@@ -196,7 +196,7 @@ static void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t |
| 196 | 196 |
if (len < 0) |
| 197 | 197 |
break; |
| 198 | 198 |
|
| 199 |
- next = url_ftell(s->pb) + tlen; |
|
| 199 |
+ next = avio_tell(s->pb) + tlen; |
|
| 200 | 200 |
|
| 201 | 201 |
if (tflags & ID3v2_FLAG_DATALEN) {
|
| 202 | 202 |
avio_rb32(s->pb); |
| ... | ... |
@@ -258,7 +258,7 @@ void ff_id3v2_read(AVFormatContext *s, const char *magic) |
| 258 | 258 |
|
| 259 | 259 |
do {
|
| 260 | 260 |
/* save the current offset in case there's nothing to read/skip */ |
| 261 |
- off = url_ftell(s->pb); |
|
| 261 |
+ off = avio_tell(s->pb); |
|
| 262 | 262 |
ret = avio_read(s->pb, buf, ID3v2_HEADER_SIZE); |
| 263 | 263 |
if (ret != ID3v2_HEADER_SIZE) |
| 264 | 264 |
break; |
| ... | ... |
@@ -141,7 +141,7 @@ static int roq_read_packet(AVFormatContext *s, |
| 141 | 141 |
|
| 142 | 142 |
case RoQ_QUAD_CODEBOOK: |
| 143 | 143 |
/* packet needs to contain both this codebook and next VQ chunk */ |
| 144 |
- codebook_offset = url_ftell(pb) - RoQ_CHUNK_PREAMBLE_SIZE; |
|
| 144 |
+ codebook_offset = avio_tell(pb) - RoQ_CHUNK_PREAMBLE_SIZE; |
|
| 145 | 145 |
codebook_size = chunk_size; |
| 146 | 146 |
avio_seek(pb, codebook_size, SEEK_CUR); |
| 147 | 147 |
if (avio_read(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) != |
| ... | ... |
@@ -197,7 +197,7 @@ static int roq_read_packet(AVFormatContext *s, |
| 197 | 197 |
roq->audio_frame_count += (chunk_size / roq->audio_channels); |
| 198 | 198 |
} |
| 199 | 199 |
|
| 200 |
- pkt->pos= url_ftell(pb); |
|
| 200 |
+ pkt->pos= avio_tell(pb); |
|
| 201 | 201 |
ret = avio_read(pb, pkt->data + RoQ_CHUNK_PREAMBLE_SIZE, |
| 202 | 202 |
chunk_size); |
| 203 | 203 |
if (ret != chunk_size) |
| ... | ... |
@@ -144,7 +144,7 @@ static int iff_read_header(AVFormatContext *s, |
| 144 | 144 |
const char *metadata_tag = NULL; |
| 145 | 145 |
chunk_id = avio_rl32(pb); |
| 146 | 146 |
data_size = avio_rb32(pb); |
| 147 |
- orig_pos = url_ftell(pb); |
|
| 147 |
+ orig_pos = avio_tell(pb); |
|
| 148 | 148 |
|
| 149 | 149 |
switch(chunk_id) {
|
| 150 | 150 |
case ID_VHDR: |
| ... | ... |
@@ -161,7 +161,7 @@ static int iff_read_header(AVFormatContext *s, |
| 161 | 161 |
break; |
| 162 | 162 |
|
| 163 | 163 |
case ID_BODY: |
| 164 |
- iff->body_pos = url_ftell(pb); |
|
| 164 |
+ iff->body_pos = avio_tell(pb); |
|
| 165 | 165 |
iff->body_size = data_size; |
| 166 | 166 |
break; |
| 167 | 167 |
|
| ... | ... |
@@ -223,7 +223,7 @@ static int iff_read_header(AVFormatContext *s, |
| 223 | 223 |
return res; |
| 224 | 224 |
} |
| 225 | 225 |
} |
| 226 |
- avio_seek(pb, data_size - (url_ftell(pb) - orig_pos) + (data_size & 1), SEEK_CUR); |
|
| 226 |
+ avio_seek(pb, data_size - (avio_tell(pb) - orig_pos) + (data_size & 1), SEEK_CUR); |
|
| 227 | 227 |
} |
| 228 | 228 |
|
| 229 | 229 |
avio_seek(pb, iff->body_pos, SEEK_SET); |
| ... | ... |
@@ -47,7 +47,7 @@ static int ingenient_read_packet(AVFormatContext *s, AVPacket *pkt) |
| 47 | 47 |
if (av_new_packet(pkt, size) < 0) |
| 48 | 48 |
return AVERROR(ENOMEM); |
| 49 | 49 |
|
| 50 |
- pkt->pos = url_ftell(s->pb); |
|
| 50 |
+ pkt->pos = avio_tell(s->pb); |
|
| 51 | 51 |
pkt->stream_index = 0; |
| 52 | 52 |
ret = avio_read(s->pb, pkt->data, size); |
| 53 | 53 |
if (ret < 0) {
|
| ... | ... |
@@ -405,7 +405,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb, |
| 405 | 405 |
debug_ipmovie("audio frame\n");
|
| 406 | 406 |
|
| 407 | 407 |
/* log position and move on for now */ |
| 408 |
- s->audio_chunk_offset = url_ftell(pb); |
|
| 408 |
+ s->audio_chunk_offset = avio_tell(pb); |
|
| 409 | 409 |
s->audio_chunk_size = opcode_size; |
| 410 | 410 |
avio_seek(pb, opcode_size, SEEK_CUR); |
| 411 | 411 |
break; |
| ... | ... |
@@ -471,7 +471,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb, |
| 471 | 471 |
debug_ipmovie("set decoding map\n");
|
| 472 | 472 |
|
| 473 | 473 |
/* log position and move on for now */ |
| 474 |
- s->decode_map_chunk_offset = url_ftell(pb); |
|
| 474 |
+ s->decode_map_chunk_offset = avio_tell(pb); |
|
| 475 | 475 |
s->decode_map_chunk_size = opcode_size; |
| 476 | 476 |
avio_seek(pb, opcode_size, SEEK_CUR); |
| 477 | 477 |
break; |
| ... | ... |
@@ -480,7 +480,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb, |
| 480 | 480 |
debug_ipmovie("set video data\n");
|
| 481 | 481 |
|
| 482 | 482 |
/* log position and move on for now */ |
| 483 |
- s->video_chunk_offset = url_ftell(pb); |
|
| 483 |
+ s->video_chunk_offset = avio_tell(pb); |
|
| 484 | 484 |
s->video_chunk_size = opcode_size; |
| 485 | 485 |
avio_seek(pb, opcode_size, SEEK_CUR); |
| 486 | 486 |
break; |
| ... | ... |
@@ -494,7 +494,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb, |
| 494 | 494 |
} |
| 495 | 495 |
|
| 496 | 496 |
/* make a note of where the stream is sitting */ |
| 497 |
- s->next_chunk_offset = url_ftell(pb); |
|
| 497 |
+ s->next_chunk_offset = avio_tell(pb); |
|
| 498 | 498 |
|
| 499 | 499 |
/* dispatch the first of any pending packets */ |
| 500 | 500 |
if ((chunk_type == CHUNK_VIDEO) || (chunk_type == CHUNK_AUDIO_ONLY)) |
| ... | ... |
@@ -541,7 +541,7 @@ static int ipmovie_read_header(AVFormatContext *s, |
| 541 | 541 |
ipmovie->decode_map_chunk_offset = 0; |
| 542 | 542 |
|
| 543 | 543 |
/* on the first read, this will position the stream at the first chunk */ |
| 544 |
- ipmovie->next_chunk_offset = url_ftell(pb) + 4; |
|
| 544 |
+ ipmovie->next_chunk_offset = avio_tell(pb) + 4; |
|
| 545 | 545 |
|
| 546 | 546 |
/* process the first chunk which should be CHUNK_INIT_VIDEO */ |
| 547 | 547 |
if (process_ipmovie_chunk(ipmovie, pb, &pkt) != CHUNK_INIT_VIDEO) |
| ... | ... |
@@ -87,7 +87,7 @@ static av_cold int iss_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 87 | 87 |
get_token(pb, token, sizeof(token)); //Version ID |
| 88 | 88 |
get_token(pb, token, sizeof(token)); //Size |
| 89 | 89 |
|
| 90 |
- iss->sample_start_pos = url_ftell(pb); |
|
| 90 |
+ iss->sample_start_pos = avio_tell(pb); |
|
| 91 | 91 |
|
| 92 | 92 |
st = av_new_stream(s, 0); |
| 93 | 93 |
if (!st) |
| ... | ... |
@@ -116,7 +116,7 @@ static int iss_read_packet(AVFormatContext *s, AVPacket *pkt) |
| 116 | 116 |
return AVERROR(EIO); |
| 117 | 117 |
|
| 118 | 118 |
pkt->stream_index = 0; |
| 119 |
- pkt->pts = url_ftell(s->pb) - iss->sample_start_pos; |
|
| 119 |
+ pkt->pts = avio_tell(s->pb) - iss->sample_start_pos; |
|
| 120 | 120 |
if(s->streams[0]->codec->channels > 0) |
| 121 | 121 |
pkt->pts /= s->streams[0]->codec->channels*2; |
| 122 | 122 |
return 0; |
| ... | ... |
@@ -272,7 +272,7 @@ static int nut_read_packet(AVFormatContext * avf, AVPacket * pkt) {
|
| 272 | 272 |
if (pd.flags & NUT_FLAG_KEY) pkt->flags |= AV_PKT_FLAG_KEY; |
| 273 | 273 |
pkt->pts = pd.pts; |
| 274 | 274 |
pkt->stream_index = pd.stream; |
| 275 |
- pkt->pos = url_ftell(avf->pb); |
|
| 275 |
+ pkt->pos = avio_tell(avf->pb); |
|
| 276 | 276 |
|
| 277 | 277 |
ret = nut_read_frame(priv->nut, &pd.len, pkt->data); |
| 278 | 278 |
|
| ... | ... |
@@ -517,7 +517,7 @@ static const char *matroska_doctypes[] = { "matroska", "webm" };
|
| 517 | 517 |
static int ebml_level_end(MatroskaDemuxContext *matroska) |
| 518 | 518 |
{
|
| 519 | 519 |
AVIOContext *pb = matroska->ctx->pb; |
| 520 |
- int64_t pos = url_ftell(pb); |
|
| 520 |
+ int64_t pos = avio_tell(pb); |
|
| 521 | 521 |
|
| 522 | 522 |
if (matroska->num_levels > 0) {
|
| 523 | 523 |
MatroskaLevel *level = &matroska->levels[matroska->num_levels - 1]; |
| ... | ... |
@@ -549,7 +549,7 @@ static int ebml_read_num(MatroskaDemuxContext *matroska, AVIOContext *pb, |
| 549 | 549 |
if (!(total = avio_r8(pb))) {
|
| 550 | 550 |
/* we might encounter EOS here */ |
| 551 | 551 |
if (!url_feof(pb)) {
|
| 552 |
- int64_t pos = url_ftell(pb); |
|
| 552 |
+ int64_t pos = avio_tell(pb); |
|
| 553 | 553 |
av_log(matroska->ctx, AV_LOG_ERROR, |
| 554 | 554 |
"Read error at pos. %"PRIu64" (0x%"PRIx64")\n", |
| 555 | 555 |
pos, pos); |
| ... | ... |
@@ -560,7 +560,7 @@ static int ebml_read_num(MatroskaDemuxContext *matroska, AVIOContext *pb, |
| 560 | 560 |
/* get the length of the EBML number */ |
| 561 | 561 |
read = 8 - ff_log2_tab[total]; |
| 562 | 562 |
if (read > max_size) {
|
| 563 |
- int64_t pos = url_ftell(pb) - 1; |
|
| 563 |
+ int64_t pos = avio_tell(pb) - 1; |
|
| 564 | 564 |
av_log(matroska->ctx, AV_LOG_ERROR, |
| 565 | 565 |
"Invalid EBML number size tag 0x%02x at pos %"PRIu64" (0x%"PRIx64")\n", |
| 566 | 566 |
(uint8_t) total, pos, pos); |
| ... | ... |
@@ -659,7 +659,7 @@ static int ebml_read_binary(AVIOContext *pb, int length, EbmlBin *bin) |
| 659 | 659 |
return AVERROR(ENOMEM); |
| 660 | 660 |
|
| 661 | 661 |
bin->size = length; |
| 662 |
- bin->pos = url_ftell(pb); |
|
| 662 |
+ bin->pos = avio_tell(pb); |
|
| 663 | 663 |
if (avio_read(pb, bin->data, length) != length) {
|
| 664 | 664 |
av_freep(&bin->data); |
| 665 | 665 |
return AVERROR(EIO); |
| ... | ... |
@@ -685,7 +685,7 @@ static int ebml_read_master(MatroskaDemuxContext *matroska, uint64_t length) |
| 685 | 685 |
} |
| 686 | 686 |
|
| 687 | 687 |
level = &matroska->levels[matroska->num_levels++]; |
| 688 |
- level->start = url_ftell(pb); |
|
| 688 |
+ level->start = avio_tell(pb); |
|
| 689 | 689 |
level->length = length; |
| 690 | 690 |
|
| 691 | 691 |
return 0; |
| ... | ... |
@@ -827,7 +827,7 @@ static int ebml_parse_elem(MatroskaDemuxContext *matroska, |
| 827 | 827 |
case EBML_NEST: if ((res=ebml_read_master(matroska, length)) < 0) |
| 828 | 828 |
return res; |
| 829 | 829 |
if (id == MATROSKA_ID_SEGMENT) |
| 830 |
- matroska->segment_start = url_ftell(matroska->ctx->pb); |
|
| 830 |
+ matroska->segment_start = avio_tell(matroska->ctx->pb); |
|
| 831 | 831 |
return ebml_parse_nest(matroska, syntax->def.n, data); |
| 832 | 832 |
case EBML_PASS: return ebml_parse_id(matroska, syntax->def.n, id, data); |
| 833 | 833 |
case EBML_STOP: return 1; |
| ... | ... |
@@ -1111,7 +1111,7 @@ static void matroska_execute_seekhead(MatroskaDemuxContext *matroska) |
| 1111 | 1111 |
EbmlList *seekhead_list = &matroska->seekhead; |
| 1112 | 1112 |
MatroskaSeekhead *seekhead = seekhead_list->elem; |
| 1113 | 1113 |
uint32_t level_up = matroska->level_up; |
| 1114 |
- int64_t before_pos = url_ftell(matroska->ctx->pb); |
|
| 1114 |
+ int64_t before_pos = avio_tell(matroska->ctx->pb); |
|
| 1115 | 1115 |
uint32_t saved_id = matroska->current_id; |
| 1116 | 1116 |
MatroskaLevel level; |
| 1117 | 1117 |
int i; |
| ... | ... |
@@ -1842,7 +1842,7 @@ static int matroska_parse_cluster(MatroskaDemuxContext *matroska) |
| 1842 | 1842 |
EbmlList *blocks_list; |
| 1843 | 1843 |
MatroskaBlock *blocks; |
| 1844 | 1844 |
int i, res; |
| 1845 |
- int64_t pos = url_ftell(matroska->ctx->pb); |
|
| 1845 |
+ int64_t pos = avio_tell(matroska->ctx->pb); |
|
| 1846 | 1846 |
matroska->prev_pkt = NULL; |
| 1847 | 1847 |
if (matroska->current_id) |
| 1848 | 1848 |
pos -= 4; /* sizeof the ID which was already read */ |
| ... | ... |
@@ -203,7 +203,7 @@ static void put_ebml_string(AVIOContext *pb, unsigned int elementid, const char |
| 203 | 203 |
*/ |
| 204 | 204 |
static void put_ebml_void(AVIOContext *pb, uint64_t size) |
| 205 | 205 |
{
|
| 206 |
- int64_t currentpos = url_ftell(pb); |
|
| 206 |
+ int64_t currentpos = avio_tell(pb); |
|
| 207 | 207 |
|
| 208 | 208 |
assert(size >= 2); |
| 209 | 209 |
|
| ... | ... |
@@ -215,7 +215,7 @@ static void put_ebml_void(AVIOContext *pb, uint64_t size) |
| 215 | 215 |
put_ebml_num(pb, size-1, 0); |
| 216 | 216 |
else |
| 217 | 217 |
put_ebml_num(pb, size-9, 8); |
| 218 |
- while(url_ftell(pb) < currentpos + size) |
|
| 218 |
+ while(avio_tell(pb) < currentpos + size) |
|
| 219 | 219 |
avio_w8(pb, 0); |
| 220 | 220 |
} |
| 221 | 221 |
|
| ... | ... |
@@ -224,12 +224,12 @@ static ebml_master start_ebml_master(AVIOContext *pb, unsigned int elementid, ui |
| 224 | 224 |
int bytes = expectedsize ? ebml_num_size(expectedsize) : 8; |
| 225 | 225 |
put_ebml_id(pb, elementid); |
| 226 | 226 |
put_ebml_size_unknown(pb, bytes); |
| 227 |
- return (ebml_master){ url_ftell(pb), bytes };
|
|
| 227 |
+ return (ebml_master){ avio_tell(pb), bytes };
|
|
| 228 | 228 |
} |
| 229 | 229 |
|
| 230 | 230 |
static void end_ebml_master(AVIOContext *pb, ebml_master master) |
| 231 | 231 |
{
|
| 232 |
- int64_t pos = url_ftell(pb); |
|
| 232 |
+ int64_t pos = avio_tell(pb); |
|
| 233 | 233 |
|
| 234 | 234 |
if (avio_seek(pb, master.pos - master.sizebytes, SEEK_SET) < 0) |
| 235 | 235 |
return; |
| ... | ... |
@@ -265,7 +265,7 @@ static mkv_seekhead * mkv_start_seekhead(AVIOContext *pb, int64_t segment_offset |
| 265 | 265 |
new_seekhead->segment_offset = segment_offset; |
| 266 | 266 |
|
| 267 | 267 |
if (numelements > 0) {
|
| 268 |
- new_seekhead->filepos = url_ftell(pb); |
|
| 268 |
+ new_seekhead->filepos = avio_tell(pb); |
|
| 269 | 269 |
// 21 bytes max for a seek entry, 10 bytes max for the SeekHead ID |
| 270 | 270 |
// and size, and 3 bytes to guarantee that an EBML void element |
| 271 | 271 |
// will fit afterwards |
| ... | ... |
@@ -310,7 +310,7 @@ static int64_t mkv_write_seekhead(AVIOContext *pb, mkv_seekhead *seekhead) |
| 310 | 310 |
int64_t currentpos; |
| 311 | 311 |
int i; |
| 312 | 312 |
|
| 313 |
- currentpos = url_ftell(pb); |
|
| 313 |
+ currentpos = avio_tell(pb); |
|
| 314 | 314 |
|
| 315 | 315 |
if (seekhead->reserved_size > 0) |
| 316 | 316 |
if (avio_seek(pb, seekhead->filepos, SEEK_SET) < 0) |
| ... | ... |
@@ -332,7 +332,7 @@ static int64_t mkv_write_seekhead(AVIOContext *pb, mkv_seekhead *seekhead) |
| 332 | 332 |
end_ebml_master(pb, metaseek); |
| 333 | 333 |
|
| 334 | 334 |
if (seekhead->reserved_size > 0) {
|
| 335 |
- uint64_t remaining = seekhead->filepos + seekhead->reserved_size - url_ftell(pb); |
|
| 335 |
+ uint64_t remaining = seekhead->filepos + seekhead->reserved_size - avio_tell(pb); |
|
| 336 | 336 |
put_ebml_void(pb, remaining); |
| 337 | 337 |
avio_seek(pb, currentpos, SEEK_SET); |
| 338 | 338 |
|
| ... | ... |
@@ -379,7 +379,7 @@ static int64_t mkv_write_cues(AVIOContext *pb, mkv_cues *cues, int num_tracks) |
| 379 | 379 |
int64_t currentpos; |
| 380 | 380 |
int i, j; |
| 381 | 381 |
|
| 382 |
- currentpos = url_ftell(pb); |
|
| 382 |
+ currentpos = avio_tell(pb); |
|
| 383 | 383 |
cues_element = start_ebml_master(pb, MATROSKA_ID_CUES, 0); |
| 384 | 384 |
|
| 385 | 385 |
for (i = 0; i < cues->num_entries; i++) {
|
| ... | ... |
@@ -526,7 +526,7 @@ static int mkv_write_tracks(AVFormatContext *s) |
| 526 | 526 |
ebml_master tracks; |
| 527 | 527 |
int i, j, ret; |
| 528 | 528 |
|
| 529 |
- ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_TRACKS, url_ftell(pb)); |
|
| 529 |
+ ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_TRACKS, avio_tell(pb)); |
|
| 530 | 530 |
if (ret < 0) return ret; |
| 531 | 531 |
|
| 532 | 532 |
tracks = start_ebml_master(pb, MATROSKA_ID_TRACKS, 0); |
| ... | ... |
@@ -658,7 +658,7 @@ static int mkv_write_chapters(AVFormatContext *s) |
| 658 | 658 |
if (!s->nb_chapters) |
| 659 | 659 |
return 0; |
| 660 | 660 |
|
| 661 |
- ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_CHAPTERS, url_ftell(pb)); |
|
| 661 |
+ ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_CHAPTERS, avio_tell(pb)); |
|
| 662 | 662 |
if (ret < 0) return ret; |
| 663 | 663 |
|
| 664 | 664 |
chapters = start_ebml_master(pb, MATROSKA_ID_CHAPTERS , 0); |
| ... | ... |
@@ -730,7 +730,7 @@ static int mkv_write_tag(AVFormatContext *s, AVMetadata *m, unsigned int element |
| 730 | 730 |
int ret; |
| 731 | 731 |
|
| 732 | 732 |
if (!tags->pos) {
|
| 733 |
- ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_TAGS, url_ftell(s->pb)); |
|
| 733 |
+ ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_TAGS, avio_tell(s->pb)); |
|
| 734 | 734 |
if (ret < 0) return ret; |
| 735 | 735 |
|
| 736 | 736 |
*tags = start_ebml_master(s->pb, MATROSKA_ID_TAGS, 0); |
| ... | ... |
@@ -813,7 +813,7 @@ static int mkv_write_header(AVFormatContext *s) |
| 813 | 813 |
end_ebml_master(pb, ebml_header); |
| 814 | 814 |
|
| 815 | 815 |
mkv->segment = start_ebml_master(pb, MATROSKA_ID_SEGMENT, 0); |
| 816 |
- mkv->segment_offset = url_ftell(pb); |
|
| 816 |
+ mkv->segment_offset = avio_tell(pb); |
|
| 817 | 817 |
|
| 818 | 818 |
// we write 2 seek heads - one at the end of the file to point to each |
| 819 | 819 |
// cluster, and one at the beginning to point to all other level one |
| ... | ... |
@@ -824,7 +824,7 @@ static int mkv_write_header(AVFormatContext *s) |
| 824 | 824 |
if (!mkv->main_seekhead) |
| 825 | 825 |
return AVERROR(ENOMEM); |
| 826 | 826 |
|
| 827 |
- ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_INFO, url_ftell(pb)); |
|
| 827 |
+ ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_INFO, avio_tell(pb)); |
|
| 828 | 828 |
if (ret < 0) return ret; |
| 829 | 829 |
|
| 830 | 830 |
segment_info = start_ebml_master(pb, MATROSKA_ID_INFO, 0); |
| ... | ... |
@@ -847,7 +847,7 @@ static int mkv_write_header(AVFormatContext *s) |
| 847 | 847 |
|
| 848 | 848 |
// reserve space for the duration |
| 849 | 849 |
mkv->duration = 0; |
| 850 |
- mkv->duration_offset = url_ftell(pb); |
|
| 850 |
+ mkv->duration_offset = avio_tell(pb); |
|
| 851 | 851 |
put_ebml_void(pb, 11); // assumes double-precision float to be written |
| 852 | 852 |
end_ebml_master(pb, segment_info); |
| 853 | 853 |
|
| ... | ... |
@@ -928,7 +928,7 @@ static int mkv_write_ass_blocks(AVFormatContext *s, AVIOContext *pb, AVPacket *p |
| 928 | 928 |
|
| 929 | 929 |
av_log(s, AV_LOG_DEBUG, "Writing block at offset %" PRIu64 ", size %d, " |
| 930 | 930 |
"pts %" PRId64 ", duration %d\n", |
| 931 |
- url_ftell(pb), size, pkt->pts, duration); |
|
| 931 |
+ avio_tell(pb), size, pkt->pts, duration); |
|
| 932 | 932 |
blockgroup = start_ebml_master(pb, MATROSKA_ID_BLOCKGROUP, mkv_blockgroup_size(size)); |
| 933 | 933 |
put_ebml_id(pb, MATROSKA_ID_BLOCK); |
| 934 | 934 |
put_ebml_num(pb, size+4, 0); |
| ... | ... |
@@ -957,7 +957,7 @@ static void mkv_write_block(AVFormatContext *s, AVIOContext *pb, |
| 957 | 957 |
|
| 958 | 958 |
av_log(s, AV_LOG_DEBUG, "Writing block at offset %" PRIu64 ", size %d, " |
| 959 | 959 |
"pts %" PRId64 ", dts %" PRId64 ", duration %d, flags %d\n", |
| 960 |
- url_ftell(pb), pkt->size, pkt->pts, pkt->dts, pkt->duration, flags); |
|
| 960 |
+ avio_tell(pb), pkt->size, pkt->pts, pkt->dts, pkt->duration, flags); |
|
| 961 | 961 |
if (codec->codec_id == CODEC_ID_H264 && codec->extradata_size > 0 && |
| 962 | 962 |
(AV_RB24(codec->extradata) == 1 || AV_RB32(codec->extradata) == 1)) |
| 963 | 963 |
ff_avc_parse_nal_units_buf(pkt->data, &data, &size); |
| ... | ... |
@@ -1045,7 +1045,7 @@ static int mkv_write_packet_internal(AVFormatContext *s, AVPacket *pkt) |
| 1045 | 1045 |
} |
| 1046 | 1046 |
|
| 1047 | 1047 |
if (!mkv->cluster_pos) {
|
| 1048 |
- mkv->cluster_pos = url_ftell(s->pb); |
|
| 1048 |
+ mkv->cluster_pos = avio_tell(s->pb); |
|
| 1049 | 1049 |
mkv->cluster = start_ebml_master(pb, MATROSKA_ID_CLUSTER, 0); |
| 1050 | 1050 |
put_ebml_uint(pb, MATROSKA_ID_CLUSTERTIMECODE, FFMAX(0, ts)); |
| 1051 | 1051 |
mkv->cluster_pts = FFMAX(0, ts); |
| ... | ... |
@@ -1094,7 +1094,7 @@ static int mkv_write_packet(AVFormatContext *s, AVPacket *pkt) |
| 1094 | 1094 |
AVCodecContext *codec = s->streams[pkt->stream_index]->codec; |
| 1095 | 1095 |
int ret, keyframe = !!(pkt->flags & AV_PKT_FLAG_KEY); |
| 1096 | 1096 |
int64_t ts = mkv->tracks[pkt->stream_index].write_dts ? pkt->dts : pkt->pts; |
| 1097 |
- int cluster_size = url_ftell(pb) - (url_is_streamed(s->pb) ? 0 : mkv->cluster_pos); |
|
| 1097 |
+ int cluster_size = avio_tell(pb) - (url_is_streamed(s->pb) ? 0 : mkv->cluster_pos); |
|
| 1098 | 1098 |
|
| 1099 | 1099 |
// start a new cluster every 5 MB or 5 sec, or 32k / 1 sec for streaming or |
| 1100 | 1100 |
// after 4k and on a keyframe |
| ... | ... |
@@ -1103,7 +1103,7 @@ static int mkv_write_packet(AVFormatContext *s, AVPacket *pkt) |
| 1103 | 1103 |
|| cluster_size > 5*1024*1024 || ts > mkv->cluster_pts + 5000 |
| 1104 | 1104 |
|| (codec->codec_type == AVMEDIA_TYPE_VIDEO && keyframe && cluster_size > 4*1024))) {
|
| 1105 | 1105 |
av_log(s, AV_LOG_DEBUG, "Starting new cluster at offset %" PRIu64 |
| 1106 |
- " bytes, pts %" PRIu64 "\n", url_ftell(pb), ts); |
|
| 1106 |
+ " bytes, pts %" PRIu64 "\n", avio_tell(pb), ts); |
|
| 1107 | 1107 |
end_ebml_master(pb, mkv->cluster); |
| 1108 | 1108 |
mkv->cluster_pos = 0; |
| 1109 | 1109 |
if (mkv->dyn_bc) |
| ... | ... |
@@ -1162,7 +1162,7 @@ static int mkv_write_trailer(AVFormatContext *s) |
| 1162 | 1162 |
|
| 1163 | 1163 |
// update the duration |
| 1164 | 1164 |
av_log(s, AV_LOG_DEBUG, "end duration = %" PRIu64 "\n", mkv->duration); |
| 1165 |
- currentpos = url_ftell(pb); |
|
| 1165 |
+ currentpos = avio_tell(pb); |
|
| 1166 | 1166 |
avio_seek(pb, mkv->duration_offset, SEEK_SET); |
| 1167 | 1167 |
put_ebml_float(pb, MATROSKA_ID_DURATION, mkv->duration); |
| 1168 | 1168 |
|
| ... | ... |
@@ -52,7 +52,7 @@ static void end_tag_be(AVIOContext *pb, int64_t start) |
| 52 | 52 |
{
|
| 53 | 53 |
int64_t pos; |
| 54 | 54 |
|
| 55 |
- pos = url_ftell(pb); |
|
| 55 |
+ pos = avio_tell(pb); |
|
| 56 | 56 |
avio_seek(pb, start - 4, SEEK_SET); |
| 57 | 57 |
avio_wb32(pb, (uint32_t)(pos - start)); |
| 58 | 58 |
avio_seek(pb, pos, SEEK_SET); |
| ... | ... |
@@ -84,7 +84,7 @@ static int mmf_write_header(AVFormatContext *s) |
| 84 | 84 |
|
| 85 | 85 |
avio_write(pb, "ATR\x00", 4); |
| 86 | 86 |
avio_wb32(pb, 0); |
| 87 |
- mmf->atrpos = url_ftell(pb); |
|
| 87 |
+ mmf->atrpos = avio_tell(pb); |
|
| 88 | 88 |
avio_w8(pb, 0); /* format type */ |
| 89 | 89 |
avio_w8(pb, 0); /* sequence type */ |
| 90 | 90 |
avio_w8(pb, (0 << 7) | (1 << 4) | rate); /* (channel << 7) | (format << 4) | rate */ |
| ... | ... |
@@ -94,7 +94,7 @@ static int mmf_write_header(AVFormatContext *s) |
| 94 | 94 |
|
| 95 | 95 |
ffio_wfourcc(pb, "Atsq"); |
| 96 | 96 |
avio_wb32(pb, 16); |
| 97 |
- mmf->atsqpos = url_ftell(pb); |
|
| 97 |
+ mmf->atsqpos = avio_tell(pb); |
|
| 98 | 98 |
/* Will be filled on close */ |
| 99 | 99 |
avio_write(pb, "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 16); |
| 100 | 100 |
|
| ... | ... |
@@ -139,7 +139,7 @@ static int mmf_write_trailer(AVFormatContext *s) |
| 139 | 139 |
end_tag_be(pb, mmf->atrpos); |
| 140 | 140 |
end_tag_be(pb, 8); |
| 141 | 141 |
|
| 142 |
- pos = url_ftell(pb); |
|
| 142 |
+ pos = avio_tell(pb); |
|
| 143 | 143 |
size = pos - mmf->awapos; |
| 144 | 144 |
|
| 145 | 145 |
/* Fill Atsq chunk */ |
| ... | ... |
@@ -298,7 +298,7 @@ static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom) |
| 298 | 298 |
if (!parse) { /* skip leaf atoms data */
|
| 299 | 299 |
avio_seek(pb, a.size, SEEK_CUR); |
| 300 | 300 |
} else {
|
| 301 |
- int64_t start_pos = url_ftell(pb); |
|
| 301 |
+ int64_t start_pos = avio_tell(pb); |
|
| 302 | 302 |
int64_t left; |
| 303 | 303 |
int err = parse(c, pb, a); |
| 304 | 304 |
if (err < 0) |
| ... | ... |
@@ -306,7 +306,7 @@ static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom) |
| 306 | 306 |
if (c->found_moov && c->found_mdat && |
| 307 | 307 |
(url_is_streamed(pb) || start_pos + a.size == url_fsize(pb))) |
| 308 | 308 |
return 0; |
| 309 |
- left = a.size - url_ftell(pb) + start_pos; |
|
| 309 |
+ left = a.size - avio_tell(pb) + start_pos; |
|
| 310 | 310 |
if (left > 0) /* skip garbage at atom end */ |
| 311 | 311 |
avio_seek(pb, left, SEEK_CUR); |
| 312 | 312 |
} |
| ... | ... |
@@ -343,7 +343,7 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom) |
| 343 | 343 |
for (i = 0; i < sc->drefs_count; i++) {
|
| 344 | 344 |
MOVDref *dref = &sc->drefs[i]; |
| 345 | 345 |
uint32_t size = avio_rb32(pb); |
| 346 |
- int64_t next = url_ftell(pb) + size - 4; |
|
| 346 |
+ int64_t next = avio_tell(pb) + size - 4; |
|
| 347 | 347 |
|
| 348 | 348 |
if (size < 12) |
| 349 | 349 |
return -1; |
| ... | ... |
@@ -383,7 +383,7 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom) |
| 383 | 383 |
|
| 384 | 384 |
avio_seek(pb, 16, SEEK_CUR); |
| 385 | 385 |
|
| 386 |
- for (type = 0; type != -1 && url_ftell(pb) < next; ) {
|
|
| 386 |
+ for (type = 0; type != -1 && avio_tell(pb) < next; ) {
|
|
| 387 | 387 |
type = avio_rb16(pb); |
| 388 | 388 |
len = avio_rb16(pb); |
| 389 | 389 |
av_log(c->fc, AV_LOG_DEBUG, "type %d, len %d\n", type, len); |
| ... | ... |
@@ -583,7 +583,7 @@ static int mov_read_moov(MOVContext *c, AVIOContext *pb, MOVAtom atom) |
| 583 | 583 |
|
| 584 | 584 |
static int mov_read_moof(MOVContext *c, AVIOContext *pb, MOVAtom atom) |
| 585 | 585 |
{
|
| 586 |
- c->fragment.moof_offset = url_ftell(pb) - 8; |
|
| 586 |
+ c->fragment.moof_offset = avio_tell(pb) - 8; |
|
| 587 | 587 |
av_dlog(c->fc, "moof offset %llx\n", c->fragment.moof_offset); |
| 588 | 588 |
return mov_read_default(c, pb, atom); |
| 589 | 589 |
} |
| ... | ... |
@@ -925,7 +925,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries) |
| 925 | 925 |
enum CodecID id; |
| 926 | 926 |
int dref_id = 1; |
| 927 | 927 |
MOVAtom a = { AV_RL32("stsd") };
|
| 928 |
- int64_t start_pos = url_ftell(pb); |
|
| 928 |
+ int64_t start_pos = avio_tell(pb); |
|
| 929 | 929 |
int size = avio_rb32(pb); /* size */ |
| 930 | 930 |
uint32_t format = avio_rl32(pb); /* data format */ |
| 931 | 931 |
|
| ... | ... |
@@ -945,7 +945,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries) |
| 945 | 945 |
* in the MOV demuxer, patch welcome. */ |
| 946 | 946 |
multiple_stsd: |
| 947 | 947 |
av_log(c->fc, AV_LOG_WARNING, "multiple fourcc not supported\n"); |
| 948 |
- avio_seek(pb, size - (url_ftell(pb) - start_pos), SEEK_CUR); |
|
| 948 |
+ avio_seek(pb, size - (avio_tell(pb) - start_pos), SEEK_CUR); |
|
| 949 | 949 |
continue; |
| 950 | 950 |
} |
| 951 | 951 |
/* we cannot demux concatenated h264 streams because of different extradata */ |
| ... | ... |
@@ -1166,7 +1166,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries) |
| 1166 | 1166 |
} else if(st->codec->codec_type==AVMEDIA_TYPE_SUBTITLE){
|
| 1167 | 1167 |
// ttxt stsd contains display flags, justification, background |
| 1168 | 1168 |
// color, fonts, and default styles, so fake an atom to read it |
| 1169 |
- MOVAtom fake_atom = { .size = size - (url_ftell(pb) - start_pos) };
|
|
| 1169 |
+ MOVAtom fake_atom = { .size = size - (avio_tell(pb) - start_pos) };
|
|
| 1170 | 1170 |
if (format != AV_RL32("mp4s")) // mp4s contains a regular esds atom
|
| 1171 | 1171 |
mov_read_glbl(c, pb, fake_atom); |
| 1172 | 1172 |
st->codec->codec_id= id; |
| ... | ... |
@@ -1174,10 +1174,10 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries) |
| 1174 | 1174 |
st->codec->height = sc->height; |
| 1175 | 1175 |
} else {
|
| 1176 | 1176 |
/* other codec type, just skip (rtp, mp4s, tmcd ...) */ |
| 1177 |
- avio_seek(pb, size - (url_ftell(pb) - start_pos), SEEK_CUR); |
|
| 1177 |
+ avio_seek(pb, size - (avio_tell(pb) - start_pos), SEEK_CUR); |
|
| 1178 | 1178 |
} |
| 1179 | 1179 |
/* this will read extra atoms at the end (wave, alac, damr, avcC, SMI ...) */ |
| 1180 |
- a.size = size - (url_ftell(pb) - start_pos); |
|
| 1180 |
+ a.size = size - (avio_tell(pb) - start_pos); |
|
| 1181 | 1181 |
if (a.size > 8) {
|
| 1182 | 1182 |
if (mov_read_default(c, pb, a) < 0) |
| 1183 | 1183 |
return -1; |
| ... | ... |
@@ -2299,7 +2299,7 @@ static void mov_read_chapters(AVFormatContext *s) |
| 2299 | 2299 |
|
| 2300 | 2300 |
st->discard = AVDISCARD_ALL; |
| 2301 | 2301 |
sc = st->priv_data; |
| 2302 |
- cur_pos = url_ftell(sc->pb); |
|
| 2302 |
+ cur_pos = avio_tell(sc->pb); |
|
| 2303 | 2303 |
|
| 2304 | 2304 |
for (i = 0; i < st->nb_index_entries; i++) {
|
| 2305 | 2305 |
AVIndexEntry *sample = &st->index_entries[i]; |
| ... | ... |
@@ -2364,7 +2364,7 @@ static int mov_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 2364 | 2364 |
av_log(s, AV_LOG_ERROR, "moov atom not found\n"); |
| 2365 | 2365 |
return -1; |
| 2366 | 2366 |
} |
| 2367 |
- av_dlog(mov->fc, "on_parse_exit_offset=%lld\n", url_ftell(pb)); |
|
| 2367 |
+ av_dlog(mov->fc, "on_parse_exit_offset=%lld\n", avio_tell(pb)); |
|
| 2368 | 2368 |
|
| 2369 | 2369 |
if (!url_is_streamed(pb) && mov->chapter_track > 0) |
| 2370 | 2370 |
mov_read_chapters(s); |
| ... | ... |
@@ -2413,7 +2413,7 @@ static int mov_read_packet(AVFormatContext *s, AVPacket *pkt) |
| 2413 | 2413 |
mov_read_default(mov, s->pb, (MOVAtom){ AV_RL32("root"), INT64_MAX }) < 0 ||
|
| 2414 | 2414 |
url_feof(s->pb)) |
| 2415 | 2415 |
return AVERROR_EOF; |
| 2416 |
- av_dlog(s, "read fragments, offset 0x%llx\n", url_ftell(s->pb)); |
|
| 2416 |
+ av_dlog(s, "read fragments, offset 0x%llx\n", avio_tell(s->pb)); |
|
| 2417 | 2417 |
goto retry; |
| 2418 | 2418 |
} |
| 2419 | 2419 |
sc = st->priv_data; |
| ... | ... |
@@ -39,7 +39,7 @@ |
| 39 | 39 |
//FIXME support 64 bit variant with wide placeholders |
| 40 | 40 |
static int64_t updateSize(AVIOContext *pb, int64_t pos) |
| 41 | 41 |
{
|
| 42 |
- int64_t curpos = url_ftell(pb); |
|
| 42 |
+ int64_t curpos = avio_tell(pb); |
|
| 43 | 43 |
avio_seek(pb, pos, SEEK_SET); |
| 44 | 44 |
avio_wb32(pb, curpos - pos); /* rewrite size */ |
| 45 | 45 |
avio_seek(pb, curpos, SEEK_SET); |
| ... | ... |
@@ -52,7 +52,7 @@ static int mov_write_stco_tag(AVIOContext *pb, MOVTrack *track) |
| 52 | 52 |
{
|
| 53 | 53 |
int i; |
| 54 | 54 |
int mode64 = 0; // use 32 bit size variant if possible |
| 55 |
- int64_t pos = url_ftell(pb); |
|
| 55 |
+ int64_t pos = avio_tell(pb); |
|
| 56 | 56 |
avio_wb32(pb, 0); /* size */ |
| 57 | 57 |
if (pos > UINT32_MAX) {
|
| 58 | 58 |
mode64 = 1; |
| ... | ... |
@@ -76,7 +76,7 @@ static int mov_write_stsz_tag(AVIOContext *pb, MOVTrack *track) |
| 76 | 76 |
int equalChunks = 1; |
| 77 | 77 |
int i, j, entries = 0, tst = -1, oldtst = -1; |
| 78 | 78 |
|
| 79 |
- int64_t pos = url_ftell(pb); |
|
| 79 |
+ int64_t pos = avio_tell(pb); |
|
| 80 | 80 |
avio_wb32(pb, 0); /* size */ |
| 81 | 81 |
ffio_wfourcc(pb, "stsz"); |
| 82 | 82 |
avio_wb32(pb, 0); /* version & flags */ |
| ... | ... |
@@ -114,11 +114,11 @@ static int mov_write_stsc_tag(AVIOContext *pb, MOVTrack *track) |
| 114 | 114 |
int index = 0, oldval = -1, i; |
| 115 | 115 |
int64_t entryPos, curpos; |
| 116 | 116 |
|
| 117 |
- int64_t pos = url_ftell(pb); |
|
| 117 |
+ int64_t pos = avio_tell(pb); |
|
| 118 | 118 |
avio_wb32(pb, 0); /* size */ |
| 119 | 119 |
ffio_wfourcc(pb, "stsc"); |
| 120 | 120 |
avio_wb32(pb, 0); // version & flags |
| 121 |
- entryPos = url_ftell(pb); |
|
| 121 |
+ entryPos = avio_tell(pb); |
|
| 122 | 122 |
avio_wb32(pb, track->entry); // entry count |
| 123 | 123 |
for (i=0; i<track->entry; i++) {
|
| 124 | 124 |
if(oldval != track->cluster[i].samplesInChunk) |
| ... | ... |
@@ -130,7 +130,7 @@ static int mov_write_stsc_tag(AVIOContext *pb, MOVTrack *track) |
| 130 | 130 |
index++; |
| 131 | 131 |
} |
| 132 | 132 |
} |
| 133 |
- curpos = url_ftell(pb); |
|
| 133 |
+ curpos = avio_tell(pb); |
|
| 134 | 134 |
avio_seek(pb, entryPos, SEEK_SET); |
| 135 | 135 |
avio_wb32(pb, index); // rewrite size |
| 136 | 136 |
avio_seek(pb, curpos, SEEK_SET); |
| ... | ... |
@@ -143,11 +143,11 @@ static int mov_write_stss_tag(AVIOContext *pb, MOVTrack *track, uint32_t flag) |
| 143 | 143 |
{
|
| 144 | 144 |
int64_t curpos, entryPos; |
| 145 | 145 |
int i, index = 0; |
| 146 |
- int64_t pos = url_ftell(pb); |
|
| 146 |
+ int64_t pos = avio_tell(pb); |
|
| 147 | 147 |
avio_wb32(pb, 0); // size |
| 148 | 148 |
ffio_wfourcc(pb, flag == MOV_SYNC_SAMPLE ? "stss" : "stps"); |
| 149 | 149 |
avio_wb32(pb, 0); // version & flags |
| 150 |
- entryPos = url_ftell(pb); |
|
| 150 |
+ entryPos = avio_tell(pb); |
|
| 151 | 151 |
avio_wb32(pb, track->entry); // entry count |
| 152 | 152 |
for (i=0; i<track->entry; i++) {
|
| 153 | 153 |
if (track->cluster[i].flags & flag) {
|
| ... | ... |
@@ -155,7 +155,7 @@ static int mov_write_stss_tag(AVIOContext *pb, MOVTrack *track, uint32_t flag) |
| 155 | 155 |
index++; |
| 156 | 156 |
} |
| 157 | 157 |
} |
| 158 |
- curpos = url_ftell(pb); |
|
| 158 |
+ curpos = avio_tell(pb); |
|
| 159 | 159 |
avio_seek(pb, entryPos, SEEK_SET); |
| 160 | 160 |
avio_wb32(pb, index); // rewrite size |
| 161 | 161 |
avio_seek(pb, curpos, SEEK_SET); |
| ... | ... |
@@ -256,7 +256,7 @@ static void putDescr(AVIOContext *pb, int tag, unsigned int size) |
| 256 | 256 |
|
| 257 | 257 |
static int mov_write_esds_tag(AVIOContext *pb, MOVTrack *track) // Basic |
| 258 | 258 |
{
|
| 259 |
- int64_t pos = url_ftell(pb); |
|
| 259 |
+ int64_t pos = avio_tell(pb); |
|
| 260 | 260 |
int decoderSpecificInfoLen = track->vosLen ? descrLength(track->vosLen):0; |
| 261 | 261 |
|
| 262 | 262 |
avio_wb32(pb, 0); // size |
| ... | ... |
@@ -318,7 +318,7 @@ static int mov_pcm_le_gt16(enum CodecID codec_id) |
| 318 | 318 |
|
| 319 | 319 |
static int mov_write_ms_tag(AVIOContext *pb, MOVTrack *track) |
| 320 | 320 |
{
|
| 321 |
- int64_t pos = url_ftell(pb); |
|
| 321 |
+ int64_t pos = avio_tell(pb); |
|
| 322 | 322 |
avio_wb32(pb, 0); |
| 323 | 323 |
avio_wl32(pb, track->tag); // store it byteswapped |
| 324 | 324 |
track->enc->codec_tag = av_bswap16(track->tag >> 16); |
| ... | ... |
@@ -328,7 +328,7 @@ static int mov_write_ms_tag(AVIOContext *pb, MOVTrack *track) |
| 328 | 328 |
|
| 329 | 329 |
static int mov_write_wave_tag(AVIOContext *pb, MOVTrack *track) |
| 330 | 330 |
{
|
| 331 |
- int64_t pos = url_ftell(pb); |
|
| 331 |
+ int64_t pos = avio_tell(pb); |
|
| 332 | 332 |
|
| 333 | 333 |
avio_wb32(pb, 0); /* size */ |
| 334 | 334 |
ffio_wfourcc(pb, "wave"); |
| ... | ... |
@@ -401,7 +401,7 @@ static int mov_get_lpcm_flags(enum CodecID codec_id) |
| 401 | 401 |
|
| 402 | 402 |
static int mov_write_audio_tag(AVIOContext *pb, MOVTrack *track) |
| 403 | 403 |
{
|
| 404 |
- int64_t pos = url_ftell(pb); |
|
| 404 |
+ int64_t pos = avio_tell(pb); |
|
| 405 | 405 |
int version = 0; |
| 406 | 406 |
uint32_t tag = track->tag; |
| 407 | 407 |
|
| ... | ... |
@@ -519,7 +519,7 @@ static int mov_write_svq3_tag(AVIOContext *pb) |
| 519 | 519 |
|
| 520 | 520 |
static int mov_write_avcc_tag(AVIOContext *pb, MOVTrack *track) |
| 521 | 521 |
{
|
| 522 |
- int64_t pos = url_ftell(pb); |
|
| 522 |
+ int64_t pos = avio_tell(pb); |
|
| 523 | 523 |
|
| 524 | 524 |
avio_wb32(pb, 0); |
| 525 | 525 |
ffio_wfourcc(pb, "avcC"); |
| ... | ... |
@@ -765,7 +765,7 @@ static int mov_write_uuid_tag_ipod(AVIOContext *pb) |
| 765 | 765 |
|
| 766 | 766 |
static int mov_write_subtitle_tag(AVIOContext *pb, MOVTrack *track) |
| 767 | 767 |
{
|
| 768 |
- int64_t pos = url_ftell(pb); |
|
| 768 |
+ int64_t pos = avio_tell(pb); |
|
| 769 | 769 |
avio_wb32(pb, 0); /* size */ |
| 770 | 770 |
avio_wl32(pb, track->tag); // store it byteswapped |
| 771 | 771 |
avio_wb32(pb, 0); /* Reserved */ |
| ... | ... |
@@ -793,7 +793,7 @@ static int mov_write_pasp_tag(AVIOContext *pb, MOVTrack *track) |
| 793 | 793 |
|
| 794 | 794 |
static int mov_write_video_tag(AVIOContext *pb, MOVTrack *track) |
| 795 | 795 |
{
|
| 796 |
- int64_t pos = url_ftell(pb); |
|
| 796 |
+ int64_t pos = avio_tell(pb); |
|
| 797 | 797 |
char compressor_name[32]; |
| 798 | 798 |
|
| 799 | 799 |
avio_wb32(pb, 0); /* size */ |
| ... | ... |
@@ -862,7 +862,7 @@ static int mov_write_video_tag(AVIOContext *pb, MOVTrack *track) |
| 862 | 862 |
|
| 863 | 863 |
static int mov_write_rtp_tag(AVIOContext *pb, MOVTrack *track) |
| 864 | 864 |
{
|
| 865 |
- int64_t pos = url_ftell(pb); |
|
| 865 |
+ int64_t pos = avio_tell(pb); |
|
| 866 | 866 |
avio_wb32(pb, 0); /* size */ |
| 867 | 867 |
ffio_wfourcc(pb, "rtp "); |
| 868 | 868 |
avio_wb32(pb, 0); /* Reserved */ |
| ... | ... |
@@ -882,7 +882,7 @@ static int mov_write_rtp_tag(AVIOContext *pb, MOVTrack *track) |
| 882 | 882 |
|
| 883 | 883 |
static int mov_write_stsd_tag(AVIOContext *pb, MOVTrack *track) |
| 884 | 884 |
{
|
| 885 |
- int64_t pos = url_ftell(pb); |
|
| 885 |
+ int64_t pos = avio_tell(pb); |
|
| 886 | 886 |
avio_wb32(pb, 0); /* size */ |
| 887 | 887 |
ffio_wfourcc(pb, "stsd"); |
| 888 | 888 |
avio_wb32(pb, 0); /* version & flags */ |
| ... | ... |
@@ -989,7 +989,7 @@ static int mov_write_dref_tag(AVIOContext *pb) |
| 989 | 989 |
|
| 990 | 990 |
static int mov_write_stbl_tag(AVIOContext *pb, MOVTrack *track) |
| 991 | 991 |
{
|
| 992 |
- int64_t pos = url_ftell(pb); |
|
| 992 |
+ int64_t pos = avio_tell(pb); |
|
| 993 | 993 |
avio_wb32(pb, 0); /* size */ |
| 994 | 994 |
ffio_wfourcc(pb, "stbl"); |
| 995 | 995 |
mov_write_stsd_tag(pb, track); |
| ... | ... |
@@ -1011,7 +1011,7 @@ static int mov_write_stbl_tag(AVIOContext *pb, MOVTrack *track) |
| 1011 | 1011 |
|
| 1012 | 1012 |
static int mov_write_dinf_tag(AVIOContext *pb) |
| 1013 | 1013 |
{
|
| 1014 |
- int64_t pos = url_ftell(pb); |
|
| 1014 |
+ int64_t pos = avio_tell(pb); |
|
| 1015 | 1015 |
avio_wb32(pb, 0); /* size */ |
| 1016 | 1016 |
ffio_wfourcc(pb, "dinf"); |
| 1017 | 1017 |
mov_write_dref_tag(pb); |
| ... | ... |
@@ -1064,7 +1064,7 @@ static int mov_write_vmhd_tag(AVIOContext *pb) |
| 1064 | 1064 |
static int mov_write_hdlr_tag(AVIOContext *pb, MOVTrack *track) |
| 1065 | 1065 |
{
|
| 1066 | 1066 |
const char *hdlr, *descr = NULL, *hdlr_type = NULL; |
| 1067 |
- int64_t pos = url_ftell(pb); |
|
| 1067 |
+ int64_t pos = avio_tell(pb); |
|
| 1068 | 1068 |
|
| 1069 | 1069 |
if (!track) { /* no media --> data handler */
|
| 1070 | 1070 |
hdlr = "dhlr"; |
| ... | ... |
@@ -1121,7 +1121,7 @@ static int mov_write_hmhd_tag(AVIOContext *pb) |
| 1121 | 1121 |
|
| 1122 | 1122 |
static int mov_write_minf_tag(AVIOContext *pb, MOVTrack *track) |
| 1123 | 1123 |
{
|
| 1124 |
- int64_t pos = url_ftell(pb); |
|
| 1124 |
+ int64_t pos = avio_tell(pb); |
|
| 1125 | 1125 |
avio_wb32(pb, 0); /* size */ |
| 1126 | 1126 |
ffio_wfourcc(pb, "minf"); |
| 1127 | 1127 |
if(track->enc->codec_type == AVMEDIA_TYPE_VIDEO) |
| ... | ... |
@@ -1173,7 +1173,7 @@ static int mov_write_mdhd_tag(AVIOContext *pb, MOVTrack *track) |
| 1173 | 1173 |
|
| 1174 | 1174 |
static int mov_write_mdia_tag(AVIOContext *pb, MOVTrack *track) |
| 1175 | 1175 |
{
|
| 1176 |
- int64_t pos = url_ftell(pb); |
|
| 1176 |
+ int64_t pos = avio_tell(pb); |
|
| 1177 | 1177 |
avio_wb32(pb, 0); /* size */ |
| 1178 | 1178 |
ffio_wfourcc(pb, "mdia"); |
| 1179 | 1179 |
mov_write_mdhd_tag(pb, track); |
| ... | ... |
@@ -1250,7 +1250,7 @@ static int mov_write_tapt_tag(AVIOContext *pb, MOVTrack *track) |
| 1250 | 1250 |
int32_t width = av_rescale(track->enc->sample_aspect_ratio.num, track->enc->width, |
| 1251 | 1251 |
track->enc->sample_aspect_ratio.den); |
| 1252 | 1252 |
|
| 1253 |
- int64_t pos = url_ftell(pb); |
|
| 1253 |
+ int64_t pos = avio_tell(pb); |
|
| 1254 | 1254 |
|
| 1255 | 1255 |
avio_wb32(pb, 0); /* size */ |
| 1256 | 1256 |
ffio_wfourcc(pb, "tapt"); |
| ... | ... |
@@ -1339,7 +1339,7 @@ static int mov_write_udta_sdp(AVIOContext *pb, AVCodecContext *ctx, int index) |
| 1339 | 1339 |
|
| 1340 | 1340 |
static int mov_write_trak_tag(AVIOContext *pb, MOVTrack *track, AVStream *st) |
| 1341 | 1341 |
{
|
| 1342 |
- int64_t pos = url_ftell(pb); |
|
| 1342 |
+ int64_t pos = avio_tell(pb); |
|
| 1343 | 1343 |
avio_wb32(pb, 0); /* size */ |
| 1344 | 1344 |
ffio_wfourcc(pb, "trak"); |
| 1345 | 1345 |
mov_write_tkhd_tag(pb, track, st); |
| ... | ... |
@@ -1476,7 +1476,7 @@ static int mov_write_string_data_tag(AVIOContext *pb, const char *data, int lang |
| 1476 | 1476 |
static int mov_write_string_tag(AVIOContext *pb, const char *name, const char *value, int lang, int long_style){
|
| 1477 | 1477 |
int size = 0; |
| 1478 | 1478 |
if (value && value[0]) {
|
| 1479 |
- int64_t pos = url_ftell(pb); |
|
| 1479 |
+ int64_t pos = avio_tell(pb); |
|
| 1480 | 1480 |
avio_wb32(pb, 0); /* size */ |
| 1481 | 1481 |
ffio_wfourcc(pb, name); |
| 1482 | 1482 |
mov_write_string_data_tag(pb, value, lang, long_style); |
| ... | ... |
@@ -1535,7 +1535,7 @@ static int mov_write_trkn_tag(AVIOContext *pb, MOVMuxContext *mov, |
| 1535 | 1535 |
static int mov_write_ilst_tag(AVIOContext *pb, MOVMuxContext *mov, |
| 1536 | 1536 |
AVFormatContext *s) |
| 1537 | 1537 |
{
|
| 1538 |
- int64_t pos = url_ftell(pb); |
|
| 1538 |
+ int64_t pos = avio_tell(pb); |
|
| 1539 | 1539 |
avio_wb32(pb, 0); /* size */ |
| 1540 | 1540 |
ffio_wfourcc(pb, "ilst"); |
| 1541 | 1541 |
mov_write_string_metadata(s, pb, "\251nam", "title" , 1); |
| ... | ... |
@@ -1564,7 +1564,7 @@ static int mov_write_meta_tag(AVIOContext *pb, MOVMuxContext *mov, |
| 1564 | 1564 |
AVFormatContext *s) |
| 1565 | 1565 |
{
|
| 1566 | 1566 |
int size = 0; |
| 1567 |
- int64_t pos = url_ftell(pb); |
|
| 1567 |
+ int64_t pos = avio_tell(pb); |
|
| 1568 | 1568 |
avio_wb32(pb, 0); /* size */ |
| 1569 | 1569 |
ffio_wfourcc(pb, "meta"); |
| 1570 | 1570 |
avio_wb32(pb, 0); |
| ... | ... |
@@ -1604,7 +1604,7 @@ static uint16_t language_code(const char *str) |
| 1604 | 1604 |
static int mov_write_3gp_udta_tag(AVIOContext *pb, AVFormatContext *s, |
| 1605 | 1605 |
const char *tag, const char *str) |
| 1606 | 1606 |
{
|
| 1607 |
- int64_t pos = url_ftell(pb); |
|
| 1607 |
+ int64_t pos = avio_tell(pb); |
|
| 1608 | 1608 |
AVMetadataTag *t = av_metadata_get(s->metadata, str, NULL, 0); |
| 1609 | 1609 |
if (!t || !utf8len(t->value)) |
| 1610 | 1610 |
return 0; |
| ... | ... |
@@ -1625,7 +1625,7 @@ static int mov_write_3gp_udta_tag(AVIOContext *pb, AVFormatContext *s, |
| 1625 | 1625 |
|
| 1626 | 1626 |
static int mov_write_chpl_tag(AVIOContext *pb, AVFormatContext *s) |
| 1627 | 1627 |
{
|
| 1628 |
- int64_t pos = url_ftell(pb); |
|
| 1628 |
+ int64_t pos = avio_tell(pb); |
|
| 1629 | 1629 |
int i, nb_chapters = FFMIN(s->nb_chapters, 255); |
| 1630 | 1630 |
|
| 1631 | 1631 |
avio_wb32(pb, 0); // size |
| ... | ... |
@@ -1721,7 +1721,7 @@ static int mov_write_uuidusmt_tag(AVIOContext *pb, AVFormatContext *s) |
| 1721 | 1721 |
int64_t pos, pos2; |
| 1722 | 1722 |
|
| 1723 | 1723 |
if (title) {
|
| 1724 |
- pos = url_ftell(pb); |
|
| 1724 |
+ pos = avio_tell(pb); |
|
| 1725 | 1725 |
avio_wb32(pb, 0); /* size placeholder*/ |
| 1726 | 1726 |
ffio_wfourcc(pb, "uuid"); |
| 1727 | 1727 |
ffio_wfourcc(pb, "USMT"); |
| ... | ... |
@@ -1729,7 +1729,7 @@ static int mov_write_uuidusmt_tag(AVIOContext *pb, AVFormatContext *s) |
| 1729 | 1729 |
avio_wb32(pb, 0xbb88695c); |
| 1730 | 1730 |
avio_wb32(pb, 0xfac9c740); |
| 1731 | 1731 |
|
| 1732 |
- pos2 = url_ftell(pb); |
|
| 1732 |
+ pos2 = avio_tell(pb); |
|
| 1733 | 1733 |
avio_wb32(pb, 0); /* size placeholder*/ |
| 1734 | 1734 |
ffio_wfourcc(pb, "MTDT"); |
| 1735 | 1735 |
avio_wb16(pb, 4); |
| ... | ... |
@@ -1757,7 +1757,7 @@ static int mov_write_moov_tag(AVIOContext *pb, MOVMuxContext *mov, |
| 1757 | 1757 |
AVFormatContext *s) |
| 1758 | 1758 |
{
|
| 1759 | 1759 |
int i; |
| 1760 |
- int64_t pos = url_ftell(pb); |
|
| 1760 |
+ int64_t pos = avio_tell(pb); |
|
| 1761 | 1761 |
avio_wb32(pb, 0); /* size placeholder*/ |
| 1762 | 1762 |
ffio_wfourcc(pb, "moov"); |
| 1763 | 1763 |
|
| ... | ... |
@@ -1802,7 +1802,7 @@ static int mov_write_mdat_tag(AVIOContext *pb, MOVMuxContext *mov) |
| 1802 | 1802 |
avio_wb32(pb, 8); // placeholder for extended size field (64 bit) |
| 1803 | 1803 |
ffio_wfourcc(pb, mov->mode == MODE_MOV ? "wide" : "free"); |
| 1804 | 1804 |
|
| 1805 |
- mov->mdat_pos = url_ftell(pb); |
|
| 1805 |
+ mov->mdat_pos = avio_tell(pb); |
|
| 1806 | 1806 |
avio_wb32(pb, 0); /* size placeholder*/ |
| 1807 | 1807 |
ffio_wfourcc(pb, "mdat"); |
| 1808 | 1808 |
return 0; |
| ... | ... |
@@ -1812,7 +1812,7 @@ static int mov_write_mdat_tag(AVIOContext *pb, MOVMuxContext *mov) |
| 1812 | 1812 |
static int mov_write_ftyp_tag(AVIOContext *pb, AVFormatContext *s) |
| 1813 | 1813 |
{
|
| 1814 | 1814 |
MOVMuxContext *mov = s->priv_data; |
| 1815 |
- int64_t pos = url_ftell(pb); |
|
| 1815 |
+ int64_t pos = avio_tell(pb); |
|
| 1816 | 1816 |
int has_h264 = 0, has_video = 0; |
| 1817 | 1817 |
int minor = 0x200; |
| 1818 | 1818 |
int i; |
| ... | ... |
@@ -2012,7 +2012,7 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt) |
| 2012 | 2012 |
return -1; |
| 2013 | 2013 |
} |
| 2014 | 2014 |
|
| 2015 |
- trk->cluster[trk->entry].pos = url_ftell(pb) - size; |
|
| 2015 |
+ trk->cluster[trk->entry].pos = avio_tell(pb) - size; |
|
| 2016 | 2016 |
trk->cluster[trk->entry].samplesInChunk = samplesInChunk; |
| 2017 | 2017 |
trk->cluster[trk->entry].size = size; |
| 2018 | 2018 |
trk->cluster[trk->entry].entries = samplesInChunk; |
| ... | ... |
@@ -2243,7 +2243,7 @@ static int mov_write_trailer(AVFormatContext *s) |
| 2243 | 2243 |
int res = 0; |
| 2244 | 2244 |
int i; |
| 2245 | 2245 |
|
| 2246 |
- int64_t moov_pos = url_ftell(pb); |
|
| 2246 |
+ int64_t moov_pos = avio_tell(pb); |
|
| 2247 | 2247 |
|
| 2248 | 2248 |
/* Write size of mdat tag */ |
| 2249 | 2249 |
if (mov->mdat_size+8 <= UINT32_MAX) {
|
| ... | ... |
@@ -316,7 +316,7 @@ static int write_hint_packets(AVIOContext *out, const uint8_t *data, |
| 316 | 316 |
int64_t count_pos, entries_pos; |
| 317 | 317 |
int count = 0, entries; |
| 318 | 318 |
|
| 319 |
- count_pos = url_ftell(out); |
|
| 319 |
+ count_pos = avio_tell(out); |
|
| 320 | 320 |
/* RTPsample header */ |
| 321 | 321 |
avio_wb16(out, 0); /* packet count */ |
| 322 | 322 |
avio_wb16(out, 0); /* reserved */ |
| ... | ... |
@@ -358,7 +358,7 @@ static int write_hint_packets(AVIOContext *out, const uint8_t *data, |
| 358 | 358 |
avio_write(out, data, 2); /* RTP header */ |
| 359 | 359 |
avio_wb16(out, seq); /* RTPsequenceseed */ |
| 360 | 360 |
avio_wb16(out, 0); /* reserved + flags */ |
| 361 |
- entries_pos = url_ftell(out); |
|
| 361 |
+ entries_pos = avio_tell(out); |
|
| 362 | 362 |
avio_wb16(out, 0); /* entry count */ |
| 363 | 363 |
|
| 364 | 364 |
data += 12; |
| ... | ... |
@@ -371,13 +371,13 @@ static int write_hint_packets(AVIOContext *out, const uint8_t *data, |
| 371 | 371 |
data += packet_len; |
| 372 | 372 |
size -= packet_len; |
| 373 | 373 |
|
| 374 |
- curpos = url_ftell(out); |
|
| 374 |
+ curpos = avio_tell(out); |
|
| 375 | 375 |
avio_seek(out, entries_pos, SEEK_SET); |
| 376 | 376 |
avio_wb16(out, entries); |
| 377 | 377 |
avio_seek(out, curpos, SEEK_SET); |
| 378 | 378 |
} |
| 379 | 379 |
|
| 380 |
- curpos = url_ftell(out); |
|
| 380 |
+ curpos = avio_tell(out); |
|
| 381 | 381 |
avio_seek(out, count_pos, SEEK_SET); |
| 382 | 382 |
avio_wb16(out, count); |
| 383 | 383 |
avio_seek(out, curpos, SEEK_SET); |
| ... | ... |
@@ -147,7 +147,7 @@ static int mp3_read_header(AVFormatContext *s, |
| 147 | 147 |
// lcm of all mp3 sample rates |
| 148 | 148 |
av_set_pts_info(st, 64, 1, 14112000); |
| 149 | 149 |
|
| 150 |
- off = url_ftell(s->pb); |
|
| 150 |
+ off = avio_tell(s->pb); |
|
| 151 | 151 |
|
| 152 | 152 |
if (!av_metadata_get(s->metadata, "", NULL, AV_METADATA_IGNORE_SUFFIX)) |
| 153 | 153 |
ff_id3v1_read(s); |
| ... | ... |
@@ -211,7 +211,7 @@ static int mp3_write_header(struct AVFormatContext *s) |
| 211 | 211 |
avio_w8(s->pb, 0); /* flags */ |
| 212 | 212 |
|
| 213 | 213 |
/* reserve space for size */ |
| 214 |
- size_pos = url_ftell(s->pb); |
|
| 214 |
+ size_pos = avio_tell(s->pb); |
|
| 215 | 215 |
avio_wb32(s->pb, 0); |
| 216 | 216 |
|
| 217 | 217 |
ff_metadata_conv(&s->metadata, ff_id3v2_34_metadata_conv, NULL); |
| ... | ... |
@@ -237,7 +237,7 @@ static int mp3_write_header(struct AVFormatContext *s) |
| 237 | 237 |
totlen += ret; |
| 238 | 238 |
} |
| 239 | 239 |
|
| 240 |
- cur_pos = url_ftell(s->pb); |
|
| 240 |
+ cur_pos = avio_tell(s->pb); |
|
| 241 | 241 |
avio_seek(s->pb, size_pos, SEEK_SET); |
| 242 | 242 |
id3v2_put_size(s, totlen); |
| 243 | 243 |
avio_seek(s->pb, cur_pos, SEEK_SET); |
| ... | ... |
@@ -94,7 +94,7 @@ static int mpc_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 94 | 94 |
|
| 95 | 95 |
/* try to read APE tags */ |
| 96 | 96 |
if (!url_is_streamed(s->pb)) {
|
| 97 |
- int64_t pos = url_ftell(s->pb); |
|
| 97 |
+ int64_t pos = avio_tell(s->pb); |
|
| 98 | 98 |
ff_ape_parse_tag(s); |
| 99 | 99 |
if (!av_metadata_get(s->metadata, "", NULL, AV_METADATA_IGNORE_SUFFIX)) |
| 100 | 100 |
ff_id3v1_read(s); |
| ... | ... |
@@ -120,7 +120,7 @@ static int mpc_read_packet(AVFormatContext *s, AVPacket *pkt) |
| 120 | 120 |
c->lastframe = c->curframe; |
| 121 | 121 |
c->curframe++; |
| 122 | 122 |
curbits = c->curbits; |
| 123 |
- pos = url_ftell(s->pb); |
|
| 123 |
+ pos = avio_tell(s->pb); |
|
| 124 | 124 |
tmp = avio_rl32(s->pb); |
| 125 | 125 |
if(curbits <= 12){
|
| 126 | 126 |
size2 = (tmp >> (12 - curbits)) & 0xFFFFF; |
| ... | ... |
@@ -120,10 +120,10 @@ static inline int64_t gb_get_v(GetBitContext *gb) |
| 120 | 120 |
static void mpc8_get_chunk_header(AVIOContext *pb, int *tag, int64_t *size) |
| 121 | 121 |
{
|
| 122 | 122 |
int64_t pos; |
| 123 |
- pos = url_ftell(pb); |
|
| 123 |
+ pos = avio_tell(pb); |
|
| 124 | 124 |
*tag = avio_rl16(pb); |
| 125 | 125 |
*size = ff_get_v(pb); |
| 126 |
- *size -= url_ftell(pb) - pos; |
|
| 126 |
+ *size -= avio_tell(pb) - pos; |
|
| 127 | 127 |
} |
| 128 | 128 |
|
| 129 | 129 |
static void mpc8_parse_seektable(AVFormatContext *s, int64_t off) |
| ... | ... |
@@ -176,7 +176,7 @@ static void mpc8_handle_chunk(AVFormatContext *s, int tag, int64_t chunk_pos, in |
| 176 | 176 |
|
| 177 | 177 |
switch(tag){
|
| 178 | 178 |
case TAG_SEEKTBLOFF: |
| 179 |
- pos = url_ftell(pb) + size; |
|
| 179 |
+ pos = avio_tell(pb) + size; |
|
| 180 | 180 |
off = ff_get_v(pb); |
| 181 | 181 |
mpc8_parse_seektable(s, chunk_pos + off); |
| 182 | 182 |
avio_seek(pb, pos, SEEK_SET); |
| ... | ... |
@@ -194,14 +194,14 @@ static int mpc8_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 194 | 194 |
int tag = 0; |
| 195 | 195 |
int64_t size, pos; |
| 196 | 196 |
|
| 197 |
- c->header_pos = url_ftell(pb); |
|
| 197 |
+ c->header_pos = avio_tell(pb); |
|
| 198 | 198 |
if(avio_rl32(pb) != TAG_MPCK){
|
| 199 | 199 |
av_log(s, AV_LOG_ERROR, "Not a Musepack8 file\n"); |
| 200 | 200 |
return -1; |
| 201 | 201 |
} |
| 202 | 202 |
|
| 203 | 203 |
while(!url_feof(pb)){
|
| 204 |
- pos = url_ftell(pb); |
|
| 204 |
+ pos = avio_tell(pb); |
|
| 205 | 205 |
mpc8_get_chunk_header(pb, &tag, &size); |
| 206 | 206 |
if(tag == TAG_STREAMHDR) |
| 207 | 207 |
break; |
| ... | ... |
@@ -211,7 +211,7 @@ static int mpc8_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 211 | 211 |
av_log(s, AV_LOG_ERROR, "Stream header not found\n"); |
| 212 | 212 |
return -1; |
| 213 | 213 |
} |
| 214 |
- pos = url_ftell(pb); |
|
| 214 |
+ pos = avio_tell(pb); |
|
| 215 | 215 |
avio_seek(pb, 4, SEEK_CUR); //CRC |
| 216 | 216 |
c->ver = avio_r8(pb); |
| 217 | 217 |
if(c->ver != 8){
|
| ... | ... |
@@ -236,7 +236,7 @@ static int mpc8_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 236 | 236 |
st->codec->sample_rate = mpc8_rate[st->codec->extradata[0] >> 5]; |
| 237 | 237 |
av_set_pts_info(st, 32, 1152 << (st->codec->extradata[1]&3)*2, st->codec->sample_rate); |
| 238 | 238 |
st->duration = c->samples / (1152 << (st->codec->extradata[1]&3)*2); |
| 239 |
- size -= url_ftell(pb) - pos; |
|
| 239 |
+ size -= avio_tell(pb) - pos; |
|
| 240 | 240 |
|
| 241 | 241 |
return 0; |
| 242 | 242 |
} |
| ... | ... |
@@ -248,7 +248,7 @@ static int mpc8_read_packet(AVFormatContext *s, AVPacket *pkt) |
| 248 | 248 |
int64_t pos, size; |
| 249 | 249 |
|
| 250 | 250 |
while(!url_feof(s->pb)){
|
| 251 |
- pos = url_ftell(s->pb); |
|
| 251 |
+ pos = avio_tell(s->pb); |
|
| 252 | 252 |
mpc8_get_chunk_header(s->pb, &tag, &size); |
| 253 | 253 |
if (size < 0) |
| 254 | 254 |
return -1; |
| ... | ... |
@@ -169,7 +169,7 @@ static int find_prev_start_code(AVIOContext *pb, int *size_ptr) |
| 169 | 169 |
int max_size, start_code; |
| 170 | 170 |
|
| 171 | 171 |
max_size = *size_ptr; |
| 172 |
- pos_start = url_ftell(pb); |
|
| 172 |
+ pos_start = avio_tell(pb); |
|
| 173 | 173 |
|
| 174 | 174 |
/* in order to go faster, we fill the buffer */ |
| 175 | 175 |
pos = pos_start - 16386; |
| ... | ... |
@@ -241,7 +241,7 @@ static int mpegps_read_pes_header(AVFormatContext *s, |
| 241 | 241 |
int len, size, startcode, c, flags, header_len; |
| 242 | 242 |
int pes_ext, ext2_len, id_ext, skip; |
| 243 | 243 |
int64_t pts, dts; |
| 244 |
- int64_t last_sync= url_ftell(s->pb); |
|
| 244 |
+ int64_t last_sync= avio_tell(s->pb); |
|
| 245 | 245 |
|
| 246 | 246 |
error_redo: |
| 247 | 247 |
avio_seek(s->pb, last_sync, SEEK_SET); |
| ... | ... |
@@ -250,8 +250,8 @@ static int mpegps_read_pes_header(AVFormatContext *s, |
| 250 | 250 |
m->header_state = 0xff; |
| 251 | 251 |
size = MAX_SYNC_SIZE; |
| 252 | 252 |
startcode = find_next_start_code(s->pb, &size, &m->header_state); |
| 253 |
- last_sync = url_ftell(s->pb); |
|
| 254 |
- //printf("startcode=%x pos=0x%"PRIx64"\n", startcode, url_ftell(s->pb));
|
|
| 253 |
+ last_sync = avio_tell(s->pb); |
|
| 254 |
+ //printf("startcode=%x pos=0x%"PRIx64"\n", startcode, avio_tell(s->pb));
|
|
| 255 | 255 |
if (startcode < 0){
|
| 256 | 256 |
if(url_feof(s->pb)) |
| 257 | 257 |
return AVERROR_EOF; |
| ... | ... |
@@ -295,7 +295,7 @@ static int mpegps_read_pes_header(AVFormatContext *s, |
| 295 | 295 |
(startcode == 0x1bd) || (startcode == 0x1fd))) |
| 296 | 296 |
goto redo; |
| 297 | 297 |
if (ppos) {
|
| 298 |
- *ppos = url_ftell(s->pb) - 4; |
|
| 298 |
+ *ppos = avio_tell(s->pb) - 4; |
|
| 299 | 299 |
} |
| 300 | 300 |
len = avio_rb16(s->pb); |
| 301 | 301 |
pts = |
| ... | ... |
@@ -1265,7 +1265,7 @@ static int handle_packet(MpegTSContext *ts, const uint8_t *packet) |
| 1265 | 1265 |
if (p >= p_end) |
| 1266 | 1266 |
return 0; |
| 1267 | 1267 |
|
| 1268 |
- pos = url_ftell(ts->stream->pb); |
|
| 1268 |
+ pos = avio_tell(ts->stream->pb); |
|
| 1269 | 1269 |
ts->pos47= pos % ts->raw_packet_size; |
| 1270 | 1270 |
|
| 1271 | 1271 |
if (tss->type == MPEGTS_SECTION) {
|
| ... | ... |
@@ -1454,7 +1454,7 @@ static int mpegts_read_header(AVFormatContext *s, |
| 1454 | 1454 |
} |
| 1455 | 1455 |
|
| 1456 | 1456 |
/* read the first 1024 bytes to get packet size */ |
| 1457 |
- pos = url_ftell(pb); |
|
| 1457 |
+ pos = avio_tell(pb); |
|
| 1458 | 1458 |
len = avio_read(pb, buf, sizeof(buf)); |
| 1459 | 1459 |
if (len != sizeof(buf)) |
| 1460 | 1460 |
goto fail; |
| ... | ... |
@@ -1552,7 +1552,7 @@ static int mpegts_raw_read_packet(AVFormatContext *s, |
| 1552 | 1552 |
|
| 1553 | 1553 |
if (av_new_packet(pkt, TS_PACKET_SIZE) < 0) |
| 1554 | 1554 |
return AVERROR(ENOMEM); |
| 1555 |
- pkt->pos= url_ftell(s->pb); |
|
| 1555 |
+ pkt->pos= avio_tell(s->pb); |
|
| 1556 | 1556 |
ret = read_packet(s, pkt->data, ts->raw_packet_size); |
| 1557 | 1557 |
if (ret < 0) {
|
| 1558 | 1558 |
av_free_packet(pkt); |
| ... | ... |
@@ -1562,7 +1562,7 @@ static int mpegts_raw_read_packet(AVFormatContext *s, |
| 1562 | 1562 |
/* compute exact PCR for each packet */ |
| 1563 | 1563 |
if (parse_pcr(&pcr_h, &pcr_l, pkt->data) == 0) {
|
| 1564 | 1564 |
/* we read the next PCR (XXX: optimize it by using a bigger buffer */ |
| 1565 |
- pos = url_ftell(s->pb); |
|
| 1565 |
+ pos = avio_tell(s->pb); |
|
| 1566 | 1566 |
for(i = 0; i < MAX_PACKET_READAHEAD; i++) {
|
| 1567 | 1567 |
avio_seek(s->pb, pos + i * ts->raw_packet_size, SEEK_SET); |
| 1568 | 1568 |
avio_read(s->pb, pcr_buf, 12); |
| ... | ... |
@@ -1591,7 +1591,7 @@ static int mpegts_read_packet(AVFormatContext *s, |
| 1591 | 1591 |
MpegTSContext *ts = s->priv_data; |
| 1592 | 1592 |
int ret, i; |
| 1593 | 1593 |
|
| 1594 |
- if (url_ftell(s->pb) != ts->last_pos) {
|
|
| 1594 |
+ if (avio_tell(s->pb) != ts->last_pos) {
|
|
| 1595 | 1595 |
/* seek detected, flush pes buffer */ |
| 1596 | 1596 |
for (i = 0; i < NB_PID_MAX; i++) {
|
| 1597 | 1597 |
if (ts->pids[i] && ts->pids[i]->type == MPEGTS_PES) {
|
| ... | ... |
@@ -1620,7 +1620,7 @@ static int mpegts_read_packet(AVFormatContext *s, |
| 1620 | 1620 |
} |
| 1621 | 1621 |
} |
| 1622 | 1622 |
|
| 1623 |
- ts->last_pos = url_ftell(s->pb); |
|
| 1623 |
+ ts->last_pos = avio_tell(s->pb); |
|
| 1624 | 1624 |
|
| 1625 | 1625 |
return ret; |
| 1626 | 1626 |
} |
| ... | ... |
@@ -1771,7 +1771,7 @@ static int read_seek(AVFormatContext *s, int stream_index, int64_t target_ts, in |
| 1771 | 1771 |
if(av_seek_frame_binary(s, stream_index, target_ts, flags) < 0) |
| 1772 | 1772 |
return -1; |
| 1773 | 1773 |
|
| 1774 |
- pos= url_ftell(s->pb); |
|
| 1774 |
+ pos= avio_tell(s->pb); |
|
| 1775 | 1775 |
|
| 1776 | 1776 |
for(;;) {
|
| 1777 | 1777 |
avio_seek(s->pb, pos, SEEK_SET); |
| ... | ... |
@@ -595,7 +595,7 @@ static void retransmit_si_info(AVFormatContext *s) |
| 595 | 595 |
|
| 596 | 596 |
static int64_t get_pcr(const MpegTSWrite *ts, AVIOContext *pb) |
| 597 | 597 |
{
|
| 598 |
- return av_rescale(url_ftell(pb) + 11, 8 * PCR_TIME_BASE, ts->mux_rate) + |
|
| 598 |
+ return av_rescale(avio_tell(pb) + 11, 8 * PCR_TIME_BASE, ts->mux_rate) + |
|
| 599 | 599 |
ts->first_pcr; |
| 600 | 600 |
} |
| 601 | 601 |
|
| ... | ... |
@@ -162,7 +162,7 @@ static int mtv_read_packet(AVFormatContext *s, AVPacket *pkt) |
| 162 | 162 |
int i; |
| 163 | 163 |
#endif |
| 164 | 164 |
|
| 165 |
- if((url_ftell(pb) - s->data_offset + mtv->img_segment_size) % mtv->full_segment_size) |
|
| 165 |
+ if((avio_tell(pb) - s->data_offset + mtv->img_segment_size) % mtv->full_segment_size) |
|
| 166 | 166 |
{
|
| 167 | 167 |
avio_seek(pb, MTV_AUDIO_PADDING_SIZE, SEEK_CUR); |
| 168 | 168 |
|
| ... | ... |
@@ -193,7 +193,7 @@ static int klv_read_packet(KLVPacket *klv, AVIOContext *pb) |
| 193 | 193 |
{
|
| 194 | 194 |
if (!mxf_read_sync(pb, mxf_klv_key, 4)) |
| 195 | 195 |
return -1; |
| 196 |
- klv->offset = url_ftell(pb) - 4; |
|
| 196 |
+ klv->offset = avio_tell(pb) - 4; |
|
| 197 | 197 |
memcpy(klv->key, mxf_klv_key, 4); |
| 198 | 198 |
avio_read(pb, klv->key + 4, 12); |
| 199 | 199 |
klv->length = klv_decode_ber_length(pb); |
| ... | ... |
@@ -247,7 +247,7 @@ static int mxf_decrypt_triplet(AVFormatContext *s, AVPacket *pkt, KLVPacket *klv |
| 247 | 247 |
static const uint8_t checkv[16] = {0x43, 0x48, 0x55, 0x4b, 0x43, 0x48, 0x55, 0x4b, 0x43, 0x48, 0x55, 0x4b, 0x43, 0x48, 0x55, 0x4b};
|
| 248 | 248 |
MXFContext *mxf = s->priv_data; |
| 249 | 249 |
AVIOContext *pb = s->pb; |
| 250 |
- int64_t end = url_ftell(pb) + klv->length; |
|
| 250 |
+ int64_t end = avio_tell(pb) + klv->length; |
|
| 251 | 251 |
uint64_t size; |
| 252 | 252 |
uint64_t orig_size; |
| 253 | 253 |
uint64_t plaintext_size; |
| ... | ... |
@@ -297,7 +297,7 @@ static int mxf_decrypt_triplet(AVFormatContext *s, AVPacket *pkt, KLVPacket *klv |
| 297 | 297 |
&pkt->data[plaintext_size], size >> 4, ivec, 1); |
| 298 | 298 |
pkt->size = orig_size; |
| 299 | 299 |
pkt->stream_index = index; |
| 300 |
- avio_seek(pb, end - url_ftell(pb), SEEK_CUR); |
|
| 300 |
+ avio_seek(pb, end - avio_tell(pb), SEEK_CUR); |
|
| 301 | 301 |
return 0; |
| 302 | 302 |
} |
| 303 | 303 |
|
| ... | ... |
@@ -866,14 +866,14 @@ static int mxf_read_local_tags(MXFContext *mxf, KLVPacket *klv, MXFMetadataReadF |
| 866 | 866 |
{
|
| 867 | 867 |
AVIOContext *pb = mxf->fc->pb; |
| 868 | 868 |
MXFMetadataSet *ctx = ctx_size ? av_mallocz(ctx_size) : mxf; |
| 869 |
- uint64_t klv_end = url_ftell(pb) + klv->length; |
|
| 869 |
+ uint64_t klv_end = avio_tell(pb) + klv->length; |
|
| 870 | 870 |
|
| 871 | 871 |
if (!ctx) |
| 872 | 872 |
return -1; |
| 873 |
- while (url_ftell(pb) + 4 < klv_end) {
|
|
| 873 |
+ while (avio_tell(pb) + 4 < klv_end) {
|
|
| 874 | 874 |
int tag = avio_rb16(pb); |
| 875 | 875 |
int size = avio_rb16(pb); /* KLV specified by 0x53 */ |
| 876 |
- uint64_t next = url_ftell(pb) + size; |
|
| 876 |
+ uint64_t next = avio_tell(pb) + size; |
|
| 877 | 877 |
UID uid = {0};
|
| 878 | 878 |
|
| 879 | 879 |
av_dlog(mxf->fc, "local tag %#04x size %d\n", tag, size); |
| ... | ... |
@@ -1171,14 +1171,14 @@ static void mxf_write_index_table_segment(AVFormatContext *s) |
| 1171 | 1171 |
|
| 1172 | 1172 |
static void mxf_write_klv_fill(AVFormatContext *s) |
| 1173 | 1173 |
{
|
| 1174 |
- unsigned pad = klv_fill_size(url_ftell(s->pb)); |
|
| 1174 |
+ unsigned pad = klv_fill_size(avio_tell(s->pb)); |
|
| 1175 | 1175 |
if (pad) {
|
| 1176 | 1176 |
avio_write(s->pb, klv_fill_key, 16); |
| 1177 | 1177 |
pad -= 16 + 4; |
| 1178 | 1178 |
klv_encode_ber4_length(s->pb, pad); |
| 1179 | 1179 |
for (; pad; pad--) |
| 1180 | 1180 |
avio_w8(s->pb, 0); |
| 1181 |
- assert(!(url_ftell(s->pb) & (KAG_SIZE-1))); |
|
| 1181 |
+ assert(!(avio_tell(s->pb) & (KAG_SIZE-1))); |
|
| 1182 | 1182 |
} |
| 1183 | 1183 |
} |
| 1184 | 1184 |
|
| ... | ... |
@@ -1190,7 +1190,7 @@ static void mxf_write_partition(AVFormatContext *s, int bodysid, |
| 1190 | 1190 |
AVIOContext *pb = s->pb; |
| 1191 | 1191 |
int64_t header_byte_count_offset; |
| 1192 | 1192 |
unsigned index_byte_count = 0; |
| 1193 |
- uint64_t partition_offset = url_ftell(pb); |
|
| 1193 |
+ uint64_t partition_offset = avio_tell(pb); |
|
| 1194 | 1194 |
|
| 1195 | 1195 |
if (!mxf->edit_unit_byte_count && mxf->edit_units_count) |
| 1196 | 1196 |
index_byte_count = 85 + 12+(s->nb_streams+1)*6 + |
| ... | ... |
@@ -1233,7 +1233,7 @@ static void mxf_write_partition(AVFormatContext *s, int bodysid, |
| 1233 | 1233 |
avio_wb64(pb, mxf->footer_partition_offset); // footerPartition |
| 1234 | 1234 |
|
| 1235 | 1235 |
// set offset |
| 1236 |
- header_byte_count_offset = url_ftell(pb); |
|
| 1236 |
+ header_byte_count_offset = avio_tell(pb); |
|
| 1237 | 1237 |
avio_wb64(pb, 0); // headerByteCount, update later |
| 1238 | 1238 |
|
| 1239 | 1239 |
// indexTable |
| ... | ... |
@@ -1260,10 +1260,10 @@ static void mxf_write_partition(AVFormatContext *s, int bodysid, |
| 1260 | 1260 |
unsigned header_byte_count; |
| 1261 | 1261 |
|
| 1262 | 1262 |
mxf_write_klv_fill(s); |
| 1263 |
- start = url_ftell(s->pb); |
|
| 1263 |
+ start = avio_tell(s->pb); |
|
| 1264 | 1264 |
mxf_write_primer_pack(s); |
| 1265 | 1265 |
mxf_write_header_metadata_sets(s); |
| 1266 |
- pos = url_ftell(s->pb); |
|
| 1266 |
+ pos = avio_tell(s->pb); |
|
| 1267 | 1267 |
header_byte_count = pos - start + klv_fill_size(pos); |
| 1268 | 1268 |
|
| 1269 | 1269 |
// update header_byte_count |
| ... | ... |
@@ -1617,7 +1617,7 @@ static void mxf_write_d10_video_packet(AVFormatContext *s, AVStream *st, AVPacke |
| 1617 | 1617 |
klv_encode_ber4_length(s->pb, pad); |
| 1618 | 1618 |
for (; pad; pad--) |
| 1619 | 1619 |
avio_w8(s->pb, 0); |
| 1620 |
- assert(!(url_ftell(s->pb) & (KAG_SIZE-1))); |
|
| 1620 |
+ assert(!(avio_tell(s->pb) & (KAG_SIZE-1))); |
|
| 1621 | 1621 |
} else {
|
| 1622 | 1622 |
av_log(s, AV_LOG_WARNING, "cannot fill d-10 video packet\n"); |
| 1623 | 1623 |
for (; pad > 0; pad--) |
| ... | ... |
@@ -1740,7 +1740,7 @@ static void mxf_write_random_index_pack(AVFormatContext *s) |
| 1740 | 1740 |
{
|
| 1741 | 1741 |
MXFContext *mxf = s->priv_data; |
| 1742 | 1742 |
AVIOContext *pb = s->pb; |
| 1743 |
- uint64_t pos = url_ftell(pb); |
|
| 1743 |
+ uint64_t pos = avio_tell(pb); |
|
| 1744 | 1744 |
int i; |
| 1745 | 1745 |
|
| 1746 | 1746 |
avio_write(pb, random_index_pack_key, 16); |
| ... | ... |
@@ -1760,7 +1760,7 @@ static void mxf_write_random_index_pack(AVFormatContext *s) |
| 1760 | 1760 |
avio_wb32(pb, 0); // BodySID of footer partition |
| 1761 | 1761 |
avio_wb64(pb, mxf->footer_partition_offset); |
| 1762 | 1762 |
|
| 1763 |
- avio_wb32(pb, url_ftell(pb) - pos + 4); |
|
| 1763 |
+ avio_wb32(pb, avio_tell(pb) - pos + 4); |
|
| 1764 | 1764 |
} |
| 1765 | 1765 |
|
| 1766 | 1766 |
static int mxf_write_footer(AVFormatContext *s) |
| ... | ... |
@@ -1771,7 +1771,7 @@ static int mxf_write_footer(AVFormatContext *s) |
| 1771 | 1771 |
mxf->duration = mxf->last_indexed_edit_unit + mxf->edit_units_count; |
| 1772 | 1772 |
|
| 1773 | 1773 |
mxf_write_klv_fill(s); |
| 1774 |
- mxf->footer_partition_offset = url_ftell(pb); |
|
| 1774 |
+ mxf->footer_partition_offset = avio_tell(pb); |
|
| 1775 | 1775 |
if (mxf->edit_unit_byte_count) { // no need to repeat index
|
| 1776 | 1776 |
mxf_write_partition(s, 0, 0, footer_partition_key, 0); |
| 1777 | 1777 |
} else {
|
| ... | ... |
@@ -225,7 +225,7 @@ static int nsv_resync(AVFormatContext *s) |
| 225 | 225 |
uint32_t v = 0; |
| 226 | 226 |
int i; |
| 227 | 227 |
|
| 228 |
- av_dlog(s, "%s(), offset = %"PRId64", state = %d\n", __FUNCTION__, url_ftell(pb), nsv->state); |
|
| 228 |
+ av_dlog(s, "%s(), offset = %"PRId64", state = %d\n", __FUNCTION__, avio_tell(pb), nsv->state); |
|
| 229 | 229 |
|
| 230 | 230 |
//nsv->state = NSV_UNSYNC; |
| 231 | 231 |
|
| ... | ... |
@@ -299,7 +299,7 @@ static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap) |
| 299 | 299 |
if (url_feof(pb)) |
| 300 | 300 |
return -1; |
| 301 | 301 |
|
| 302 |
- av_dlog(s, "NSV got header; filepos %"PRId64"\n", url_ftell(pb)); |
|
| 302 |
+ av_dlog(s, "NSV got header; filepos %"PRId64"\n", avio_tell(pb)); |
|
| 303 | 303 |
|
| 304 | 304 |
if (strings_size > 0) {
|
| 305 | 305 |
char *strings; /* last byte will be '\0' to play safe with str*() */ |
| ... | ... |
@@ -334,7 +334,7 @@ static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap) |
| 334 | 334 |
if (url_feof(pb)) |
| 335 | 335 |
return -1; |
| 336 | 336 |
|
| 337 |
- av_dlog(s, "NSV got infos; filepos %"PRId64"\n", url_ftell(pb)); |
|
| 337 |
+ av_dlog(s, "NSV got infos; filepos %"PRId64"\n", avio_tell(pb)); |
|
| 338 | 338 |
|
| 339 | 339 |
if (table_entries_used > 0) {
|
| 340 | 340 |
int i; |
| ... | ... |
@@ -355,7 +355,7 @@ static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap) |
| 355 | 355 |
} |
| 356 | 356 |
} |
| 357 | 357 |
|
| 358 |
- av_dlog(s, "NSV got index; filepos %"PRId64"\n", url_ftell(pb)); |
|
| 358 |
+ av_dlog(s, "NSV got index; filepos %"PRId64"\n", avio_tell(pb)); |
|
| 359 | 359 |
|
| 360 | 360 |
#ifdef DEBUG_DUMP_INDEX |
| 361 | 361 |
#define V(v) ((v<0x20 || v > 127)?'.':v) |
| ... | ... |
@@ -98,7 +98,7 @@ static inline uint64_t get_vb_trace(AVIOContext *bc, char *file, char *func, int |
| 98 | 98 |
static int get_packetheader(NUTContext *nut, AVIOContext *bc, int calculate_checksum, uint64_t startcode) |
| 99 | 99 |
{
|
| 100 | 100 |
int64_t size; |
| 101 |
-// start= url_ftell(bc) - 8; |
|
| 101 |
+// start= avio_tell(bc) - 8; |
|
| 102 | 102 |
|
| 103 | 103 |
startcode= av_be2ne64(startcode); |
| 104 | 104 |
startcode= ff_crc04C11DB7_update(0, (uint8_t*)&startcode, 8); |
| ... | ... |
@@ -148,7 +148,7 @@ static int64_t find_startcode(AVIOContext *bc, uint64_t code, int64_t pos){
|
| 148 | 148 |
for(;;){
|
| 149 | 149 |
uint64_t startcode= find_any_startcode(bc, pos); |
| 150 | 150 |
if(startcode == code) |
| 151 |
- return url_ftell(bc) - 8; |
|
| 151 |
+ return avio_tell(bc) - 8; |
|
| 152 | 152 |
else if(startcode == 0) |
| 153 | 153 |
return -1; |
| 154 | 154 |
pos=-1; |
| ... | ... |
@@ -176,7 +176,7 @@ static int nut_probe(AVProbeData *p){
|
| 176 | 176 |
dst= tmp; |
| 177 | 177 |
|
| 178 | 178 |
static int skip_reserved(AVIOContext *bc, int64_t pos){
|
| 179 |
- pos -= url_ftell(bc); |
|
| 179 |
+ pos -= avio_tell(bc); |
|
| 180 | 180 |
if(pos<0){
|
| 181 | 181 |
avio_seek(bc, pos, SEEK_CUR); |
| 182 | 182 |
return -1; |
| ... | ... |
@@ -196,7 +196,7 @@ static int decode_main_header(NUTContext *nut){
|
| 196 | 196 |
int64_t tmp_match; |
| 197 | 197 |
|
| 198 | 198 |
end= get_packetheader(nut, bc, 1, MAIN_STARTCODE); |
| 199 |
- end += url_ftell(bc); |
|
| 199 |
+ end += avio_tell(bc); |
|
| 200 | 200 |
|
| 201 | 201 |
GET_V(tmp , tmp >=2 && tmp <= 3) |
| 202 | 202 |
GET_V(stream_count , tmp > 0 && tmp <= NUT_MAX_STREAMS) |
| ... | ... |
@@ -267,7 +267,7 @@ static int decode_main_header(NUTContext *nut){
|
| 267 | 267 |
} |
| 268 | 268 |
assert(nut->frame_code['N'].flags == FLAG_INVALID); |
| 269 | 269 |
|
| 270 |
- if(end > url_ftell(bc) + 4){
|
|
| 270 |
+ if(end > avio_tell(bc) + 4){
|
|
| 271 | 271 |
int rem= 1024; |
| 272 | 272 |
GET_V(nut->header_count, tmp<128U) |
| 273 | 273 |
nut->header_count++; |
| ... | ... |
@@ -306,7 +306,7 @@ static int decode_stream_header(NUTContext *nut){
|
| 306 | 306 |
AVStream *st; |
| 307 | 307 |
|
| 308 | 308 |
end= get_packetheader(nut, bc, 1, STREAM_STARTCODE); |
| 309 |
- end += url_ftell(bc); |
|
| 309 |
+ end += avio_tell(bc); |
|
| 310 | 310 |
|
| 311 | 311 |
GET_V(stream_id, tmp < s->nb_streams && !nut->stream[tmp].time_base); |
| 312 | 312 |
stc= &nut->stream[stream_id]; |
| ... | ... |
@@ -409,7 +409,7 @@ static int decode_info_header(NUTContext *nut){
|
| 409 | 409 |
AVMetadata **metadata = NULL; |
| 410 | 410 |
|
| 411 | 411 |
end= get_packetheader(nut, bc, 1, INFO_STARTCODE); |
| 412 |
- end += url_ftell(bc); |
|
| 412 |
+ end += avio_tell(bc); |
|
| 413 | 413 |
|
| 414 | 414 |
GET_V(stream_id_plus1, tmp <= s->nb_streams) |
| 415 | 415 |
chapter_id = get_s(bc); |
| ... | ... |
@@ -480,10 +480,10 @@ static int decode_syncpoint(NUTContext *nut, int64_t *ts, int64_t *back_ptr){
|
| 480 | 480 |
AVIOContext *bc = s->pb; |
| 481 | 481 |
int64_t end, tmp; |
| 482 | 482 |
|
| 483 |
- nut->last_syncpoint_pos= url_ftell(bc)-8; |
|
| 483 |
+ nut->last_syncpoint_pos= avio_tell(bc)-8; |
|
| 484 | 484 |
|
| 485 | 485 |
end= get_packetheader(nut, bc, 1, SYNCPOINT_STARTCODE); |
| 486 |
- end += url_ftell(bc); |
|
| 486 |
+ end += avio_tell(bc); |
|
| 487 | 487 |
|
| 488 | 488 |
tmp= ff_get_v(bc); |
| 489 | 489 |
*back_ptr= nut->last_syncpoint_pos - 16*ff_get_v(bc); |
| ... | ... |
@@ -521,7 +521,7 @@ static int find_and_decode_index(NUTContext *nut){
|
| 521 | 521 |
} |
| 522 | 522 |
|
| 523 | 523 |
end= get_packetheader(nut, bc, 1, INDEX_STARTCODE); |
| 524 |
- end += url_ftell(bc); |
|
| 524 |
+ end += avio_tell(bc); |
|
| 525 | 525 |
|
| 526 | 526 |
ff_get_v(bc); //max_pts |
| 527 | 527 |
GET_V(syncpoint_count, tmp < INT_MAX/8 && tmp > 0) |
| ... | ... |
@@ -635,7 +635,7 @@ static int nut_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 635 | 635 |
pos=0; |
| 636 | 636 |
for(;;){
|
| 637 | 637 |
uint64_t startcode= find_any_startcode(bc, pos); |
| 638 |
- pos= url_ftell(bc); |
|
| 638 |
+ pos= avio_tell(bc); |
|
| 639 | 639 |
|
| 640 | 640 |
if(startcode==0){
|
| 641 | 641 |
av_log(s, AV_LOG_ERROR, "EOF before video frames\n"); |
| ... | ... |
@@ -653,7 +653,7 @@ static int nut_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 653 | 653 |
s->data_offset= pos-8; |
| 654 | 654 |
|
| 655 | 655 |
if(!url_is_streamed(bc)){
|
| 656 |
- int64_t orig_pos= url_ftell(bc); |
|
| 656 |
+ int64_t orig_pos= avio_tell(bc); |
|
| 657 | 657 |
find_and_decode_index(nut); |
| 658 | 658 |
avio_seek(bc, orig_pos, SEEK_SET); |
| 659 | 659 |
} |
| ... | ... |
@@ -671,8 +671,8 @@ static int decode_frame_header(NUTContext *nut, int64_t *pts, int *stream_id, ui |
| 671 | 671 |
int size, flags, size_mul, pts_delta, i, reserved_count; |
| 672 | 672 |
uint64_t tmp; |
| 673 | 673 |
|
| 674 |
- if(url_ftell(bc) > nut->last_syncpoint_pos + nut->max_distance){
|
|
| 675 |
- av_log(s, AV_LOG_ERROR, "Last frame must have been damaged %"PRId64" > %"PRId64" + %d\n", url_ftell(bc), nut->last_syncpoint_pos, nut->max_distance); |
|
| 674 |
+ if(avio_tell(bc) > nut->last_syncpoint_pos + nut->max_distance){
|
|
| 675 |
+ av_log(s, AV_LOG_ERROR, "Last frame must have been damaged %"PRId64" > %"PRId64" + %d\n", avio_tell(bc), nut->last_syncpoint_pos, nut->max_distance); |
|
| 676 | 676 |
return AVERROR_INVALIDDATA; |
| 677 | 677 |
} |
| 678 | 678 |
|
| ... | ... |
@@ -763,7 +763,7 @@ static int decode_frame(NUTContext *nut, AVPacket *pkt, int frame_code){
|
| 763 | 763 |
|
| 764 | 764 |
av_new_packet(pkt, size + nut->header_len[header_idx]); |
| 765 | 765 |
memcpy(pkt->data, nut->header[header_idx], nut->header_len[header_idx]); |
| 766 |
- pkt->pos= url_ftell(bc); //FIXME |
|
| 766 |
+ pkt->pos= avio_tell(bc); //FIXME |
|
| 767 | 767 |
avio_read(bc, pkt->data + nut->header_len[header_idx], size); |
| 768 | 768 |
|
| 769 | 769 |
pkt->stream_index = stream_id; |
| ... | ... |
@@ -782,7 +782,7 @@ static int nut_read_packet(AVFormatContext *s, AVPacket *pkt) |
| 782 | 782 |
int64_t ts, back_ptr; |
| 783 | 783 |
|
| 784 | 784 |
for(;;){
|
| 785 |
- int64_t pos= url_ftell(bc); |
|
| 785 |
+ int64_t pos= avio_tell(bc); |
|
| 786 | 786 |
uint64_t tmp= nut->next_startcode; |
| 787 | 787 |
nut->next_startcode=0; |
| 788 | 788 |
|
| ... | ... |
@@ -639,13 +639,13 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt){
|
| 639 | 639 |
if(pkt->pts < 0) |
| 640 | 640 |
return -1; |
| 641 | 641 |
|
| 642 |
- if(1LL<<(20+3*nut->header_count) <= url_ftell(bc)) |
|
| 642 |
+ if(1LL<<(20+3*nut->header_count) <= avio_tell(bc)) |
|
| 643 | 643 |
write_headers(s, bc); |
| 644 | 644 |
|
| 645 | 645 |
if(key_frame && !(nus->last_flags & FLAG_KEY)) |
| 646 | 646 |
store_sp= 1; |
| 647 | 647 |
|
| 648 |
- if(pkt->size + 30/*FIXME check*/ + url_ftell(bc) >= nut->last_syncpoint_pos + nut->max_distance) |
|
| 648 |
+ if(pkt->size + 30/*FIXME check*/ + avio_tell(bc) >= nut->last_syncpoint_pos + nut->max_distance) |
|
| 649 | 649 |
store_sp= 1; |
| 650 | 650 |
|
| 651 | 651 |
//FIXME: Ensure store_sp is 1 in the first place. |
| ... | ... |
@@ -668,7 +668,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt){
|
| 668 | 668 |
sp= av_tree_find(nut->syncpoints, &dummy, (void *) ff_nut_sp_pos_cmp, |
| 669 | 669 |
NULL); |
| 670 | 670 |
|
| 671 |
- nut->last_syncpoint_pos= url_ftell(bc); |
|
| 671 |
+ nut->last_syncpoint_pos= avio_tell(bc); |
|
| 672 | 672 |
ret = url_open_dyn_buf(&dyn_bc); |
| 673 | 673 |
if(ret < 0) |
| 674 | 674 |
return ret; |
| ... | ... |
@@ -197,7 +197,7 @@ static int nuv_packet(AVFormatContext *s, AVPacket *pkt) {
|
| 197 | 197 |
int ret, size; |
| 198 | 198 |
while (!url_feof(pb)) {
|
| 199 | 199 |
int copyhdrsize = ctx->rtjpg_video ? HDRSIZE : 0; |
| 200 |
- uint64_t pos = url_ftell(pb); |
|
| 200 |
+ uint64_t pos = avio_tell(pb); |
|
| 201 | 201 |
ret = avio_read(pb, hdr, HDRSIZE); |
| 202 | 202 |
if (ret < HDRSIZE) |
| 203 | 203 |
return ret < 0 ? ret : AVERROR(EIO); |
| ... | ... |
@@ -62,7 +62,7 @@ ogg_save (AVFormatContext * s) |
| 62 | 62 |
struct ogg_state *ost = |
| 63 | 63 |
av_malloc(sizeof (*ost) + (ogg->nstreams-1) * sizeof (*ogg->streams)); |
| 64 | 64 |
int i; |
| 65 |
- ost->pos = url_ftell (s->pb); |
|
| 65 |
+ ost->pos = avio_tell (s->pb); |
|
| 66 | 66 |
ost->curidx = ogg->curidx; |
| 67 | 67 |
ost->next = ogg->state; |
| 68 | 68 |
ost->nstreams = ogg->nstreams; |
| ... | ... |
@@ -247,7 +247,7 @@ ogg_read_page (AVFormatContext * s, int *str) |
| 247 | 247 |
} |
| 248 | 248 |
|
| 249 | 249 |
os = ogg->streams + idx; |
| 250 |
- os->page_pos = url_ftell(bc) - 27; |
|
| 250 |
+ os->page_pos = avio_tell(bc) - 27; |
|
| 251 | 251 |
|
| 252 | 252 |
if(os->psize > 0) |
| 253 | 253 |
ogg_new_buf(ogg, idx); |
| ... | ... |
@@ -607,7 +607,7 @@ ogg_read_timestamp (AVFormatContext * s, int stream_index, int64_t * pos_arg, |
| 607 | 607 |
avio_seek(bc, *pos_arg, SEEK_SET); |
| 608 | 608 |
ogg_reset(ogg); |
| 609 | 609 |
|
| 610 |
- while (url_ftell(bc) < pos_limit && !ogg_packet(s, &i, NULL, NULL, pos_arg)) {
|
|
| 610 |
+ while (avio_tell(bc) < pos_limit && !ogg_packet(s, &i, NULL, NULL, pos_arg)) {
|
|
| 611 | 611 |
if (i == stream_index) {
|
| 612 | 612 |
pts = ogg_calc_pts(s, i, NULL); |
| 613 | 613 |
if (os->keyframe_seek && !(os->pflags & AV_PKT_FLAG_KEY)) |
| ... | ... |
@@ -67,7 +67,7 @@ typedef struct {
|
| 67 | 67 |
|
| 68 | 68 |
static void ogg_update_checksum(AVFormatContext *s, AVIOContext *pb, int64_t crc_offset) |
| 69 | 69 |
{
|
| 70 |
- int64_t pos = url_ftell(pb); |
|
| 70 |
+ int64_t pos = avio_tell(pb); |
|
| 71 | 71 |
uint32_t checksum = get_checksum(pb); |
| 72 | 72 |
avio_seek(pb, crc_offset, SEEK_SET); |
| 73 | 73 |
avio_wb32(pb, checksum); |
| ... | ... |
@@ -92,7 +92,7 @@ static int ogg_write_page(AVFormatContext *s, OGGPage *page, int extra_flags) |
| 92 | 92 |
avio_wl64(pb, page->granule); |
| 93 | 93 |
avio_wl32(pb, oggstream->serial_num); |
| 94 | 94 |
avio_wl32(pb, oggstream->page_counter++); |
| 95 |
- crc_offset = url_ftell(pb); |
|
| 95 |
+ crc_offset = avio_tell(pb); |
|
| 96 | 96 |
avio_wl32(pb, 0); // crc |
| 97 | 97 |
avio_w8(pb, page->segments_count); |
| 98 | 98 |
avio_write(pb, page->segments, page->segments_count); |
| ... | ... |
@@ -186,7 +186,7 @@ static int str_read_packet(AVFormatContext *s, |
| 186 | 186 |
if (av_new_packet(pkt, sector_count*VIDEO_DATA_CHUNK_SIZE)) |
| 187 | 187 |
return AVERROR(EIO); |
| 188 | 188 |
|
| 189 |
- pkt->pos= url_ftell(pb) - RAW_CD_SECTOR_SIZE; |
|
| 189 |
+ pkt->pos= avio_tell(pb) - RAW_CD_SECTOR_SIZE; |
|
| 190 | 190 |
pkt->stream_index = |
| 191 | 191 |
str->channels[channel].video_stream_index; |
| 192 | 192 |
} |
| ... | ... |
@@ -73,7 +73,7 @@ static int read_part_of_packet(AVFormatContext *s, int64_t *pts, |
| 73 | 73 |
int64_t pva_pts = AV_NOPTS_VALUE, startpos; |
| 74 | 74 |
|
| 75 | 75 |
recover: |
| 76 |
- startpos = url_ftell(pb); |
|
| 76 |
+ startpos = avio_tell(pb); |
|
| 77 | 77 |
|
| 78 | 78 |
syncword = avio_rb16(pb); |
| 79 | 79 |
streamid = avio_r8(pb); |
| ... | ... |
@@ -190,7 +190,7 @@ static int64_t pva_read_timestamp(struct AVFormatContext *s, int stream_index, |
| 190 | 190 |
continue; |
| 191 | 191 |
} |
| 192 | 192 |
if (streamid - 1 != stream_index || res == AV_NOPTS_VALUE) {
|
| 193 |
- *pos = url_ftell(pb) + length; |
|
| 193 |
+ *pos = avio_tell(pb) + length; |
|
| 194 | 194 |
continue; |
| 195 | 195 |
} |
| 196 | 196 |
break; |
| ... | ... |
@@ -165,7 +165,7 @@ static int qcp_read_packet(AVFormatContext *s, AVPacket *pkt) |
| 165 | 165 |
return ret; |
| 166 | 166 |
} |
| 167 | 167 |
|
| 168 |
- if (url_ftell(pb) & 1 && avio_r8(pb)) |
|
| 168 |
+ if (avio_tell(pb) & 1 && avio_r8(pb)) |
|
| 169 | 169 |
av_log(s, AV_LOG_WARNING, "Padding should be 0.\n"); |
| 170 | 170 |
|
| 171 | 171 |
tag = avio_rl32(pb); |
| ... | ... |
@@ -38,7 +38,7 @@ typedef struct {
|
| 38 | 38 |
|
| 39 | 39 |
static int read_atom(AVFormatContext *s, Atom *atom) |
| 40 | 40 |
{
|
| 41 |
- atom->offset = url_ftell(s->pb); |
|
| 41 |
+ atom->offset = avio_tell(s->pb); |
|
| 42 | 42 |
atom->size = avio_rb32(s->pb); |
| 43 | 43 |
if (atom->size < 8) |
| 44 | 44 |
return -1; |
| ... | ... |
@@ -175,7 +175,7 @@ static int r3d_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 175 | 175 |
return -1; |
| 176 | 176 |
} |
| 177 | 177 |
|
| 178 |
- s->data_offset = url_ftell(s->pb); |
|
| 178 |
+ s->data_offset = avio_tell(s->pb); |
|
| 179 | 179 |
av_dlog(s, "data offset %#llx\n", s->data_offset); |
| 180 | 180 |
if (url_is_streamed(s->pb)) |
| 181 | 181 |
return 0; |
| ... | ... |
@@ -210,7 +210,7 @@ static int r3d_read_redv(AVFormatContext *s, AVPacket *pkt, Atom *atom) |
| 210 | 210 |
{
|
| 211 | 211 |
AVStream *st = s->streams[0]; |
| 212 | 212 |
int tmp, tmp2; |
| 213 |
- uint64_t pos = url_ftell(s->pb); |
|
| 213 |
+ uint64_t pos = avio_tell(s->pb); |
|
| 214 | 214 |
unsigned dts; |
| 215 | 215 |
int ret; |
| 216 | 216 |
|
| ... | ... |
@@ -241,7 +241,7 @@ static int r3d_read_redv(AVFormatContext *s, AVPacket *pkt, Atom *atom) |
| 241 | 241 |
tmp = avio_rb32(s->pb); |
| 242 | 242 |
av_dlog(s, "metadata len %d\n", tmp); |
| 243 | 243 |
} |
| 244 |
- tmp = atom->size - 8 - (url_ftell(s->pb) - pos); |
|
| 244 |
+ tmp = atom->size - 8 - (avio_tell(s->pb) - pos); |
|
| 245 | 245 |
if (tmp < 0) |
| 246 | 246 |
return -1; |
| 247 | 247 |
ret = av_get_packet(s->pb, pkt, tmp); |
| ... | ... |
@@ -264,7 +264,7 @@ static int r3d_read_reda(AVFormatContext *s, AVPacket *pkt, Atom *atom) |
| 264 | 264 |
{
|
| 265 | 265 |
AVStream *st = s->streams[1]; |
| 266 | 266 |
int tmp, tmp2, samples, size; |
| 267 |
- uint64_t pos = url_ftell(s->pb); |
|
| 267 |
+ uint64_t pos = avio_tell(s->pb); |
|
| 268 | 268 |
unsigned dts; |
| 269 | 269 |
int ret; |
| 270 | 270 |
|
| ... | ... |
@@ -287,7 +287,7 @@ static int r3d_read_reda(AVFormatContext *s, AVPacket *pkt, Atom *atom) |
| 287 | 287 |
tmp = avio_rb32(s->pb); // unknown |
| 288 | 288 |
av_dlog(s, "unknown %d\n", tmp); |
| 289 | 289 |
|
| 290 |
- size = atom->size - 8 - (url_ftell(s->pb) - pos); |
|
| 290 |
+ size = atom->size - 8 - (avio_tell(s->pb) - pos); |
|
| 291 | 291 |
if (size < 0) |
| 292 | 292 |
return -1; |
| 293 | 293 |
ret = av_get_packet(s->pb, pkt, size); |
| ... | ... |
@@ -80,7 +80,7 @@ int ff_raw_read_partial_packet(AVFormatContext *s, AVPacket *pkt) |
| 80 | 80 |
if (av_new_packet(pkt, size) < 0) |
| 81 | 81 |
return AVERROR(ENOMEM); |
| 82 | 82 |
|
| 83 |
- pkt->pos= url_ftell(s->pb); |
|
| 83 |
+ pkt->pos= avio_tell(s->pb); |
|
| 84 | 84 |
pkt->stream_index = 0; |
| 85 | 85 |
ret = ffio_read_partial(s->pb, pkt->data, size); |
| 86 | 86 |
if (ret < 0) {
|
| ... | ... |
@@ -305,7 +305,7 @@ rdt_parse_packet (AVFormatContext *ctx, PayloadContext *rdt, AVStream *st, |
| 305 | 305 |
flags = (flags & RTP_FLAG_KEY) ? 2 : 0; |
| 306 | 306 |
res = ff_rm_parse_packet (rdt->rmctx, &pb, st, rdt->rmst[st->index], len, pkt, |
| 307 | 307 |
&seq, flags, *timestamp); |
| 308 |
- pos = url_ftell(&pb); |
|
| 308 |
+ pos = avio_tell(&pb); |
|
| 309 | 309 |
if (res < 0) |
| 310 | 310 |
return res; |
| 311 | 311 |
if (res > 0) {
|
| ... | ... |
@@ -324,14 +324,14 @@ int64_t ff_start_tag(AVIOContext *pb, const char *tag) |
| 324 | 324 |
{
|
| 325 | 325 |
ffio_wfourcc(pb, tag); |
| 326 | 326 |
avio_wl32(pb, 0); |
| 327 |
- return url_ftell(pb); |
|
| 327 |
+ return avio_tell(pb); |
|
| 328 | 328 |
} |
| 329 | 329 |
|
| 330 | 330 |
void ff_end_tag(AVIOContext *pb, int64_t start) |
| 331 | 331 |
{
|
| 332 | 332 |
int64_t pos; |
| 333 | 333 |
|
| 334 |
- pos = url_ftell(pb); |
|
| 334 |
+ pos = avio_tell(pb); |
|
| 335 | 335 |
avio_seek(pb, start - 4, SEEK_SET); |
| 336 | 336 |
avio_wl32(pb, (uint32_t)(pos - start)); |
| 337 | 337 |
avio_seek(pb, pos, SEEK_SET); |
| ... | ... |
@@ -131,17 +131,17 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb, |
| 131 | 131 |
version = avio_rb16(pb); /* version */ |
| 132 | 132 |
if (version == 3) {
|
| 133 | 133 |
int header_size = avio_rb16(pb); |
| 134 |
- int64_t startpos = url_ftell(pb); |
|
| 134 |
+ int64_t startpos = avio_tell(pb); |
|
| 135 | 135 |
avio_seek(pb, 14, SEEK_CUR); |
| 136 | 136 |
rm_read_metadata(s, 0); |
| 137 |
- if ((startpos + header_size) >= url_ftell(pb) + 2) {
|
|
| 137 |
+ if ((startpos + header_size) >= avio_tell(pb) + 2) {
|
|
| 138 | 138 |
// fourcc (should always be "lpcJ") |
| 139 | 139 |
avio_r8(pb); |
| 140 | 140 |
get_str8(pb, buf, sizeof(buf)); |
| 141 | 141 |
} |
| 142 | 142 |
// Skip extra header crap (this should never happen) |
| 143 |
- if ((startpos + header_size) > url_ftell(pb)) |
|
| 144 |
- avio_seek(pb, header_size + startpos - url_ftell(pb), SEEK_CUR); |
|
| 143 |
+ if ((startpos + header_size) > avio_tell(pb)) |
|
| 144 |
+ avio_seek(pb, header_size + startpos - avio_tell(pb), SEEK_CUR); |
|
| 145 | 145 |
st->codec->sample_rate = 8000; |
| 146 | 146 |
st->codec->channels = 1; |
| 147 | 147 |
st->codec->codec_type = AVMEDIA_TYPE_AUDIO; |
| ... | ... |
@@ -273,7 +273,7 @@ ff_rm_read_mdpr_codecdata (AVFormatContext *s, AVIOContext *pb, |
| 273 | 273 |
int ret; |
| 274 | 274 |
|
| 275 | 275 |
av_set_pts_info(st, 64, 1, 1000); |
| 276 |
- codec_pos = url_ftell(pb); |
|
| 276 |
+ codec_pos = avio_tell(pb); |
|
| 277 | 277 |
v = avio_rb32(pb); |
| 278 | 278 |
if (v == MKTAG(0xfd, 'a', 'r', '.')) {
|
| 279 | 279 |
/* ra type header */ |
| ... | ... |
@@ -301,7 +301,7 @@ ff_rm_read_mdpr_codecdata (AVFormatContext *s, AVIOContext *pb, |
| 301 | 301 |
fps2= avio_rb16(pb); |
| 302 | 302 |
avio_rb16(pb); |
| 303 | 303 |
|
| 304 |
- if ((ret = rm_read_extradata(pb, st->codec, codec_data_size - (url_ftell(pb) - codec_pos))) < 0) |
|
| 304 |
+ if ((ret = rm_read_extradata(pb, st->codec, codec_data_size - (avio_tell(pb) - codec_pos))) < 0) |
|
| 305 | 305 |
return ret; |
| 306 | 306 |
|
| 307 | 307 |
// av_log(s, AV_LOG_DEBUG, "fps= %d fps2= %d\n", fps, fps2); |
| ... | ... |
@@ -320,7 +320,7 @@ ff_rm_read_mdpr_codecdata (AVFormatContext *s, AVIOContext *pb, |
| 320 | 320 |
|
| 321 | 321 |
skip: |
| 322 | 322 |
/* skip codec info */ |
| 323 |
- size = url_ftell(pb) - codec_pos; |
|
| 323 |
+ size = avio_tell(pb) - codec_pos; |
|
| 324 | 324 |
avio_seek(pb, codec_data_size - size, SEEK_CUR); |
| 325 | 325 |
|
| 326 | 326 |
return 0; |
| ... | ... |
@@ -362,7 +362,7 @@ static int rm_read_index(AVFormatContext *s) |
| 362 | 362 |
} |
| 363 | 363 |
|
| 364 | 364 |
skip: |
| 365 |
- if (next_off && url_ftell(pb) != next_off && |
|
| 365 |
+ if (next_off && avio_tell(pb) != next_off && |
|
| 366 | 366 |
avio_seek(pb, next_off, SEEK_SET) < 0) |
| 367 | 367 |
return -1; |
| 368 | 368 |
} while (next_off); |
| ... | ... |
@@ -480,7 +480,7 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 480 | 480 |
avio_rb32(pb); /* next data header */ |
| 481 | 481 |
|
| 482 | 482 |
if (!data_off) |
| 483 |
- data_off = url_ftell(pb) - 18; |
|
| 483 |
+ data_off = avio_tell(pb) - 18; |
|
| 484 | 484 |
if (indx_off && !url_is_streamed(pb) && !(s->flags & AVFMT_FLAG_IGNIDX) && |
| 485 | 485 |
avio_seek(pb, indx_off, SEEK_SET) >= 0) {
|
| 486 | 486 |
rm_read_index(s); |
| ... | ... |
@@ -517,7 +517,7 @@ static int sync(AVFormatContext *s, int64_t *timestamp, int *flags, int *stream_ |
| 517 | 517 |
|
| 518 | 518 |
while(!url_feof(pb)){
|
| 519 | 519 |
int len, num, i; |
| 520 |
- *pos= url_ftell(pb) - 3; |
|
| 520 |
+ *pos= avio_tell(pb) - 3; |
|
| 521 | 521 |
if(rm->remaining_len > 0){
|
| 522 | 522 |
num= rm->current_stream; |
| 523 | 523 |
len= rm->remaining_len; |
| ... | ... |
@@ -624,7 +624,7 @@ static int rm_assemble_video_frame(AVFormatContext *s, AVIOContext *pb, |
| 624 | 624 |
vst->videobufpos = 8*vst->slices + 1; |
| 625 | 625 |
vst->cur_slice = 0; |
| 626 | 626 |
vst->curpic_num = pic_num; |
| 627 |
- vst->pktpos = url_ftell(pb); |
|
| 627 |
+ vst->pktpos = avio_tell(pb); |
|
| 628 | 628 |
} |
| 629 | 629 |
if(type == 2) |
| 630 | 630 |
len = FFMIN(len, pos); |
| ... | ... |
@@ -841,7 +841,7 @@ static int rm_read_packet(AVFormatContext *s, AVPacket *pkt) |
| 841 | 841 |
len = !ast->audio_framesize ? RAW_PACKET_SIZE : |
| 842 | 842 |
ast->coded_framesize * ast->sub_packet_h / 2; |
| 843 | 843 |
flags = (seq++ == 1) ? 2 : 0; |
| 844 |
- pos = url_ftell(s->pb); |
|
| 844 |
+ pos = avio_tell(s->pb); |
|
| 845 | 845 |
} else {
|
| 846 | 846 |
len=sync(s, ×tamp, &flags, &i, &pos); |
| 847 | 847 |
if (len > 0) |
| ... | ... |
@@ -114,7 +114,7 @@ int ff_wms_parse_sdp_a_line(AVFormatContext *s, const char *p) |
| 114 | 114 |
if (ret < 0) |
| 115 | 115 |
return ret; |
| 116 | 116 |
av_metadata_copy(&s->metadata, rt->asf_ctx->metadata, 0); |
| 117 |
- rt->asf_pb_pos = url_ftell(&pb); |
|
| 117 |
+ rt->asf_pb_pos = avio_tell(&pb); |
|
| 118 | 118 |
av_free(buf); |
| 119 | 119 |
rt->asf_ctx->pb = NULL; |
| 120 | 120 |
} |
| ... | ... |
@@ -179,8 +179,8 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf, |
| 179 | 179 |
|
| 180 | 180 |
ffio_init_context(pb, buf, len, 0, NULL, NULL, NULL, NULL); |
| 181 | 181 |
|
| 182 |
- while (url_ftell(pb) + 4 < len) {
|
|
| 183 |
- int start_off = url_ftell(pb); |
|
| 182 |
+ while (avio_tell(pb) + 4 < len) {
|
|
| 183 |
+ int start_off = avio_tell(pb); |
|
| 184 | 184 |
|
| 185 | 185 |
mflags = avio_r8(pb); |
| 186 | 186 |
if (mflags & 0x80) |
| ... | ... |
@@ -192,7 +192,7 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf, |
| 192 | 192 |
avio_seek(pb, 4, SEEK_CUR); |
| 193 | 193 |
if (mflags & 0x8) /**< has location ID */ |
| 194 | 194 |
avio_seek(pb, 4, SEEK_CUR); |
| 195 |
- off = url_ftell(pb); |
|
| 195 |
+ off = avio_tell(pb); |
|
| 196 | 196 |
|
| 197 | 197 |
if (!(mflags & 0x40)) {
|
| 198 | 198 |
/** |
| ... | ... |
@@ -201,7 +201,7 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf, |
| 201 | 201 |
* ASF packet. This is used to spread one ASF packet over |
| 202 | 202 |
* multiple RTP packets. |
| 203 | 203 |
*/ |
| 204 |
- if (asf->pktbuf && len_off != url_ftell(asf->pktbuf)) {
|
|
| 204 |
+ if (asf->pktbuf && len_off != avio_tell(asf->pktbuf)) {
|
|
| 205 | 205 |
uint8_t *p; |
| 206 | 206 |
url_close_dyn_buf(asf->pktbuf, &p); |
| 207 | 207 |
asf->pktbuf = NULL; |
| ... | ... |
@@ -248,7 +248,7 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf, |
| 248 | 248 |
int i; |
| 249 | 249 |
|
| 250 | 250 |
res = av_read_packet(rt->asf_ctx, pkt); |
| 251 |
- rt->asf_pb_pos = url_ftell(pb); |
|
| 251 |
+ rt->asf_pb_pos = avio_tell(pb); |
|
| 252 | 252 |
if (res != 0) |
| 253 | 253 |
break; |
| 254 | 254 |
for (i = 0; i < s->nb_streams; i++) {
|
| ... | ... |
@@ -115,10 +115,10 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt, |
| 115 | 115 |
if (pos + data_len > len) |
| 116 | 116 |
return AVERROR_INVALIDDATA; |
| 117 | 117 |
/* TLVs */ |
| 118 |
- while (url_ftell(&pb) + 4 < pos + data_len) {
|
|
| 118 |
+ while (avio_tell(&pb) + 4 < pos + data_len) {
|
|
| 119 | 119 |
int tlv_len = avio_rb16(&pb); |
| 120 | 120 |
tag = avio_rl16(&pb); |
| 121 |
- if (url_ftell(&pb) + tlv_len > pos + data_len) |
|
| 121 |
+ if (avio_tell(&pb) + tlv_len > pos + data_len) |
|
| 122 | 122 |
return AVERROR_INVALIDDATA; |
| 123 | 123 |
|
| 124 | 124 |
#define MKTAG16(a,b) MKTAG(a,b,0,0) |
| ... | ... |
@@ -155,7 +155,7 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt, |
| 155 | 155 |
} |
| 156 | 156 |
|
| 157 | 157 |
/* 32-bit alignment */ |
| 158 |
- avio_seek(&pb, ((url_ftell(&pb) + 3) & ~3) - url_ftell(&pb), SEEK_CUR); |
|
| 158 |
+ avio_seek(&pb, ((avio_tell(&pb) + 3) & ~3) - avio_tell(&pb), SEEK_CUR); |
|
| 159 | 159 |
} else |
| 160 | 160 |
avio_seek(&pb, 4, SEEK_SET); |
| 161 | 161 |
|
| ... | ... |
@@ -164,7 +164,7 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt, |
| 164 | 164 |
return AVERROR_NOTSUPP; |
| 165 | 165 |
} |
| 166 | 166 |
|
| 167 |
- alen = len - url_ftell(&pb); |
|
| 167 |
+ alen = len - avio_tell(&pb); |
|
| 168 | 168 |
if (alen <= 0) |
| 169 | 169 |
return AVERROR_INVALIDDATA; |
| 170 | 170 |
|
| ... | ... |
@@ -182,7 +182,7 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt, |
| 182 | 182 |
} |
| 183 | 183 |
if (!qt->pkt.data) |
| 184 | 184 |
return AVERROR(ENOMEM); |
| 185 |
- memcpy(qt->pkt.data + qt->pkt.size, buf + url_ftell(&pb), alen); |
|
| 185 |
+ memcpy(qt->pkt.data + qt->pkt.size, buf + avio_tell(&pb), alen); |
|
| 186 | 186 |
qt->pkt.size += alen; |
| 187 | 187 |
if (has_marker_bit) {
|
| 188 | 188 |
*pkt = qt->pkt; |
| ... | ... |
@@ -203,7 +203,7 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt, |
| 203 | 203 |
qt->remaining = (alen / qt->bytes_per_frame) - 1; |
| 204 | 204 |
if (av_new_packet(pkt, qt->bytes_per_frame)) |
| 205 | 205 |
return AVERROR(ENOMEM); |
| 206 |
- memcpy(pkt->data, buf + url_ftell(&pb), qt->bytes_per_frame); |
|
| 206 |
+ memcpy(pkt->data, buf + avio_tell(&pb), qt->bytes_per_frame); |
|
| 207 | 207 |
pkt->flags = flags & RTP_FLAG_KEY ? AV_PKT_FLAG_KEY : 0; |
| 208 | 208 |
pkt->stream_index = st->index; |
| 209 | 209 |
if (qt->remaining > 0) {
|
| ... | ... |
@@ -215,7 +215,7 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt, |
| 215 | 215 |
} |
| 216 | 216 |
qt->pkt.size = qt->remaining * qt->bytes_per_frame; |
| 217 | 217 |
memcpy(qt->pkt.data, |
| 218 |
- buf + url_ftell(&pb) + qt->bytes_per_frame, |
|
| 218 |
+ buf + avio_tell(&pb) + qt->bytes_per_frame, |
|
| 219 | 219 |
qt->remaining * qt->bytes_per_frame); |
| 220 | 220 |
qt->pkt.flags = pkt->flags; |
| 221 | 221 |
return 1; |
| ... | ... |
@@ -222,7 +222,7 @@ static int film_read_packet(AVFormatContext *s, |
| 222 | 222 |
/* do a special song and dance when loading FILM Cinepak chunks */ |
| 223 | 223 |
if ((sample->stream == film->video_stream_index) && |
| 224 | 224 |
(film->video_type == CODEC_ID_CINEPAK)) {
|
| 225 |
- pkt->pos= url_ftell(pb); |
|
| 225 |
+ pkt->pos= avio_tell(pb); |
|
| 226 | 226 |
if (av_new_packet(pkt, sample->sample_size)) |
| 227 | 227 |
return AVERROR(ENOMEM); |
| 228 | 228 |
avio_read(pb, pkt->data, sample->sample_size); |
| ... | ... |
@@ -240,7 +240,7 @@ static int film_read_packet(AVFormatContext *s, |
| 240 | 240 |
film->stereo_buffer = av_malloc(film->stereo_buffer_size); |
| 241 | 241 |
} |
| 242 | 242 |
|
| 243 |
- pkt->pos= url_ftell(pb); |
|
| 243 |
+ pkt->pos= avio_tell(pb); |
|
| 244 | 244 |
ret = avio_read(pb, film->stereo_buffer, sample->sample_size); |
| 245 | 245 |
if (ret != sample->sample_size) |
| 246 | 246 |
ret = AVERROR(EIO); |
| ... | ... |
@@ -247,7 +247,7 @@ static int vmd_read_packet(AVFormatContext *s, |
| 247 | 247 |
|
| 248 | 248 |
if (av_new_packet(pkt, frame->frame_size + BYTES_PER_FRAME_RECORD)) |
| 249 | 249 |
return AVERROR(ENOMEM); |
| 250 |
- pkt->pos= url_ftell(pb); |
|
| 250 |
+ pkt->pos= avio_tell(pb); |
|
| 251 | 251 |
memcpy(pkt->data, frame->frame_record, BYTES_PER_FRAME_RECORD); |
| 252 | 252 |
if(vmd->is_indeo3) |
| 253 | 253 |
ret = avio_read(pb, pkt->data, frame->frame_size); |
| ... | ... |
@@ -219,7 +219,7 @@ static int smacker_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 219 | 219 |
((int32_t*)st->codec->extradata)[3] = av_le2ne32(smk->type_size); |
| 220 | 220 |
|
| 221 | 221 |
smk->curstream = -1; |
| 222 |
- smk->nextpos = url_ftell(pb); |
|
| 222 |
+ smk->nextpos = avio_tell(pb); |
|
| 223 | 223 |
|
| 224 | 224 |
return 0; |
| 225 | 225 |
} |
| ... | ... |
@@ -244,7 +244,7 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt) |
| 244 | 244 |
frame_size = smk->frm_size[smk->cur_frame] & (~3); |
| 245 | 245 |
flags = smk->frm_flags[smk->cur_frame]; |
| 246 | 246 |
/* handle palette change event */ |
| 247 |
- pos = url_ftell(s->pb); |
|
| 247 |
+ pos = avio_tell(s->pb); |
|
| 248 | 248 |
if(flags & SMACKER_PAL){
|
| 249 | 249 |
int size, sz, t, off, j, pos; |
| 250 | 250 |
uint8_t *pal = smk->pal; |
| ... | ... |
@@ -256,7 +256,7 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt) |
| 256 | 256 |
frame_size -= size; |
| 257 | 257 |
frame_size--; |
| 258 | 258 |
sz = 0; |
| 259 |
- pos = url_ftell(s->pb) + size; |
|
| 259 |
+ pos = avio_tell(s->pb) + size; |
|
| 260 | 260 |
while(sz < 256){
|
| 261 | 261 |
t = avio_r8(s->pb); |
| 262 | 262 |
if(t & 0x80){ /* skip palette entries */
|
| ... | ... |
@@ -313,7 +313,7 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt) |
| 313 | 313 |
pkt->stream_index = smk->videoindex; |
| 314 | 314 |
pkt->size = ret + 769; |
| 315 | 315 |
smk->cur_frame++; |
| 316 |
- smk->nextpos = url_ftell(s->pb); |
|
| 316 |
+ smk->nextpos = avio_tell(s->pb); |
|
| 317 | 317 |
} else {
|
| 318 | 318 |
if (av_new_packet(pkt, smk->buf_sizes[smk->curstream])) |
| 319 | 319 |
return AVERROR(ENOMEM); |
| ... | ... |
@@ -98,7 +98,7 @@ static int sox_write_trailer(AVFormatContext *s) |
| 98 | 98 |
|
| 99 | 99 |
if (!url_is_streamed(s->pb)) {
|
| 100 | 100 |
/* update number of samples */ |
| 101 |
- int64_t file_size = url_ftell(pb); |
|
| 101 |
+ int64_t file_size = avio_tell(pb); |
|
| 102 | 102 |
int64_t num_samples = (file_size - sox->header_size - 4LL) >> 2LL; |
| 103 | 103 |
avio_seek(pb, 8, SEEK_SET); |
| 104 | 104 |
if (enc->codec_id == CODEC_ID_PCM_S32LE) {
|
| ... | ... |
@@ -185,7 +185,7 @@ static int spdif_read_packet(AVFormatContext *s, AVPacket *pkt) |
| 185 | 185 |
if (ret) |
| 186 | 186 |
return ret; |
| 187 | 187 |
|
| 188 |
- pkt->pos = url_ftell(pb) - BURST_HEADER_SIZE; |
|
| 188 |
+ pkt->pos = avio_tell(pb) - BURST_HEADER_SIZE; |
|
| 189 | 189 |
|
| 190 | 190 |
if (avio_read(pb, pkt->data, pkt->size) < pkt->size) {
|
| 191 | 191 |
av_free_packet(pkt); |
| ... | ... |
@@ -75,7 +75,7 @@ static inline int is_eol(char c) |
| 75 | 75 |
static int srt_read_packet(AVFormatContext *s, AVPacket *pkt) |
| 76 | 76 |
{
|
| 77 | 77 |
char buffer[2048], *ptr = buffer, *ptr2; |
| 78 |
- int64_t pos = url_ftell(s->pb); |
|
| 78 |
+ int64_t pos = avio_tell(s->pb); |
|
| 79 | 79 |
int res = AVERROR_EOF; |
| 80 | 80 |
|
| 81 | 81 |
do {
|
| ... | ... |
@@ -29,7 +29,7 @@ static void put_swf_tag(AVFormatContext *s, int tag) |
| 29 | 29 |
SWFContext *swf = s->priv_data; |
| 30 | 30 |
AVIOContext *pb = s->pb; |
| 31 | 31 |
|
| 32 |
- swf->tag_pos = url_ftell(pb); |
|
| 32 |
+ swf->tag_pos = avio_tell(pb); |
|
| 33 | 33 |
swf->tag = tag; |
| 34 | 34 |
/* reserve some room for the tag */ |
| 35 | 35 |
if (tag & TAG_LONG) {
|
| ... | ... |
@@ -47,7 +47,7 @@ static void put_swf_end_tag(AVFormatContext *s) |
| 47 | 47 |
int64_t pos; |
| 48 | 48 |
int tag_len, tag; |
| 49 | 49 |
|
| 50 |
- pos = url_ftell(pb); |
|
| 50 |
+ pos = avio_tell(pb); |
|
| 51 | 51 |
tag_len = pos - swf->tag_pos - 2; |
| 52 | 52 |
tag = swf->tag; |
| 53 | 53 |
avio_seek(pb, swf->tag_pos, SEEK_SET); |
| ... | ... |
@@ -246,7 +246,7 @@ static int swf_write_header(AVFormatContext *s) |
| 246 | 246 |
|
| 247 | 247 |
put_swf_rect(pb, 0, width * 20, 0, height * 20); |
| 248 | 248 |
avio_wl16(pb, (rate * 256) / rate_base); /* frame rate */ |
| 249 |
- swf->duration_pos = url_ftell(pb); |
|
| 249 |
+ swf->duration_pos = avio_tell(pb); |
|
| 250 | 250 |
avio_wl16(pb, (uint16_t)(DUMMY_DURATION * (int64_t)rate / rate_base)); /* frame count */ |
| 251 | 251 |
|
| 252 | 252 |
/* avm2/swf v9 (also v8?) files require a file attribute tag */ |
| ... | ... |
@@ -346,7 +346,7 @@ static int swf_write_video(AVFormatContext *s, |
| 346 | 346 |
/* create a new video object */ |
| 347 | 347 |
put_swf_tag(s, TAG_VIDEOSTREAM); |
| 348 | 348 |
avio_wl16(pb, VIDEO_ID); |
| 349 |
- swf->vframes_pos = url_ftell(pb); |
|
| 349 |
+ swf->vframes_pos = avio_tell(pb); |
|
| 350 | 350 |
avio_wl16(pb, 15000); /* hard flash player limit */ |
| 351 | 351 |
avio_wl16(pb, enc->width); |
| 352 | 352 |
avio_wl16(pb, enc->height); |
| ... | ... |
@@ -493,7 +493,7 @@ static int swf_write_trailer(AVFormatContext *s) |
| 493 | 493 |
|
| 494 | 494 |
/* patch file size and number of frames if not streamed */ |
| 495 | 495 |
if (!url_is_streamed(s->pb) && video_enc) {
|
| 496 |
- file_size = url_ftell(pb); |
|
| 496 |
+ file_size = avio_tell(pb); |
|
| 497 | 497 |
avio_seek(pb, 4, SEEK_SET); |
| 498 | 498 |
avio_wl32(pb, file_size); |
| 499 | 499 |
avio_seek(pb, swf->duration_pos, SEEK_SET); |
| ... | ... |
@@ -46,7 +46,7 @@ static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 46 | 46 |
if (!av_metadata_get(s->metadata, "", NULL, AV_METADATA_IGNORE_SUFFIX)) |
| 47 | 47 |
ff_id3v1_read(s); |
| 48 | 48 |
|
| 49 |
- start_offset = url_ftell(s->pb); |
|
| 49 |
+ start_offset = avio_tell(s->pb); |
|
| 50 | 50 |
if (avio_rl32(s->pb) != AV_RL32("TTA1"))
|
| 51 | 51 |
return -1; // not tta file |
| 52 | 52 |
|
| ... | ... |
@@ -84,7 +84,7 @@ static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 84 | 84 |
st->start_time = 0; |
| 85 | 85 |
st->duration = datalen; |
| 86 | 86 |
|
| 87 |
- framepos = url_ftell(s->pb) + 4*c->totalframes + 4; |
|
| 87 |
+ framepos = avio_tell(s->pb) + 4*c->totalframes + 4; |
|
| 88 | 88 |
|
| 89 | 89 |
for (i = 0; i < c->totalframes; i++) {
|
| 90 | 90 |
uint32_t size = avio_rl32(s->pb); |
| ... | ... |
@@ -99,7 +99,7 @@ static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 99 | 99 |
st->codec->sample_rate = samplerate; |
| 100 | 100 |
st->codec->bits_per_coded_sample = bps; |
| 101 | 101 |
|
| 102 |
- st->codec->extradata_size = url_ftell(s->pb) - start_offset; |
|
| 102 |
+ st->codec->extradata_size = avio_tell(s->pb) - start_offset; |
|
| 103 | 103 |
if(st->codec->extradata_size+FF_INPUT_BUFFER_PADDING_SIZE <= (unsigned)st->codec->extradata_size){
|
| 104 | 104 |
//this check is redundant as avio_read should fail |
| 105 | 105 |
av_log(s, AV_LOG_ERROR, "extradata_size too large\n"); |
| ... | ... |
@@ -112,7 +112,7 @@ static int read_packet(AVFormatContext *avctx, AVPacket *pkt) |
| 112 | 112 |
n = s->chars_per_frame; |
| 113 | 113 |
if (s->fsize) {
|
| 114 | 114 |
// ignore metadata buffer |
| 115 |
- uint64_t p = url_ftell(avctx->pb); |
|
| 115 |
+ uint64_t p = avio_tell(avctx->pb); |
|
| 116 | 116 |
if (p + s->chars_per_frame > s->fsize) |
| 117 | 117 |
n = s->fsize - p; |
| 118 | 118 |
} |
| ... | ... |
@@ -330,7 +330,7 @@ int av_get_packet(AVIOContext *s, AVPacket *pkt, int size) |
| 330 | 330 |
if(ret<0) |
| 331 | 331 |
return ret; |
| 332 | 332 |
|
| 333 |
- pkt->pos= url_ftell(s); |
|
| 333 |
+ pkt->pos= avio_tell(s); |
|
| 334 | 334 |
|
| 335 | 335 |
ret= avio_read(s, pkt->data, size); |
| 336 | 336 |
if(ret<=0) |
| ... | ... |
@@ -490,7 +490,7 @@ int av_open_input_stream(AVFormatContext **ic_ptr, |
| 490 | 490 |
} |
| 491 | 491 |
|
| 492 | 492 |
if (pb && !ic->data_offset) |
| 493 |
- ic->data_offset = url_ftell(ic->pb); |
|
| 493 |
+ ic->data_offset = avio_tell(ic->pb); |
|
| 494 | 494 |
|
| 495 | 495 |
#if FF_API_OLD_METADATA |
| 496 | 496 |
ff_metadata_demux_compat(ic); |
| ... | ... |
@@ -2212,7 +2212,7 @@ int av_find_stream_info(AVFormatContext *ic) |
| 2212 | 2212 |
int i, count, ret, read_size, j; |
| 2213 | 2213 |
AVStream *st; |
| 2214 | 2214 |
AVPacket pkt1, *pkt; |
| 2215 |
- int64_t old_offset = url_ftell(ic->pb); |
|
| 2215 |
+ int64_t old_offset = avio_tell(ic->pb); |
|
| 2216 | 2216 |
|
| 2217 | 2217 |
for(i=0;i<ic->nb_streams;i++) {
|
| 2218 | 2218 |
AVCodec *codec; |
| ... | ... |
@@ -80,7 +80,7 @@ voc_get_packet(AVFormatContext *s, AVPacket *pkt, AVStream *st, int max_size) |
| 80 | 80 |
if (!voc->remaining_size) {
|
| 81 | 81 |
if (url_is_streamed(s->pb)) |
| 82 | 82 |
return AVERROR(EIO); |
| 83 |
- voc->remaining_size = url_fsize(pb) - url_ftell(pb); |
|
| 83 |
+ voc->remaining_size = url_fsize(pb) - avio_tell(pb); |
|
| 84 | 84 |
} |
| 85 | 85 |
max_size -= 4; |
| 86 | 86 |
|
| ... | ... |
@@ -200,7 +200,7 @@ static int vqf_read_packet(AVFormatContext *s, AVPacket *pkt) |
| 200 | 200 |
int ret; |
| 201 | 201 |
int size = (c->frame_bit_len - c->remaining_bits + 7)>>3; |
| 202 | 202 |
|
| 203 |
- pkt->pos = url_ftell(s->pb); |
|
| 203 |
+ pkt->pos = avio_tell(s->pb); |
|
| 204 | 204 |
pkt->stream_index = 0; |
| 205 | 205 |
|
| 206 | 206 |
if (av_new_packet(pkt, size+2) < 0) |
| ... | ... |
@@ -102,7 +102,7 @@ static int wav_write_trailer(AVFormatContext *s) |
| 102 | 102 |
ff_end_tag(pb, wav->data); |
| 103 | 103 |
|
| 104 | 104 |
/* update file size */ |
| 105 |
- file_size = url_ftell(pb); |
|
| 105 |
+ file_size = avio_tell(pb); |
|
| 106 | 106 |
avio_seek(pb, 4, SEEK_SET); |
| 107 | 107 |
avio_wl32(pb, (uint32_t)(file_size - 8)); |
| 108 | 108 |
avio_seek(pb, file_size, SEEK_SET); |
| ... | ... |
@@ -252,7 +252,7 @@ static int wav_read_header(AVFormatContext *s, |
| 252 | 252 |
if (!size) {
|
| 253 | 253 |
wav->data_end = INT64_MAX; |
| 254 | 254 |
} else |
| 255 |
- wav->data_end= url_ftell(pb) + size; |
|
| 255 |
+ wav->data_end= avio_tell(pb) + size; |
|
| 256 | 256 |
|
| 257 | 257 |
if (!sample_count && st->codec->channels && av_get_bits_per_sample(st->codec->codec_id)) |
| 258 | 258 |
sample_count = (size<<3) / (st->codec->channels * (uint64_t)av_get_bits_per_sample(st->codec->codec_id)); |
| ... | ... |
@@ -296,7 +296,7 @@ static int wav_read_packet(AVFormatContext *s, |
| 296 | 296 |
|
| 297 | 297 |
st = s->streams[0]; |
| 298 | 298 |
|
| 299 |
- left = wav->data_end - url_ftell(s->pb); |
|
| 299 |
+ left = wav->data_end - avio_tell(s->pb); |
|
| 300 | 300 |
if (left <= 0){
|
| 301 | 301 |
if (CONFIG_W64_DEMUXER && wav->w64) |
| 302 | 302 |
left = find_guid(s->pb, guid_data) - 24; |
| ... | ... |
@@ -304,7 +304,7 @@ static int wav_read_packet(AVFormatContext *s, |
| 304 | 304 |
left = find_tag(s->pb, MKTAG('d', 'a', 't', 'a'));
|
| 305 | 305 |
if (left < 0) |
| 306 | 306 |
return AVERROR_EOF; |
| 307 |
- wav->data_end= url_ftell(s->pb) + left; |
|
| 307 |
+ wav->data_end= avio_tell(s->pb) + left; |
|
| 308 | 308 |
} |
| 309 | 309 |
|
| 310 | 310 |
size = MAX_SIZE; |
| ... | ... |
@@ -421,7 +421,7 @@ static int w64_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 421 | 421 |
av_log(s, AV_LOG_ERROR, "could not find data guid\n"); |
| 422 | 422 |
return -1; |
| 423 | 423 |
} |
| 424 |
- wav->data_end = url_ftell(pb) + size - 24; |
|
| 424 |
+ wav->data_end = avio_tell(pb) + size - 24; |
|
| 425 | 425 |
wav->w64 = 1; |
| 426 | 426 |
|
| 427 | 427 |
return 0; |
| ... | ... |
@@ -468,7 +468,7 @@ static void get_attachment(AVFormatContext *s, AVIOContext *pb, int length) |
| 468 | 468 |
char description[1024]; |
| 469 | 469 |
unsigned int filesize; |
| 470 | 470 |
AVStream *st; |
| 471 |
- int64_t pos = url_ftell(pb); |
|
| 471 |
+ int64_t pos = avio_tell(pb); |
|
| 472 | 472 |
|
| 473 | 473 |
avio_get_str16le(pb, INT_MAX, mime, sizeof(mime)); |
| 474 | 474 |
if (strcmp(mime, "image/jpeg")) |
| ... | ... |
@@ -980,7 +980,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 980 | 980 |
return ret; |
| 981 | 981 |
avio_seek(wtv->pb, -32, SEEK_CUR); |
| 982 | 982 |
|
| 983 |
- timeline_pos = url_ftell(s->pb); // save before opening another file |
|
| 983 |
+ timeline_pos = avio_tell(s->pb); // save before opening another file |
|
| 984 | 984 |
|
| 985 | 985 |
/* read metadata */ |
| 986 | 986 |
pb = wtvfile_open(s, root, root_size, table_0_entries_legacy_attrib_le16); |
| ... | ... |
@@ -84,7 +84,7 @@ static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb, int appen |
| 84 | 84 |
int rate, bpp, chan; |
| 85 | 85 |
uint32_t chmask; |
| 86 | 86 |
|
| 87 |
- wc->pos = url_ftell(pb); |
|
| 87 |
+ wc->pos = avio_tell(pb); |
|
| 88 | 88 |
if(!append){
|
| 89 | 89 |
tag = avio_rl32(pb); |
| 90 | 90 |
if (tag != MKTAG('w', 'v', 'p', 'k'))
|
| ... | ... |
@@ -120,12 +120,12 @@ static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb, int appen |
| 120 | 120 |
chmask = wc->chmask; |
| 121 | 121 |
} |
| 122 | 122 |
if((rate == -1 || !chan) && !wc->block_parsed){
|
| 123 |
- int64_t block_end = url_ftell(pb) + wc->blksize - 24; |
|
| 123 |
+ int64_t block_end = avio_tell(pb) + wc->blksize - 24; |
|
| 124 | 124 |
if(url_is_streamed(pb)){
|
| 125 | 125 |
av_log(ctx, AV_LOG_ERROR, "Cannot determine additional parameters\n"); |
| 126 | 126 |
return -1; |
| 127 | 127 |
} |
| 128 |
- while(url_ftell(pb) < block_end){
|
|
| 128 |
+ while(avio_tell(pb) < block_end){
|
|
| 129 | 129 |
int id, size; |
| 130 | 130 |
id = avio_r8(pb); |
| 131 | 131 |
size = (id & 0x80) ? avio_rl24(pb) : avio_r8(pb); |
| ... | ... |
@@ -224,7 +224,7 @@ static int wv_read_header(AVFormatContext *s, |
| 224 | 224 |
st->duration = wc->samples; |
| 225 | 225 |
|
| 226 | 226 |
if(!url_is_streamed(s->pb)) {
|
| 227 |
- int64_t cur = url_ftell(s->pb); |
|
| 227 |
+ int64_t cur = avio_tell(s->pb); |
|
| 228 | 228 |
ff_ape_parse_tag(s); |
| 229 | 229 |
if(!av_metadata_get(s->metadata, "", NULL, AV_METADATA_IGNORE_SUFFIX)) |
| 230 | 230 |
ff_id3v1_read(s); |
| ... | ... |
@@ -327,7 +327,7 @@ static int wv_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, |
| 327 | 327 |
if(timestamp < 0 || timestamp >= s->duration) |
| 328 | 328 |
return -1; |
| 329 | 329 |
|
| 330 |
- pos = url_ftell(s->pb); |
|
| 330 |
+ pos = avio_tell(s->pb); |
|
| 331 | 331 |
do{
|
| 332 | 332 |
ret = av_read_frame(s, pkt); |
| 333 | 333 |
if (ret < 0){
|
| ... | ... |
@@ -136,7 +136,7 @@ static int yop_read_packet(AVFormatContext *s, AVPacket *pkt) |
| 136 | 136 |
if (ret < 0) |
| 137 | 137 |
return ret; |
| 138 | 138 |
|
| 139 |
- yop->video_packet.pos = url_ftell(pb); |
|
| 139 |
+ yop->video_packet.pos = avio_tell(pb); |
|
| 140 | 140 |
|
| 141 | 141 |
ret = avio_read(pb, yop->video_packet.data, yop->palette_size); |
| 142 | 142 |
if (ret < 0) {
|