mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
avio: add avio_tell macro as a replacement for url_ftell
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
This commit is contained in:
parent
e16ead0716
commit
a2704c9712
4
ffmpeg.c
4
ffmpeg.c
@ -1352,7 +1352,7 @@ static void print_report(AVFormatContext **output_files,
|
||||
|
||||
total_size = url_fsize(oc->pb);
|
||||
if(total_size<0) // FIXME improve url_fsize() so it works with non seekable output too
|
||||
total_size= url_ftell(oc->pb);
|
||||
total_size= avio_tell(oc->pb);
|
||||
|
||||
buf[0] = '\0';
|
||||
ti1 = 1e10;
|
||||
@ -2555,7 +2555,7 @@ static int transcode(AVFormatContext **output_files,
|
||||
}
|
||||
|
||||
/* finish if limit size exhausted */
|
||||
if (limit_filesize != 0 && limit_filesize <= url_ftell(output_files[0]->pb))
|
||||
if (limit_filesize != 0 && limit_filesize <= avio_tell(output_files[0]->pb))
|
||||
break;
|
||||
|
||||
/* read a frame from it and output it in the fifo */
|
||||
|
2
ffplay.c
2
ffplay.c
@ -2805,7 +2805,7 @@ static void event_loop(void)
|
||||
}else if(cur_stream->audio_stream >= 0 && cur_stream->audio_pkt.pos>=0){
|
||||
pos= cur_stream->audio_pkt.pos;
|
||||
}else
|
||||
pos = url_ftell(cur_stream->ic->pb);
|
||||
pos = avio_tell(cur_stream->ic->pb);
|
||||
if (cur_stream->ic->bit_rate)
|
||||
incr *= cur_stream->ic->bit_rate / 8.0;
|
||||
else
|
||||
|
@ -283,7 +283,7 @@ static int fourxm_read_packet(AVFormatContext *s,
|
||||
return AVERROR(EIO);
|
||||
pkt->stream_index = fourxm->video_stream_index;
|
||||
pkt->pts = fourxm->video_pts;
|
||||
pkt->pos = url_ftell(s->pb);
|
||||
pkt->pos = avio_tell(s->pb);
|
||||
memcpy(pkt->data, header, 8);
|
||||
ret = avio_read(s->pb, &pkt->data[8], size);
|
||||
|
||||
|
@ -232,10 +232,10 @@ static int aiff_read_header(AVFormatContext *s,
|
||||
get_meta(s, "comment" , size);
|
||||
break;
|
||||
case MKTAG('S', 'S', 'N', 'D'): /* Sampled sound chunk */
|
||||
aiff->data_end = url_ftell(pb) + size;
|
||||
aiff->data_end = avio_tell(pb) + size;
|
||||
offset = avio_rb32(pb); /* Offset of sound data */
|
||||
avio_rb32(pb); /* BlockSize... don't care */
|
||||
offset += url_ftell(pb); /* Compute absolute data offset */
|
||||
offset += avio_tell(pb); /* Compute absolute data offset */
|
||||
if (st->codec->block_align) /* Assume COMM already parsed */
|
||||
goto got_sound;
|
||||
if (url_is_streamed(pb)) {
|
||||
@ -292,7 +292,7 @@ static int aiff_read_packet(AVFormatContext *s,
|
||||
int res, size;
|
||||
|
||||
/* calculate size of remaining data */
|
||||
max_size = aiff->data_end - url_ftell(s->pb);
|
||||
max_size = aiff->data_end - avio_tell(s->pb);
|
||||
if (max_size <= 0)
|
||||
return AVERROR_EOF;
|
||||
|
||||
|
@ -45,7 +45,7 @@ static int aiff_write_header(AVFormatContext *s)
|
||||
|
||||
/* FORM AIFF header */
|
||||
ffio_wfourcc(pb, "FORM");
|
||||
aiff->form = url_ftell(pb);
|
||||
aiff->form = avio_tell(pb);
|
||||
avio_wb32(pb, 0); /* file length */
|
||||
ffio_wfourcc(pb, aifc ? "AIFC" : "AIFF");
|
||||
|
||||
@ -66,7 +66,7 @@ static int aiff_write_header(AVFormatContext *s)
|
||||
avio_wb32(pb, aifc ? 24 : 18); /* size */
|
||||
avio_wb16(pb, enc->channels); /* Number of channels */
|
||||
|
||||
aiff->frames = url_ftell(pb);
|
||||
aiff->frames = avio_tell(pb);
|
||||
avio_wb32(pb, 0); /* Number of frames */
|
||||
|
||||
if (!enc->bits_per_coded_sample)
|
||||
@ -90,7 +90,7 @@ static int aiff_write_header(AVFormatContext *s)
|
||||
|
||||
/* Sound data chunk */
|
||||
ffio_wfourcc(pb, "SSND");
|
||||
aiff->ssnd = url_ftell(pb); /* Sound chunk size */
|
||||
aiff->ssnd = avio_tell(pb); /* Sound chunk size */
|
||||
avio_wb32(pb, 0); /* Sound samples data size */
|
||||
avio_wb32(pb, 0); /* Data offset */
|
||||
avio_wb32(pb, 0); /* Block-size (block align) */
|
||||
@ -118,7 +118,7 @@ static int aiff_write_trailer(AVFormatContext *s)
|
||||
|
||||
/* Chunks sizes must be even */
|
||||
int64_t file_size, end_size;
|
||||
end_size = file_size = url_ftell(pb);
|
||||
end_size = file_size = avio_tell(pb);
|
||||
if (file_size & 1) {
|
||||
avio_w8(pb, 0);
|
||||
end_size++;
|
||||
|
@ -154,7 +154,7 @@ static int amr_read_packet(AVFormatContext *s,
|
||||
}
|
||||
|
||||
pkt->stream_index = 0;
|
||||
pkt->pos= url_ftell(s->pb);
|
||||
pkt->pos= avio_tell(s->pb);
|
||||
pkt->data[0]=toc;
|
||||
pkt->duration= enc->codec_id == CODEC_ID_AMR_NB ? 160 : 320;
|
||||
read = avio_read(s->pb, pkt->data+1, size-1);
|
||||
|
@ -208,7 +208,7 @@ repeat:
|
||||
}
|
||||
|
||||
/* fetch record size */
|
||||
tmp = url_ftell(pb);
|
||||
tmp = avio_tell(pb);
|
||||
avio_seek(pb, anm->page_table_offset + MAX_PAGES*6 + (anm->page<<16) +
|
||||
8 + anm->record * 2, SEEK_SET);
|
||||
record_size = avio_rl16(pb);
|
||||
|
@ -160,7 +160,7 @@ static int get_value(AVIOContext *pb, int type){
|
||||
static void get_tag(AVFormatContext *s, const char *key, int type, int len)
|
||||
{
|
||||
char *value;
|
||||
int64_t off = url_ftell(s->pb);
|
||||
int64_t off = avio_tell(s->pb);
|
||||
|
||||
if ((unsigned)len >= (UINT_MAX - 1)/2)
|
||||
return;
|
||||
@ -226,7 +226,7 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size)
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
pos1 = url_ftell(pb);
|
||||
pos1 = avio_tell(pb);
|
||||
|
||||
st = av_new_stream(s, 0);
|
||||
if (!st)
|
||||
@ -301,7 +301,7 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size)
|
||||
st->need_parsing = AVSTREAM_PARSE_FULL;
|
||||
}
|
||||
/* We have to init the frame size at some point .... */
|
||||
pos2 = url_ftell(pb);
|
||||
pos2 = avio_tell(pb);
|
||||
if (size >= (pos2 + 8 - pos1 + 24)) {
|
||||
asf_st->ds_span = avio_r8(pb);
|
||||
asf_st->ds_packet_size = avio_rl16(pb);
|
||||
@ -338,7 +338,7 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size)
|
||||
break;
|
||||
}
|
||||
} else if (type == AVMEDIA_TYPE_VIDEO &&
|
||||
size - (url_ftell(pb) - pos1 + 24) >= 51) {
|
||||
size - (avio_tell(pb) - pos1 + 24) >= 51) {
|
||||
avio_rl32(pb);
|
||||
avio_rl32(pb);
|
||||
avio_r8(pb);
|
||||
@ -387,7 +387,7 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size)
|
||||
if(st->codec->codec_id == CODEC_ID_H264)
|
||||
st->need_parsing = AVSTREAM_PARSE_FULL_ONCE;
|
||||
}
|
||||
pos2 = url_ftell(pb);
|
||||
pos2 = avio_tell(pb);
|
||||
avio_seek(pb, size - (pos2 - pos1 + 24), SEEK_CUR);
|
||||
|
||||
return 0;
|
||||
@ -595,14 +595,14 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
|
||||
avio_r8(pb);
|
||||
memset(&asf->asfid2avid, -1, sizeof(asf->asfid2avid));
|
||||
for(;;) {
|
||||
uint64_t gpos= url_ftell(pb);
|
||||
uint64_t gpos= avio_tell(pb);
|
||||
ff_get_guid(pb, &g);
|
||||
gsize = avio_rl64(pb);
|
||||
av_dlog(s, "%08"PRIx64": ", gpos);
|
||||
print_guid(&g);
|
||||
av_dlog(s, " size=0x%"PRIx64"\n", gsize);
|
||||
if (!ff_guidcmp(&g, &ff_asf_data_header)) {
|
||||
asf->data_object_offset = url_ftell(pb);
|
||||
asf->data_object_offset = avio_tell(pb);
|
||||
// if not streaming, gsize is not unlimited (how?), and there is enough space in the file..
|
||||
if (!(asf->hdr.flags & 0x01) && gsize >= 100) {
|
||||
asf->data_object_size = gsize - 24;
|
||||
@ -652,8 +652,8 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
|
||||
}
|
||||
}
|
||||
}
|
||||
if(url_ftell(pb) != gpos + gsize)
|
||||
av_log(s, AV_LOG_DEBUG, "gpos mismatch our pos=%"PRIu64", end=%"PRIu64"\n", url_ftell(pb)-gpos, gsize);
|
||||
if(avio_tell(pb) != gpos + gsize)
|
||||
av_log(s, AV_LOG_DEBUG, "gpos mismatch our pos=%"PRIu64", end=%"PRIu64"\n", avio_tell(pb)-gpos, gsize);
|
||||
avio_seek(pb, gpos + gsize, SEEK_SET);
|
||||
}
|
||||
ff_get_guid(pb, &g);
|
||||
@ -662,7 +662,7 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
|
||||
avio_r8(pb);
|
||||
if (url_feof(pb))
|
||||
return -1;
|
||||
asf->data_offset = url_ftell(pb);
|
||||
asf->data_offset = avio_tell(pb);
|
||||
asf->packet_size_left = 0;
|
||||
|
||||
|
||||
@ -726,7 +726,7 @@ static int ff_asf_get_packet(AVFormatContext *s, AVIOContext *pb)
|
||||
// if we do not know packet size, allow skipping up to 32 kB
|
||||
off= 32768;
|
||||
if (s->packet_size > 0)
|
||||
off= (url_ftell(pb) - s->data_offset) % s->packet_size + 3;
|
||||
off= (avio_tell(pb) - s->data_offset) % s->packet_size + 3;
|
||||
|
||||
c=d=e=-1;
|
||||
while(off-- > 0){
|
||||
@ -746,7 +746,7 @@ static int ff_asf_get_packet(AVFormatContext *s, AVIOContext *pb)
|
||||
if (url_ferror(pb) == AVERROR(EAGAIN))
|
||||
return AVERROR(EAGAIN);
|
||||
if (!url_feof(pb))
|
||||
av_log(s, AV_LOG_ERROR, "ff asf bad header %x at:%"PRId64"\n", c, url_ftell(pb));
|
||||
av_log(s, AV_LOG_ERROR, "ff asf bad header %x at:%"PRId64"\n", c, avio_tell(pb));
|
||||
}
|
||||
if ((c & 0x8f) == 0x82) {
|
||||
if (d || e) {
|
||||
@ -770,11 +770,11 @@ static int ff_asf_get_packet(AVFormatContext *s, AVIOContext *pb)
|
||||
|
||||
//the following checks prevent overflows and infinite loops
|
||||
if(!packet_length || packet_length >= (1U<<29)){
|
||||
av_log(s, AV_LOG_ERROR, "invalid packet_length %d at:%"PRId64"\n", packet_length, url_ftell(pb));
|
||||
av_log(s, AV_LOG_ERROR, "invalid packet_length %d at:%"PRId64"\n", packet_length, avio_tell(pb));
|
||||
return -1;
|
||||
}
|
||||
if(padsize >= packet_length){
|
||||
av_log(s, AV_LOG_ERROR, "invalid padsize %d at:%"PRId64"\n", padsize, url_ftell(pb));
|
||||
av_log(s, AV_LOG_ERROR, "invalid padsize %d at:%"PRId64"\n", padsize, avio_tell(pb));
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -892,12 +892,12 @@ static int ff_asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pk
|
||||
|| asf->packet_segments < 1) {
|
||||
//asf->packet_size_left <= asf->packet_padsize) {
|
||||
int ret = asf->packet_size_left + asf->packet_padsize;
|
||||
//printf("PacketLeftSize:%d Pad:%d Pos:%"PRId64"\n", asf->packet_size_left, asf->packet_padsize, url_ftell(pb));
|
||||
//printf("PacketLeftSize:%d Pad:%d Pos:%"PRId64"\n", asf->packet_size_left, asf->packet_padsize, avio_tell(pb));
|
||||
assert(ret>=0);
|
||||
/* fail safe */
|
||||
avio_seek(pb, ret, SEEK_CUR);
|
||||
|
||||
asf->packet_pos= url_ftell(pb);
|
||||
asf->packet_pos= avio_tell(pb);
|
||||
if (asf->data_object_size != (uint64_t)-1 &&
|
||||
(asf->packet_pos - asf->data_object_offset >= asf->data_object_size))
|
||||
return AVERROR_EOF; /* Do not exceed the size of the data object */
|
||||
@ -1185,7 +1185,7 @@ static void asf_build_simple_index(AVFormatContext *s, int stream_index)
|
||||
{
|
||||
ff_asf_guid g;
|
||||
ASFContext *asf = s->priv_data;
|
||||
int64_t current_pos= url_ftell(s->pb);
|
||||
int64_t current_pos= avio_tell(s->pb);
|
||||
int i;
|
||||
|
||||
avio_seek(s->pb, asf->data_object_offset + asf->data_object_size, SEEK_SET);
|
||||
@ -1268,7 +1268,7 @@ static int asf_read_seek(AVFormatContext *s, int stream_index, int64_t pts, int
|
||||
// avio_seek(s->pb, pos, SEEK_SET);
|
||||
// key_pos = pos;
|
||||
// for(i=0;i<16;i++){
|
||||
// pos = url_ftell(s->pb);
|
||||
// pos = avio_tell(s->pb);
|
||||
// if (av_read_frame(s, &pkt) < 0){
|
||||
// av_log(s, AV_LOG_INFO, "seek failed\n");
|
||||
// return -1;
|
||||
|
@ -248,7 +248,7 @@ static int64_t put_header(AVIOContext *pb, const ff_asf_guid *g)
|
||||
{
|
||||
int64_t pos;
|
||||
|
||||
pos = url_ftell(pb);
|
||||
pos = avio_tell(pb);
|
||||
put_guid(pb, g);
|
||||
avio_wl64(pb, 24);
|
||||
return pos;
|
||||
@ -259,7 +259,7 @@ static void end_header(AVIOContext *pb, int64_t pos)
|
||||
{
|
||||
int64_t pos1;
|
||||
|
||||
pos1 = url_ftell(pb);
|
||||
pos1 = avio_tell(pb);
|
||||
avio_seek(pb, pos + 16, SEEK_SET);
|
||||
avio_wl64(pb, pos1 - pos);
|
||||
avio_seek(pb, pos1, SEEK_SET);
|
||||
@ -337,7 +337,7 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data
|
||||
avio_w8(pb, 2); /* ??? */
|
||||
|
||||
/* file header */
|
||||
header_offset = url_ftell(pb);
|
||||
header_offset = avio_tell(pb);
|
||||
hpos = put_header(pb, &ff_asf_file_header);
|
||||
put_guid(pb, &ff_asf_my_guid);
|
||||
avio_wl64(pb, file_size);
|
||||
@ -425,7 +425,7 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data
|
||||
put_guid(pb, &ff_asf_video_conceal_none);
|
||||
}
|
||||
avio_wl64(pb, 0); /* ??? */
|
||||
es_pos = url_ftell(pb);
|
||||
es_pos = avio_tell(pb);
|
||||
avio_wl32(pb, extra_size); /* wav header len */
|
||||
avio_wl32(pb, extra_size2); /* additional data len */
|
||||
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
|
||||
if (wavsize < 0)
|
||||
return -1;
|
||||
if (wavsize != extra_size) {
|
||||
cur_pos = url_ftell(pb);
|
||||
cur_pos = avio_tell(pb);
|
||||
avio_seek(pb, es_pos, SEEK_SET);
|
||||
avio_wl32(pb, wavsize); /* wav header len */
|
||||
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
|
||||
|
||||
/* patch the header size fields */
|
||||
|
||||
cur_pos = url_ftell(pb);
|
||||
cur_pos = avio_tell(pb);
|
||||
header_size = cur_pos - header_offset;
|
||||
if (asf->is_streamed) {
|
||||
header_size += 8 + 30 + 50;
|
||||
@ -605,7 +605,7 @@ static int put_payload_parsing_info(
|
||||
ASFContext *asf = s->priv_data;
|
||||
AVIOContext *pb = s->pb;
|
||||
int ppi_size, i;
|
||||
int64_t start= url_ftell(pb);
|
||||
int64_t start= avio_tell(pb);
|
||||
|
||||
int iLengthTypeFlags = ASF_PPI_LENGTH_TYPE_FLAGS;
|
||||
|
||||
@ -642,7 +642,7 @@ static int put_payload_parsing_info(
|
||||
if (asf->multi_payloads_present)
|
||||
avio_w8(pb, nb_payloads | ASF_PAYLOAD_FLAGS);
|
||||
|
||||
ppi_size = url_ftell(pb) - start;
|
||||
ppi_size = avio_tell(pb) - start;
|
||||
|
||||
return ppi_size;
|
||||
}
|
||||
@ -860,7 +860,7 @@ static int asf_write_trailer(AVFormatContext *s)
|
||||
flush_packet(s);
|
||||
|
||||
/* write index */
|
||||
data_size = url_ftell(s->pb);
|
||||
data_size = avio_tell(s->pb);
|
||||
if ((!asf->is_streamed) && (asf->nb_index_count != 0)) {
|
||||
asf_write_index(s, asf->index_ptr, asf->maximum_packet, asf->nb_index_count);
|
||||
}
|
||||
@ -870,7 +870,7 @@ static int asf_write_trailer(AVFormatContext *s)
|
||||
put_chunk(s, 0x4524, 0, 0); /* end of stream */
|
||||
} else {
|
||||
/* rewrite an updated header */
|
||||
file_size = url_ftell(s->pb);
|
||||
file_size = avio_tell(s->pb);
|
||||
avio_seek(s->pb, 0, SEEK_SET);
|
||||
asf_write_header1(s, file_size, data_size - asf->data_offset);
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ static int au_write_trailer(AVFormatContext *s)
|
||||
if (!url_is_streamed(s->pb)) {
|
||||
|
||||
/* update file size */
|
||||
file_size = url_ftell(pb);
|
||||
file_size = avio_tell(pb);
|
||||
avio_seek(pb, 8, SEEK_SET);
|
||||
avio_wb32(pb, (uint32_t)(file_size - 24));
|
||||
avio_seek(pb, file_size, SEEK_SET);
|
||||
|
@ -109,7 +109,7 @@ static int get_riff(AVFormatContext *s, AVIOContext *pb)
|
||||
/* check RIFF header */
|
||||
avio_read(pb, header, 4);
|
||||
avi->riff_end = avio_rl32(pb); /* RIFF chunk size */
|
||||
avi->riff_end += url_ftell(pb); /* RIFF chunk end */
|
||||
avi->riff_end += avio_tell(pb); /* RIFF chunk end */
|
||||
avio_read(pb, header+4, 4);
|
||||
|
||||
for(i=0; avi_headers[i][0]; i++)
|
||||
@ -198,7 +198,7 @@ static int read_braindead_odml_indx(AVFormatContext *s, int frame_num){
|
||||
if(url_feof(pb))
|
||||
return -1;
|
||||
|
||||
pos = url_ftell(pb);
|
||||
pos = avio_tell(pb);
|
||||
|
||||
if(avi->odml_depth > MAX_ODML_DEPTH){
|
||||
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
|
||||
|
||||
static void avi_read_info(AVFormatContext *s, uint64_t end)
|
||||
{
|
||||
while (url_ftell(s->pb) < end) {
|
||||
while (avio_tell(s->pb) < end) {
|
||||
uint32_t tag = avio_rl32(s->pb);
|
||||
uint32_t size = avio_rl32(s->pb);
|
||||
avi_read_tag(s, NULL, tag, size);
|
||||
@ -298,13 +298,13 @@ static void avi_metadata_creation_time(AVMetadata **metadata, char *date)
|
||||
|
||||
static void avi_read_nikon(AVFormatContext *s, uint64_t end)
|
||||
{
|
||||
while (url_ftell(s->pb) < end) {
|
||||
while (avio_tell(s->pb) < end) {
|
||||
uint32_t tag = avio_rl32(s->pb);
|
||||
uint32_t size = avio_rl32(s->pb);
|
||||
switch (tag) {
|
||||
case MKTAG('n', 'c', 't', 'g'): { /* Nikon Tags */
|
||||
uint64_t tag_end = url_ftell(s->pb) + size;
|
||||
while (url_ftell(s->pb) < tag_end) {
|
||||
uint64_t tag_end = avio_tell(s->pb) + size;
|
||||
while (avio_tell(s->pb) < tag_end) {
|
||||
uint16_t tag = avio_rl16(s->pb);
|
||||
uint16_t size = avio_rl16(s->pb);
|
||||
const char *name = NULL;
|
||||
@ -369,14 +369,14 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
|
||||
|
||||
switch(tag) {
|
||||
case MKTAG('L', 'I', 'S', 'T'):
|
||||
list_end = url_ftell(pb) + size;
|
||||
list_end = avio_tell(pb) + size;
|
||||
/* Ignored, except at start of video packets. */
|
||||
tag1 = avio_rl32(pb);
|
||||
|
||||
print_tag("list", tag1, 0);
|
||||
|
||||
if (tag1 == MKTAG('m', 'o', 'v', 'i')) {
|
||||
avi->movi_list = url_ftell(pb) - 4;
|
||||
avi->movi_list = avio_tell(pb) - 4;
|
||||
if(size) avi->movi_end = avi->movi_list + size + (size & 1);
|
||||
else avi->movi_end = url_fsize(pb);
|
||||
av_dlog(NULL, "movi end=%"PRIx64"\n", avi->movi_end);
|
||||
@ -549,7 +549,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
|
||||
if (stream_index >= (unsigned)s->nb_streams || avi->dv_demux) {
|
||||
avio_seek(pb, size, SEEK_CUR);
|
||||
} else {
|
||||
uint64_t cur_pos = url_ftell(pb);
|
||||
uint64_t cur_pos = avio_tell(pb);
|
||||
if (cur_pos < list_end)
|
||||
size = FFMIN(size, list_end - cur_pos);
|
||||
st = s->streams[stream_index];
|
||||
@ -664,7 +664,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
|
||||
}
|
||||
break;
|
||||
case MKTAG('i', 'n', 'd', 'x'):
|
||||
i= url_ftell(pb);
|
||||
i= avio_tell(pb);
|
||||
if(!url_is_streamed(pb) && !(s->flags & AVFMT_FLAG_IGNIDX)){
|
||||
read_braindead_odml_indx(s, 0);
|
||||
}
|
||||
@ -704,7 +704,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
|
||||
if(size > 1000000){
|
||||
av_log(s, AV_LOG_ERROR, "Something went wrong during header parsing, "
|
||||
"I will ignore it and try to continue anyway.\n");
|
||||
avi->movi_list = url_ftell(pb) - 4;
|
||||
avi->movi_list = avio_tell(pb) - 4;
|
||||
avi->movi_end = url_fsize(pb);
|
||||
goto end_of_header;
|
||||
}
|
||||
@ -923,7 +923,7 @@ resync:
|
||||
|
||||
if(size > ast->remaining)
|
||||
size= ast->remaining;
|
||||
avi->last_pkt_pos= url_ftell(pb);
|
||||
avi->last_pkt_pos= avio_tell(pb);
|
||||
err= av_get_packet(pb, pkt, size);
|
||||
if(err<0)
|
||||
return err;
|
||||
@ -989,7 +989,7 @@ resync:
|
||||
}
|
||||
|
||||
memset(d, -1, sizeof(int)*8);
|
||||
for(i=sync=url_ftell(pb); !url_feof(pb); i++) {
|
||||
for(i=sync=avio_tell(pb); !url_feof(pb); i++) {
|
||||
int j;
|
||||
|
||||
for(j=0; j<7; j++)
|
||||
@ -1092,7 +1092,7 @@ resync:
|
||||
ast->remaining= size;
|
||||
|
||||
if(size || !ast->sample_size){
|
||||
uint64_t pos= url_ftell(pb) - 8;
|
||||
uint64_t pos= avio_tell(pb) - 8;
|
||||
if(!st->index_entries || !st->nb_index_entries || st->index_entries[st->nb_index_entries - 1].pos < pos){
|
||||
av_add_index_entry(st, pos, ast->frame_offset, size, 0, AVINDEX_KEYFRAME);
|
||||
}
|
||||
@ -1162,7 +1162,7 @@ static int guess_ni_flag(AVFormatContext *s){
|
||||
int i;
|
||||
int64_t last_start=0;
|
||||
int64_t first_end= INT64_MAX;
|
||||
int64_t oldpos= url_ftell(s->pb);
|
||||
int64_t oldpos= avio_tell(s->pb);
|
||||
|
||||
for(i=0; i<s->nb_streams; i++){
|
||||
AVStream *st = s->streams[i];
|
||||
@ -1194,7 +1194,7 @@ static int avi_load_index(AVFormatContext *s)
|
||||
AVIContext *avi = s->priv_data;
|
||||
AVIOContext *pb = s->pb;
|
||||
uint32_t tag, size;
|
||||
int64_t pos= url_ftell(pb);
|
||||
int64_t pos= avio_tell(pb);
|
||||
int ret = -1;
|
||||
|
||||
if (avio_seek(pb, avi->movi_end, SEEK_SET) < 0)
|
||||
|
@ -124,7 +124,7 @@ static int avi_write_counters(AVFormatContext* s, int riff_id)
|
||||
int64_t file_size;
|
||||
AVCodecContext* stream;
|
||||
|
||||
file_size = url_ftell(pb);
|
||||
file_size = avio_tell(pb);
|
||||
for(n = 0; n < s->nb_streams; n++) {
|
||||
AVIStream *avist= s->streams[n]->priv_data;
|
||||
|
||||
@ -201,7 +201,7 @@ static int avi_write_header(AVFormatContext *s)
|
||||
avio_wl32(pb, AVIF_TRUSTCKTYPE | AVIF_ISINTERLEAVED); /* flags */
|
||||
else
|
||||
avio_wl32(pb, AVIF_TRUSTCKTYPE | AVIF_HASINDEX | AVIF_ISINTERLEAVED); /* flags */
|
||||
avi->frames_hdr_all = url_ftell(pb); /* remember this offset to fill later */
|
||||
avi->frames_hdr_all = avio_tell(pb); /* remember this offset to fill later */
|
||||
avio_wl32(pb, nb_frames); /* nb frames, filled later */
|
||||
avio_wl32(pb, 0); /* initial frame */
|
||||
avio_wl32(pb, s->nb_streams); /* nb streams */
|
||||
@ -258,7 +258,7 @@ static int avi_write_header(AVFormatContext *s)
|
||||
av_set_pts_info(s->streams[i], 64, au_scale, au_byterate);
|
||||
|
||||
avio_wl32(pb, 0); /* start */
|
||||
avist->frames_hdr_strm = url_ftell(pb); /* remember this offset to fill later */
|
||||
avist->frames_hdr_strm = avio_tell(pb); /* remember this offset to fill later */
|
||||
if (url_is_streamed(pb))
|
||||
avio_wl32(pb, AVI_MAX_RIFF_SIZE); /* FIXME: this may be broken, but who cares */
|
||||
else
|
||||
@ -419,7 +419,7 @@ static int avi_write_ix(AVFormatContext *s)
|
||||
ix_tag[3] = '0' + i;
|
||||
|
||||
/* Writing AVI OpenDML leaf index chunk */
|
||||
ix = url_ftell(pb);
|
||||
ix = avio_tell(pb);
|
||||
ffio_wfourcc(pb, ix_tag); /* ix?? */
|
||||
avio_wl32(pb, avist->indexes.entry * 8 + 24);
|
||||
/* chunk size */
|
||||
@ -439,7 +439,7 @@ static int avi_write_ix(AVFormatContext *s)
|
||||
(ie->flags & 0x10 ? 0 : 0x80000000));
|
||||
}
|
||||
put_flush_packet(pb);
|
||||
pos = url_ftell(pb);
|
||||
pos = avio_tell(pb);
|
||||
|
||||
/* Updating one entry in the AVI OpenDML master index */
|
||||
avio_seek(pb, avist->indexes.indx_start - 8, SEEK_SET);
|
||||
@ -533,7 +533,7 @@ static int avi_write_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
|
||||
// Make sure to put an OpenDML chunk when the file size exceeds the limits
|
||||
if (!url_is_streamed(pb) &&
|
||||
(url_ftell(pb) - avi->riff_start > AVI_MAX_RIFF_SIZE)) {
|
||||
(avio_tell(pb) - avi->riff_start > AVI_MAX_RIFF_SIZE)) {
|
||||
|
||||
avi_write_ix(s);
|
||||
ff_end_tag(pb, avi->movi_list);
|
||||
@ -567,7 +567,7 @@ static int avi_write_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
}
|
||||
|
||||
idx->cluster[cl][id].flags = flags;
|
||||
idx->cluster[cl][id].pos = url_ftell(pb) - avi->movi_list;
|
||||
idx->cluster[cl][id].pos = avio_tell(pb) - avi->movi_list;
|
||||
idx->cluster[cl][id].len = size;
|
||||
idx->entry++;
|
||||
}
|
||||
@ -600,7 +600,7 @@ static int avi_write_trailer(AVFormatContext *s)
|
||||
ff_end_tag(pb, avi->movi_list);
|
||||
ff_end_tag(pb, avi->riff_start);
|
||||
|
||||
file_size = url_ftell(pb);
|
||||
file_size = avio_tell(pb);
|
||||
avio_seek(pb, avi->odml_list - 8, SEEK_SET);
|
||||
ffio_wfourcc(pb, "LIST"); /* Making this AVI OpenDML one */
|
||||
avio_seek(pb, 16, SEEK_CUR);
|
||||
|
@ -422,6 +422,7 @@ attribute_deprecated int url_fopen( AVIOContext **s, const char *url, int flags)
|
||||
attribute_deprecated int url_fclose(AVIOContext *s);
|
||||
attribute_deprecated int64_t url_fseek(AVIOContext *s, int64_t offset, int whence);
|
||||
attribute_deprecated int url_fskip(AVIOContext *s, int64_t offset);
|
||||
attribute_deprecated int64_t url_ftell(AVIOContext *s);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
@ -473,7 +474,7 @@ int64_t avio_seek(AVIOContext *s, int64_t offset, int whence);
|
||||
* ftell() equivalent for AVIOContext.
|
||||
* @return position or AVERROR.
|
||||
*/
|
||||
int64_t url_ftell(AVIOContext *s);
|
||||
#define avio_tell(s) avio_seek((s), 0, SEEK_CUR)
|
||||
|
||||
/**
|
||||
* Get the filesize.
|
||||
|
@ -239,12 +239,12 @@ int url_fskip(AVIOContext *s, int64_t offset)
|
||||
int64_t ret = avio_seek(s, offset, SEEK_CUR);
|
||||
return ret < 0 ? ret : 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
int64_t url_ftell(AVIOContext *s)
|
||||
{
|
||||
return avio_seek(s, 0, SEEK_CUR);
|
||||
}
|
||||
#endif
|
||||
|
||||
int64_t url_fsize(AVIOContext *s)
|
||||
{
|
||||
|
@ -123,9 +123,9 @@ static int avs_read_audio_packet(AVFormatContext * s, AVPacket * pkt)
|
||||
AvsFormat *avs = s->priv_data;
|
||||
int ret, size;
|
||||
|
||||
size = url_ftell(s->pb);
|
||||
size = avio_tell(s->pb);
|
||||
ret = voc_get_packet(s, pkt, avs->st_audio, avs->remaining_audio_size);
|
||||
size = url_ftell(s->pb) - size;
|
||||
size = avio_tell(s->pb) - size;
|
||||
avs->remaining_audio_size -= size;
|
||||
|
||||
if (ret == AVERROR(EIO))
|
||||
|
@ -112,7 +112,7 @@ static int read_frame(BVID_DemuxContext *vid, AVIOContext *pb, AVPacket *pkt,
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
// save the file position for the packet, include block type
|
||||
position = url_ftell(pb) - 1;
|
||||
position = avio_tell(pb) - 1;
|
||||
|
||||
vidbuf_start[vidbuf_nbytes++] = block_type;
|
||||
|
||||
|
@ -106,9 +106,9 @@ static int read_kuki_chunk(AVFormatContext *s, int64_t size)
|
||||
int strt, skip;
|
||||
MOVAtom atom;
|
||||
|
||||
strt = url_ftell(pb);
|
||||
strt = avio_tell(pb);
|
||||
ff_mov_read_esds(s, pb, atom);
|
||||
skip = size - (url_ftell(pb) - strt);
|
||||
skip = size - (avio_tell(pb) - strt);
|
||||
if (skip < 0 || !st->codec->extradata ||
|
||||
st->codec->codec_id != CODEC_ID_AAC) {
|
||||
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)
|
||||
int64_t pos = 0, ccount;
|
||||
int num_packets, i;
|
||||
|
||||
ccount = url_ftell(pb);
|
||||
ccount = avio_tell(pb);
|
||||
|
||||
num_packets = avio_rb64(pb);
|
||||
if (num_packets < 0 || INT32_MAX / sizeof(AVIndexEntry) < num_packets)
|
||||
@ -167,7 +167,7 @@ static int read_pakt_chunk(AVFormatContext *s, int64_t size)
|
||||
st->duration += caf->frames_per_packet ? caf->frames_per_packet : ff_mp4_read_descr_len(pb);
|
||||
}
|
||||
|
||||
if (url_ftell(pb) - ccount != size) {
|
||||
if (avio_tell(pb) - ccount != size) {
|
||||
av_log(s, AV_LOG_ERROR, "error reading packet table\n");
|
||||
return -1;
|
||||
}
|
||||
@ -234,7 +234,7 @@ static int read_header(AVFormatContext *s,
|
||||
switch (tag) {
|
||||
case MKBETAG('d','a','t','a'):
|
||||
avio_seek(pb, 4, SEEK_CUR); /* edit count */
|
||||
caf->data_start = url_ftell(pb);
|
||||
caf->data_start = avio_tell(pb);
|
||||
caf->data_size = size < 0 ? -1 : size - 4;
|
||||
if (caf->data_size > 0 && !url_is_streamed(pb))
|
||||
avio_seek(pb, caf->data_size, SEEK_CUR);
|
||||
@ -312,7 +312,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
|
||||
/* don't read past end of data chunk */
|
||||
if (caf->data_size > 0) {
|
||||
left = (caf->data_start + caf->data_size) - url_ftell(pb);
|
||||
left = (caf->data_start + caf->data_size) - avio_tell(pb);
|
||||
if (left <= 0)
|
||||
return AVERROR(EIO);
|
||||
}
|
||||
|
@ -417,8 +417,8 @@ static int dv_read_header(AVFormatContext *s,
|
||||
return -1;
|
||||
}
|
||||
if (state == 0x003f0700 || state == 0xff3f0700)
|
||||
marker_pos = url_ftell(s->pb);
|
||||
if (state == 0xff3f0701 && url_ftell(s->pb) - marker_pos == 80) {
|
||||
marker_pos = avio_tell(s->pb);
|
||||
if (state == 0xff3f0701 && avio_tell(s->pb) - marker_pos == 80) {
|
||||
avio_seek(s->pb, -163, SEEK_CUR);
|
||||
state = avio_rb32(s->pb);
|
||||
break;
|
||||
|
@ -95,7 +95,7 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap)
|
||||
uint32_t size, fsize;
|
||||
c->has_sound = 1;
|
||||
size = avio_rb32(pb);
|
||||
c->vidpos = url_ftell(pb) + size;
|
||||
c->vidpos = avio_tell(pb) + size;
|
||||
avio_seek(pb, 16, SEEK_CUR);
|
||||
fsize = avio_rl32(pb);
|
||||
|
||||
@ -104,7 +104,7 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap)
|
||||
return -1;
|
||||
ff_get_wav_header(pb, ast->codec, fsize);
|
||||
// find 'data' chunk
|
||||
while(url_ftell(pb) < c->vidpos && !url_feof(pb)){
|
||||
while(avio_tell(pb) < c->vidpos && !url_feof(pb)){
|
||||
tag = avio_rl32(pb);
|
||||
fsize = avio_rl32(pb);
|
||||
if(tag == MKTAG('d', 'a', 't', 'a')) break;
|
||||
@ -114,7 +114,7 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap)
|
||||
if(ast->codec->block_align)
|
||||
c->bpc = ((c->bpc + ast->codec->block_align - 1) / ast->codec->block_align) * ast->codec->block_align;
|
||||
c->bytes_left = fsize;
|
||||
c->wavpos = url_ftell(pb);
|
||||
c->wavpos = avio_tell(pb);
|
||||
avio_seek(pb, c->vidpos, SEEK_SET);
|
||||
}
|
||||
|
||||
@ -133,7 +133,7 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap)
|
||||
st->codec->height >>= 1;
|
||||
}
|
||||
c->readvid = !c->has_sound;
|
||||
c->vidpos = url_ftell(pb);
|
||||
c->vidpos = avio_tell(pb);
|
||||
s->start_time = 0;
|
||||
s->duration = (int64_t)c->frames * AV_TIME_BASE * num / den;
|
||||
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)
|
||||
if(ret != size)
|
||||
return AVERROR(EIO);
|
||||
c->bytes_left -= size;
|
||||
c->wavpos = url_ftell(s->pb);
|
||||
c->wavpos = avio_tell(s->pb);
|
||||
return 0;
|
||||
}
|
||||
avio_seek(s->pb, c->vidpos, SEEK_SET);
|
||||
@ -172,7 +172,7 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
if(pal_size) memcpy(pkt->data, pal, pal_size);
|
||||
memcpy(pkt->data + pal_size, buf, 4);
|
||||
c->frames--;
|
||||
c->vidpos = url_ftell(s->pb);
|
||||
c->vidpos = avio_tell(s->pb);
|
||||
c->readvid = 0;
|
||||
return 0;
|
||||
case MKTAG('C', 'M', 'A', 'P'):
|
||||
@ -198,7 +198,7 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
if(pal_size) memcpy(pkt->data, pal, pal_size);
|
||||
pkt->stream_index = 0;
|
||||
c->frames--;
|
||||
c->vidpos = url_ftell(s->pb);
|
||||
c->vidpos = avio_tell(s->pb);
|
||||
c->readvid = 0;
|
||||
return 0;
|
||||
default:
|
||||
|
@ -293,7 +293,7 @@ static int process_ea_header(AVFormatContext *s) {
|
||||
int i;
|
||||
|
||||
for (i=0; i<5 && (!ea->audio_codec || !ea->video_codec); i++) {
|
||||
unsigned int startpos = url_ftell(pb);
|
||||
unsigned int startpos = avio_tell(pb);
|
||||
int err = 0;
|
||||
|
||||
blockid = avio_rl32(pb);
|
||||
|
@ -65,7 +65,7 @@ static int ffm_is_avail_data(AVFormatContext *s, int size)
|
||||
len = ffm->packet_end - ffm->packet_ptr;
|
||||
if (size <= len)
|
||||
return 1;
|
||||
pos = url_ftell(s->pb);
|
||||
pos = avio_tell(s->pb);
|
||||
if (!ffm->write_index) {
|
||||
if (pos == ffm->file_size)
|
||||
return AVERROR_EOF;
|
||||
@ -117,7 +117,7 @@ static int ffm_read_data(AVFormatContext *s,
|
||||
if (len > size)
|
||||
len = size;
|
||||
if (len == 0) {
|
||||
if (url_ftell(pb) == ffm->file_size)
|
||||
if (avio_tell(pb) == ffm->file_size)
|
||||
avio_seek(pb, ffm->packet_size, SEEK_SET);
|
||||
retry_read:
|
||||
id = avio_rb16(pb); /* PACKET_ID */
|
||||
@ -136,7 +136,7 @@ static int ffm_read_data(AVFormatContext *s,
|
||||
if (ffm->first_packet || (frame_offset & 0x8000)) {
|
||||
if (!frame_offset) {
|
||||
/* This packet has no frame headers in it */
|
||||
if (url_ftell(pb) >= ffm->packet_size * 3) {
|
||||
if (avio_tell(pb) >= ffm->packet_size * 3) {
|
||||
avio_seek(pb, -ffm->packet_size * 2, SEEK_CUR);
|
||||
goto retry_read;
|
||||
}
|
||||
@ -203,7 +203,7 @@ static void adjust_write_index(AVFormatContext *s)
|
||||
//int64_t orig_write_index = ffm->write_index;
|
||||
int64_t pos_min, pos_max;
|
||||
int64_t pts_start;
|
||||
int64_t ptr = url_ftell(pb);
|
||||
int64_t ptr = avio_tell(pb);
|
||||
|
||||
|
||||
pos_min = 0;
|
||||
@ -381,7 +381,7 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap)
|
||||
}
|
||||
|
||||
/* get until end of block reached */
|
||||
while ((url_ftell(pb) % ffm->packet_size) != 0)
|
||||
while ((avio_tell(pb) % ffm->packet_size) != 0)
|
||||
avio_r8(pb);
|
||||
|
||||
/* init packet demux */
|
||||
@ -410,7 +410,7 @@ static int ffm_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
return ret;
|
||||
|
||||
av_dlog(s, "pos=%08"PRIx64" spos=%"PRIx64", write_index=%"PRIx64" size=%"PRIx64"\n",
|
||||
url_ftell(s->pb), s->pb->pos, ffm->write_index, ffm->file_size);
|
||||
avio_tell(s->pb), s->pb->pos, ffm->write_index, ffm->file_size);
|
||||
if (ffm_read_data(s, ffm->header, FRAME_HEADER_SIZE, 1) !=
|
||||
FRAME_HEADER_SIZE)
|
||||
return -1;
|
||||
@ -437,7 +437,7 @@ static int ffm_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
ffm->read_state = READ_HEADER;
|
||||
return -1;
|
||||
}
|
||||
pkt->pos = url_ftell(s->pb);
|
||||
pkt->pos = avio_tell(s->pb);
|
||||
if (ffm->header[1] & FLAG_KEY_FRAME)
|
||||
pkt->flags |= AV_PKT_FLAG_KEY;
|
||||
|
||||
|
@ -32,7 +32,7 @@ static void flush_packet(AVFormatContext *s)
|
||||
fill_size = ffm->packet_end - ffm->packet_ptr;
|
||||
memset(ffm->packet_ptr, 0, fill_size);
|
||||
|
||||
if (url_ftell(pb) % ffm->packet_size)
|
||||
if (avio_tell(pb) % ffm->packet_size)
|
||||
av_abort();
|
||||
|
||||
/* put header */
|
||||
@ -184,7 +184,7 @@ static int ffm_write_header(AVFormatContext *s)
|
||||
}
|
||||
|
||||
/* flush until end of block reached */
|
||||
while ((url_ftell(pb) % ffm->packet_size) != 0)
|
||||
while ((avio_tell(pb) % ffm->packet_size) != 0)
|
||||
avio_w8(pb, 0);
|
||||
|
||||
put_flush_packet(pb);
|
||||
|
@ -82,7 +82,7 @@ static int read_packet(AVFormatContext *s,
|
||||
|
||||
if (url_feof(s->pb))
|
||||
return AVERROR(EIO);
|
||||
pkt->dts = url_ftell(s->pb) / (st->codec->width * (st->codec->height + film->leading) * 4);
|
||||
pkt->dts = avio_tell(s->pb) / (st->codec->width * (st->codec->height + film->leading) * 4);
|
||||
pkt->size = av_get_packet(s->pb, pkt, st->codec->width * st->codec->height * 4);
|
||||
avio_seek(s->pb, st->codec->width * film->leading * 4, SEEK_CUR);
|
||||
if (pkt->size < 0)
|
||||
|
@ -100,7 +100,7 @@ static int flac_write_trailer(struct AVFormatContext *s)
|
||||
|
||||
if (!url_is_streamed(pb)) {
|
||||
/* rewrite the STREAMINFO header block data */
|
||||
file_size = url_ftell(pb);
|
||||
file_size = avio_tell(pb);
|
||||
avio_seek(pb, 8, SEEK_SET);
|
||||
avio_write(pb, streaminfo, FLAC_STREAMINFO_SIZE);
|
||||
avio_seek(pb, file_size, SEEK_SET);
|
||||
|
@ -223,7 +223,7 @@ static int flic_read_packet(AVFormatContext *s,
|
||||
}
|
||||
pkt->stream_index = flic->video_stream_index;
|
||||
pkt->pts = flic->frame_number++;
|
||||
pkt->pos = url_ftell(pb);
|
||||
pkt->pos = avio_tell(pb);
|
||||
memcpy(pkt->data, preamble, FLIC_PREAMBLE_SIZE);
|
||||
ret = avio_read(pb, pkt->data + FLIC_PREAMBLE_SIZE,
|
||||
size - FLIC_PREAMBLE_SIZE);
|
||||
@ -242,7 +242,7 @@ static int flic_read_packet(AVFormatContext *s,
|
||||
avio_seek(pb, 10, SEEK_CUR);
|
||||
|
||||
pkt->stream_index = flic->audio_stream_index;
|
||||
pkt->pos = url_ftell(pb);
|
||||
pkt->pos = avio_tell(pb);
|
||||
ret = avio_read(pb, pkt->data, size);
|
||||
|
||||
if (ret != size) {
|
||||
|
@ -148,7 +148,7 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst
|
||||
case AMF_DATA_TYPE_OBJECT: {
|
||||
unsigned int keylen;
|
||||
|
||||
while(url_ftell(ioc) < max_pos - 2 && (keylen = avio_rb16(ioc))) {
|
||||
while(avio_tell(ioc) < max_pos - 2 && (keylen = avio_rb16(ioc))) {
|
||||
avio_seek(ioc, keylen, SEEK_CUR); //skip key string
|
||||
if(amf_parse_object(s, NULL, NULL, NULL, max_pos, depth + 1) < 0)
|
||||
return -1; //if we couldn't skip, bomb out.
|
||||
@ -163,7 +163,7 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst
|
||||
break; //these take up no additional space
|
||||
case AMF_DATA_TYPE_MIXEDARRAY:
|
||||
avio_seek(ioc, 4, SEEK_CUR); //skip 32-bit max array index
|
||||
while(url_ftell(ioc) < max_pos - 2 && amf_get_string(ioc, str_val, sizeof(str_val)) > 0) {
|
||||
while(avio_tell(ioc) < max_pos - 2 && amf_get_string(ioc, str_val, sizeof(str_val)) > 0) {
|
||||
//this is the only case in which we would want a nested parse to not skip over the object
|
||||
if(amf_parse_object(s, astream, vstream, str_val, max_pos, depth + 1) < 0)
|
||||
return -1;
|
||||
@ -175,7 +175,7 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst
|
||||
unsigned int arraylen, i;
|
||||
|
||||
arraylen = avio_rb32(ioc);
|
||||
for(i = 0; i < arraylen && url_ftell(ioc) < max_pos - 1; i++) {
|
||||
for(i = 0; i < arraylen && avio_tell(ioc) < max_pos - 1; i++) {
|
||||
if(amf_parse_object(s, NULL, NULL, NULL, max_pos, depth + 1) < 0)
|
||||
return -1; //if we couldn't skip, bomb out.
|
||||
}
|
||||
@ -305,7 +305,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
AVStream *st = NULL;
|
||||
|
||||
for(;;avio_seek(s->pb, 4, SEEK_CUR)){ /* pkt size is repeated at end. skip it */
|
||||
pos = url_ftell(s->pb);
|
||||
pos = avio_tell(s->pb);
|
||||
type = avio_r8(s->pb);
|
||||
size = avio_rb24(s->pb);
|
||||
dts = avio_rb24(s->pb);
|
||||
@ -319,7 +319,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
if(size == 0)
|
||||
continue;
|
||||
|
||||
next= size + url_ftell(s->pb);
|
||||
next= size + avio_tell(s->pb);
|
||||
|
||||
if (type == FLV_TAG_TYPE_AUDIO) {
|
||||
is_audio=1;
|
||||
@ -372,7 +372,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
// if not streamed and no duration from metadata then seek to end to find the duration from the timestamps
|
||||
if(!url_is_streamed(s->pb) && (!s->duration || s->duration==AV_NOPTS_VALUE)){
|
||||
int size;
|
||||
const int64_t pos= url_ftell(s->pb);
|
||||
const int64_t pos= avio_tell(s->pb);
|
||||
const int64_t fsize= url_fsize(s->pb);
|
||||
avio_seek(s->pb, fsize-4, SEEK_SET);
|
||||
size= avio_rb32(s->pb);
|
||||
|
@ -221,7 +221,7 @@ static int flv_write_header(AVFormatContext *s)
|
||||
|
||||
/* write meta_tag */
|
||||
avio_w8(pb, 18); // tag type META
|
||||
metadata_size_pos= url_ftell(pb);
|
||||
metadata_size_pos= avio_tell(pb);
|
||||
avio_wb24(pb, 0); // size of data part (sum of all parts below)
|
||||
avio_wb24(pb, 0); // time stamp
|
||||
avio_wb32(pb, 0); // reserved
|
||||
@ -237,7 +237,7 @@ static int flv_write_header(AVFormatContext *s)
|
||||
avio_wb32(pb, 5*!!video_enc + 5*!!audio_enc + 2); // +2 for duration and file size
|
||||
|
||||
put_amf_string(pb, "duration");
|
||||
flv->duration_offset= url_ftell(pb);
|
||||
flv->duration_offset= avio_tell(pb);
|
||||
put_amf_double(pb, s->duration / AV_TIME_BASE); // fill in the guessed duration, it'll be corrected later if incorrect
|
||||
|
||||
if(video_enc){
|
||||
@ -281,14 +281,14 @@ static int flv_write_header(AVFormatContext *s)
|
||||
}
|
||||
|
||||
put_amf_string(pb, "filesize");
|
||||
flv->filesize_offset= url_ftell(pb);
|
||||
flv->filesize_offset= avio_tell(pb);
|
||||
put_amf_double(pb, 0); // delayed write
|
||||
|
||||
put_amf_string(pb, "");
|
||||
avio_w8(pb, AMF_END_OF_OBJECT);
|
||||
|
||||
/* write total size of tag */
|
||||
data_size= url_ftell(pb) - metadata_size_pos - 10;
|
||||
data_size= avio_tell(pb) - metadata_size_pos - 10;
|
||||
avio_seek(pb, metadata_size_pos, SEEK_SET);
|
||||
avio_wb24(pb, data_size);
|
||||
avio_seek(pb, data_size + 10 - 3, SEEK_CUR);
|
||||
@ -304,7 +304,7 @@ static int flv_write_header(AVFormatContext *s)
|
||||
avio_wb24(pb, 0); // ts
|
||||
avio_w8(pb, 0); // ts ext
|
||||
avio_wb24(pb, 0); // streamid
|
||||
pos = url_ftell(pb);
|
||||
pos = avio_tell(pb);
|
||||
if (enc->codec_id == CODEC_ID_AAC) {
|
||||
avio_w8(pb, get_audio_flags(enc));
|
||||
avio_w8(pb, 0); // AAC sequence header
|
||||
@ -315,7 +315,7 @@ static int flv_write_header(AVFormatContext *s)
|
||||
avio_wb24(pb, 0); // composition time
|
||||
ff_isom_write_avcc(pb, enc->extradata, enc->extradata_size);
|
||||
}
|
||||
data_size = url_ftell(pb) - pos;
|
||||
data_size = avio_tell(pb) - pos;
|
||||
avio_seek(pb, -data_size - 10, SEEK_CUR);
|
||||
avio_wb24(pb, data_size);
|
||||
avio_seek(pb, data_size + 10 - 3, SEEK_CUR);
|
||||
@ -343,7 +343,7 @@ static int flv_write_trailer(AVFormatContext *s)
|
||||
}
|
||||
}
|
||||
|
||||
file_size = url_ftell(pb);
|
||||
file_size = avio_tell(pb);
|
||||
|
||||
/* update informations */
|
||||
avio_seek(pb, flv->duration_offset, SEEK_SET);
|
||||
|
@ -396,7 +396,7 @@ start:
|
||||
READ_ONE();
|
||||
if (tmp != 1)
|
||||
goto start;
|
||||
last_pos = url_ftell(pb);
|
||||
last_pos = avio_tell(pb);
|
||||
if (avio_seek(pb, -5, SEEK_CUR) < 0)
|
||||
goto out;
|
||||
if (!parse_packet_header(pb, &type, &len) || type != PKT_MEDIA) {
|
||||
@ -407,7 +407,7 @@ start:
|
||||
avio_r8(pb);
|
||||
cur_track = avio_r8(pb);
|
||||
cur_timestamp = avio_rb32(pb);
|
||||
last_found_pos = url_ftell(pb) - 16 - 6;
|
||||
last_found_pos = avio_tell(pb) - 16 - 6;
|
||||
if ((track >= 0 && track != cur_track) || (timestamp >= 0 && timestamp > cur_timestamp)) {
|
||||
if (avio_seek(pb, last_pos, SEEK_SET) >= 0)
|
||||
goto start;
|
||||
@ -511,7 +511,7 @@ static int64_t gxf_read_timestamp(AVFormatContext *s, int stream_index,
|
||||
if (avio_seek(pb, *pos, SEEK_SET) < 0)
|
||||
return AV_NOPTS_VALUE;
|
||||
res = gxf_resync_media(s, pos_limit - *pos, -1, -1);
|
||||
*pos = url_ftell(pb);
|
||||
*pos = avio_tell(pb);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -125,12 +125,12 @@ static int64_t updatePacketSize(AVIOContext *pb, int64_t pos)
|
||||
int64_t curpos;
|
||||
int size;
|
||||
|
||||
size = url_ftell(pb) - pos;
|
||||
size = avio_tell(pb) - pos;
|
||||
if (size % 4) {
|
||||
gxf_write_padding(pb, 4 - size % 4);
|
||||
size = url_ftell(pb) - pos;
|
||||
size = avio_tell(pb) - pos;
|
||||
}
|
||||
curpos = url_ftell(pb);
|
||||
curpos = avio_tell(pb);
|
||||
avio_seek(pb, pos + 6, SEEK_SET);
|
||||
avio_wb32(pb, size);
|
||||
avio_seek(pb, curpos, SEEK_SET);
|
||||
@ -141,7 +141,7 @@ static int64_t updateSize(AVIOContext *pb, int64_t pos)
|
||||
{
|
||||
int64_t curpos;
|
||||
|
||||
curpos = url_ftell(pb);
|
||||
curpos = avio_tell(pb);
|
||||
avio_seek(pb, pos, SEEK_SET);
|
||||
avio_wb16(pb, curpos - pos - 2);
|
||||
avio_seek(pb, curpos, SEEK_SET);
|
||||
@ -218,7 +218,7 @@ static int gxf_write_track_description(AVFormatContext *s, GXFStreamContext *sc,
|
||||
avio_w8(pb, sc->media_type + 0x80);
|
||||
avio_w8(pb, index + 0xC0);
|
||||
|
||||
pos = url_ftell(pb);
|
||||
pos = avio_tell(pb);
|
||||
avio_wb16(pb, 0); /* size */
|
||||
|
||||
/* media file name */
|
||||
@ -272,7 +272,7 @@ static int gxf_write_material_data_section(AVFormatContext *s)
|
||||
int len;
|
||||
const char *filename = strrchr(s->filename, '/');
|
||||
|
||||
pos = url_ftell(pb);
|
||||
pos = avio_tell(pb);
|
||||
avio_wb16(pb, 0); /* size */
|
||||
|
||||
/* name */
|
||||
@ -322,7 +322,7 @@ static int gxf_write_track_description_section(AVFormatContext *s)
|
||||
int64_t pos;
|
||||
int i;
|
||||
|
||||
pos = url_ftell(pb);
|
||||
pos = avio_tell(pb);
|
||||
avio_wb16(pb, 0); /* size */
|
||||
for (i = 0; i < s->nb_streams; ++i)
|
||||
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)
|
||||
{
|
||||
GXFContext *gxf = s->priv_data;
|
||||
AVIOContext *pb = s->pb;
|
||||
int64_t pos = url_ftell(pb);
|
||||
int64_t pos = avio_tell(pb);
|
||||
|
||||
if (!rewrite) {
|
||||
if (!(gxf->map_offsets_nb % 30)) {
|
||||
@ -366,7 +366,7 @@ static int gxf_write_flt_packet(AVFormatContext *s)
|
||||
{
|
||||
GXFContext *gxf = s->priv_data;
|
||||
AVIOContext *pb = s->pb;
|
||||
int64_t pos = url_ftell(pb);
|
||||
int64_t pos = avio_tell(pb);
|
||||
int fields_per_flt = (gxf->nb_fields+1) / 1000 + 1;
|
||||
int flt_entries = gxf->nb_fields / fields_per_flt;
|
||||
int i = 0;
|
||||
@ -442,7 +442,7 @@ static int gxf_write_umf_track_description(AVFormatContext *s)
|
||||
{
|
||||
AVIOContext *pb = s->pb;
|
||||
GXFContext *gxf = s->priv_data;
|
||||
int64_t pos = url_ftell(pb);
|
||||
int64_t pos = avio_tell(pb);
|
||||
int i;
|
||||
|
||||
gxf->umf_track_offset = pos - gxf->umf_start_offset;
|
||||
@ -455,7 +455,7 @@ static int gxf_write_umf_track_description(AVFormatContext *s)
|
||||
avio_wl16(pb, gxf->timecode_track.media_info);
|
||||
avio_wl16(pb, 1);
|
||||
|
||||
return url_ftell(pb) - pos;
|
||||
return avio_tell(pb) - pos;
|
||||
}
|
||||
|
||||
static int gxf_write_umf_media_mpeg(AVIOContext *pb, AVStream *st)
|
||||
@ -533,7 +533,7 @@ static int gxf_write_umf_media_description(AVFormatContext *s)
|
||||
int64_t pos;
|
||||
int i, j;
|
||||
|
||||
pos = url_ftell(pb);
|
||||
pos = avio_tell(pb);
|
||||
gxf->umf_media_offset = pos - gxf->umf_start_offset;
|
||||
for (i = 0; i <= s->nb_streams; ++i) {
|
||||
GXFStreamContext *sc;
|
||||
@ -544,7 +544,7 @@ static int gxf_write_umf_media_description(AVFormatContext *s)
|
||||
else
|
||||
sc = s->streams[i]->priv_data;
|
||||
|
||||
startpos = url_ftell(pb);
|
||||
startpos = avio_tell(pb);
|
||||
avio_wl16(pb, 0); /* length */
|
||||
avio_wl16(pb, sc->media_info);
|
||||
avio_wl16(pb, 0); /* reserved */
|
||||
@ -580,19 +580,19 @@ static int gxf_write_umf_media_description(AVFormatContext *s)
|
||||
}
|
||||
}
|
||||
|
||||
curpos = url_ftell(pb);
|
||||
curpos = avio_tell(pb);
|
||||
avio_seek(pb, startpos, SEEK_SET);
|
||||
avio_wl16(pb, curpos - startpos);
|
||||
avio_seek(pb, curpos, SEEK_SET);
|
||||
}
|
||||
return url_ftell(pb) - pos;
|
||||
return avio_tell(pb) - pos;
|
||||
}
|
||||
|
||||
static int gxf_write_umf_packet(AVFormatContext *s)
|
||||
{
|
||||
GXFContext *gxf = s->priv_data;
|
||||
AVIOContext *pb = s->pb;
|
||||
int64_t pos = url_ftell(pb);
|
||||
int64_t pos = avio_tell(pb);
|
||||
|
||||
gxf_write_packet_header(pb, PKT_UMF);
|
||||
|
||||
@ -600,12 +600,12 @@ static int gxf_write_umf_packet(AVFormatContext *s)
|
||||
avio_w8(pb, 3); /* first and last (only) packet */
|
||||
avio_wb32(pb, gxf->umf_length); /* data length */
|
||||
|
||||
gxf->umf_start_offset = url_ftell(pb);
|
||||
gxf->umf_start_offset = avio_tell(pb);
|
||||
gxf_write_umf_payload(s);
|
||||
gxf_write_umf_material_description(s);
|
||||
gxf->umf_track_size = gxf_write_umf_track_description(s);
|
||||
gxf->umf_media_size = gxf_write_umf_media_description(s);
|
||||
gxf->umf_length = url_ftell(pb) - gxf->umf_start_offset;
|
||||
gxf->umf_length = avio_tell(pb) - gxf->umf_start_offset;
|
||||
return updatePacketSize(pb, pos);
|
||||
}
|
||||
|
||||
@ -759,7 +759,7 @@ static int gxf_write_header(AVFormatContext *s)
|
||||
|
||||
static int gxf_write_eos_packet(AVIOContext *pb)
|
||||
{
|
||||
int64_t pos = url_ftell(pb);
|
||||
int64_t pos = avio_tell(pb);
|
||||
|
||||
gxf_write_packet_header(pb, PKT_EOS);
|
||||
return updatePacketSize(pb, pos);
|
||||
@ -775,7 +775,7 @@ static int gxf_write_trailer(AVFormatContext *s)
|
||||
ff_audio_interleave_close(s);
|
||||
|
||||
gxf_write_eos_packet(pb);
|
||||
end = url_ftell(pb);
|
||||
end = avio_tell(pb);
|
||||
avio_seek(pb, 0, SEEK_SET);
|
||||
/* overwrite map, flt and umf packets with new values */
|
||||
gxf_write_map_packet(s, 1);
|
||||
@ -861,9 +861,9 @@ static int gxf_write_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
GXFContext *gxf = s->priv_data;
|
||||
AVIOContext *pb = s->pb;
|
||||
AVStream *st = s->streams[pkt->stream_index];
|
||||
int64_t pos = url_ftell(pb);
|
||||
int64_t pos = avio_tell(pb);
|
||||
int padding = 0;
|
||||
int packet_start_offset = url_ftell(pb) / 1024;
|
||||
int packet_start_offset = avio_tell(pb) / 1024;
|
||||
|
||||
gxf_write_packet_header(pb, PKT_MEDIA);
|
||||
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
|
||||
if (len < 0)
|
||||
break;
|
||||
|
||||
next = url_ftell(s->pb) + tlen;
|
||||
next = avio_tell(s->pb) + tlen;
|
||||
|
||||
if (tflags & ID3v2_FLAG_DATALEN) {
|
||||
avio_rb32(s->pb);
|
||||
@ -258,7 +258,7 @@ void ff_id3v2_read(AVFormatContext *s, const char *magic)
|
||||
|
||||
do {
|
||||
/* save the current offset in case there's nothing to read/skip */
|
||||
off = url_ftell(s->pb);
|
||||
off = avio_tell(s->pb);
|
||||
ret = avio_read(s->pb, buf, ID3v2_HEADER_SIZE);
|
||||
if (ret != ID3v2_HEADER_SIZE)
|
||||
break;
|
||||
|
@ -141,7 +141,7 @@ static int roq_read_packet(AVFormatContext *s,
|
||||
|
||||
case RoQ_QUAD_CODEBOOK:
|
||||
/* packet needs to contain both this codebook and next VQ chunk */
|
||||
codebook_offset = url_ftell(pb) - RoQ_CHUNK_PREAMBLE_SIZE;
|
||||
codebook_offset = avio_tell(pb) - RoQ_CHUNK_PREAMBLE_SIZE;
|
||||
codebook_size = chunk_size;
|
||||
avio_seek(pb, codebook_size, SEEK_CUR);
|
||||
if (avio_read(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) !=
|
||||
@ -197,7 +197,7 @@ static int roq_read_packet(AVFormatContext *s,
|
||||
roq->audio_frame_count += (chunk_size / roq->audio_channels);
|
||||
}
|
||||
|
||||
pkt->pos= url_ftell(pb);
|
||||
pkt->pos= avio_tell(pb);
|
||||
ret = avio_read(pb, pkt->data + RoQ_CHUNK_PREAMBLE_SIZE,
|
||||
chunk_size);
|
||||
if (ret != chunk_size)
|
||||
|
@ -144,7 +144,7 @@ static int iff_read_header(AVFormatContext *s,
|
||||
const char *metadata_tag = NULL;
|
||||
chunk_id = avio_rl32(pb);
|
||||
data_size = avio_rb32(pb);
|
||||
orig_pos = url_ftell(pb);
|
||||
orig_pos = avio_tell(pb);
|
||||
|
||||
switch(chunk_id) {
|
||||
case ID_VHDR:
|
||||
@ -161,7 +161,7 @@ static int iff_read_header(AVFormatContext *s,
|
||||
break;
|
||||
|
||||
case ID_BODY:
|
||||
iff->body_pos = url_ftell(pb);
|
||||
iff->body_pos = avio_tell(pb);
|
||||
iff->body_size = data_size;
|
||||
break;
|
||||
|
||||
@ -223,7 +223,7 @@ static int iff_read_header(AVFormatContext *s,
|
||||
return res;
|
||||
}
|
||||
}
|
||||
avio_seek(pb, data_size - (url_ftell(pb) - orig_pos) + (data_size & 1), SEEK_CUR);
|
||||
avio_seek(pb, data_size - (avio_tell(pb) - orig_pos) + (data_size & 1), SEEK_CUR);
|
||||
}
|
||||
|
||||
avio_seek(pb, iff->body_pos, SEEK_SET);
|
||||
|
@ -47,7 +47,7 @@ static int ingenient_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
if (av_new_packet(pkt, size) < 0)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
pkt->pos = url_ftell(s->pb);
|
||||
pkt->pos = avio_tell(s->pb);
|
||||
pkt->stream_index = 0;
|
||||
ret = avio_read(s->pb, pkt->data, size);
|
||||
if (ret < 0) {
|
||||
|
@ -405,7 +405,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb,
|
||||
debug_ipmovie("audio frame\n");
|
||||
|
||||
/* log position and move on for now */
|
||||
s->audio_chunk_offset = url_ftell(pb);
|
||||
s->audio_chunk_offset = avio_tell(pb);
|
||||
s->audio_chunk_size = opcode_size;
|
||||
avio_seek(pb, opcode_size, SEEK_CUR);
|
||||
break;
|
||||
@ -471,7 +471,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb,
|
||||
debug_ipmovie("set decoding map\n");
|
||||
|
||||
/* log position and move on for now */
|
||||
s->decode_map_chunk_offset = url_ftell(pb);
|
||||
s->decode_map_chunk_offset = avio_tell(pb);
|
||||
s->decode_map_chunk_size = opcode_size;
|
||||
avio_seek(pb, opcode_size, SEEK_CUR);
|
||||
break;
|
||||
@ -480,7 +480,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb,
|
||||
debug_ipmovie("set video data\n");
|
||||
|
||||
/* log position and move on for now */
|
||||
s->video_chunk_offset = url_ftell(pb);
|
||||
s->video_chunk_offset = avio_tell(pb);
|
||||
s->video_chunk_size = opcode_size;
|
||||
avio_seek(pb, opcode_size, SEEK_CUR);
|
||||
break;
|
||||
@ -494,7 +494,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb,
|
||||
}
|
||||
|
||||
/* make a note of where the stream is sitting */
|
||||
s->next_chunk_offset = url_ftell(pb);
|
||||
s->next_chunk_offset = avio_tell(pb);
|
||||
|
||||
/* dispatch the first of any pending packets */
|
||||
if ((chunk_type == CHUNK_VIDEO) || (chunk_type == CHUNK_AUDIO_ONLY))
|
||||
@ -541,7 +541,7 @@ static int ipmovie_read_header(AVFormatContext *s,
|
||||
ipmovie->decode_map_chunk_offset = 0;
|
||||
|
||||
/* on the first read, this will position the stream at the first chunk */
|
||||
ipmovie->next_chunk_offset = url_ftell(pb) + 4;
|
||||
ipmovie->next_chunk_offset = avio_tell(pb) + 4;
|
||||
|
||||
/* process the first chunk which should be CHUNK_INIT_VIDEO */
|
||||
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)
|
||||
get_token(pb, token, sizeof(token)); //Version ID
|
||||
get_token(pb, token, sizeof(token)); //Size
|
||||
|
||||
iss->sample_start_pos = url_ftell(pb);
|
||||
iss->sample_start_pos = avio_tell(pb);
|
||||
|
||||
st = av_new_stream(s, 0);
|
||||
if (!st)
|
||||
@ -116,7 +116,7 @@ static int iss_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
return AVERROR(EIO);
|
||||
|
||||
pkt->stream_index = 0;
|
||||
pkt->pts = url_ftell(s->pb) - iss->sample_start_pos;
|
||||
pkt->pts = avio_tell(s->pb) - iss->sample_start_pos;
|
||||
if(s->streams[0]->codec->channels > 0)
|
||||
pkt->pts /= s->streams[0]->codec->channels*2;
|
||||
return 0;
|
||||
|
@ -272,7 +272,7 @@ static int nut_read_packet(AVFormatContext * avf, AVPacket * pkt) {
|
||||
if (pd.flags & NUT_FLAG_KEY) pkt->flags |= AV_PKT_FLAG_KEY;
|
||||
pkt->pts = pd.pts;
|
||||
pkt->stream_index = pd.stream;
|
||||
pkt->pos = url_ftell(avf->pb);
|
||||
pkt->pos = avio_tell(avf->pb);
|
||||
|
||||
ret = nut_read_frame(priv->nut, &pd.len, pkt->data);
|
||||
|
||||
|
@ -517,7 +517,7 @@ static const char *matroska_doctypes[] = { "matroska", "webm" };
|
||||
static int ebml_level_end(MatroskaDemuxContext *matroska)
|
||||
{
|
||||
AVIOContext *pb = matroska->ctx->pb;
|
||||
int64_t pos = url_ftell(pb);
|
||||
int64_t pos = avio_tell(pb);
|
||||
|
||||
if (matroska->num_levels > 0) {
|
||||
MatroskaLevel *level = &matroska->levels[matroska->num_levels - 1];
|
||||
@ -549,7 +549,7 @@ static int ebml_read_num(MatroskaDemuxContext *matroska, AVIOContext *pb,
|
||||
if (!(total = avio_r8(pb))) {
|
||||
/* we might encounter EOS here */
|
||||
if (!url_feof(pb)) {
|
||||
int64_t pos = url_ftell(pb);
|
||||
int64_t pos = avio_tell(pb);
|
||||
av_log(matroska->ctx, AV_LOG_ERROR,
|
||||
"Read error at pos. %"PRIu64" (0x%"PRIx64")\n",
|
||||
pos, pos);
|
||||
@ -560,7 +560,7 @@ static int ebml_read_num(MatroskaDemuxContext *matroska, AVIOContext *pb,
|
||||
/* get the length of the EBML number */
|
||||
read = 8 - ff_log2_tab[total];
|
||||
if (read > max_size) {
|
||||
int64_t pos = url_ftell(pb) - 1;
|
||||
int64_t pos = avio_tell(pb) - 1;
|
||||
av_log(matroska->ctx, AV_LOG_ERROR,
|
||||
"Invalid EBML number size tag 0x%02x at pos %"PRIu64" (0x%"PRIx64")\n",
|
||||
(uint8_t) total, pos, pos);
|
||||
@ -659,7 +659,7 @@ static int ebml_read_binary(AVIOContext *pb, int length, EbmlBin *bin)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
bin->size = length;
|
||||
bin->pos = url_ftell(pb);
|
||||
bin->pos = avio_tell(pb);
|
||||
if (avio_read(pb, bin->data, length) != length) {
|
||||
av_freep(&bin->data);
|
||||
return AVERROR(EIO);
|
||||
@ -685,7 +685,7 @@ static int ebml_read_master(MatroskaDemuxContext *matroska, uint64_t length)
|
||||
}
|
||||
|
||||
level = &matroska->levels[matroska->num_levels++];
|
||||
level->start = url_ftell(pb);
|
||||
level->start = avio_tell(pb);
|
||||
level->length = length;
|
||||
|
||||
return 0;
|
||||
@ -827,7 +827,7 @@ static int ebml_parse_elem(MatroskaDemuxContext *matroska,
|
||||
case EBML_NEST: if ((res=ebml_read_master(matroska, length)) < 0)
|
||||
return res;
|
||||
if (id == MATROSKA_ID_SEGMENT)
|
||||
matroska->segment_start = url_ftell(matroska->ctx->pb);
|
||||
matroska->segment_start = avio_tell(matroska->ctx->pb);
|
||||
return ebml_parse_nest(matroska, syntax->def.n, data);
|
||||
case EBML_PASS: return ebml_parse_id(matroska, syntax->def.n, id, data);
|
||||
case EBML_STOP: return 1;
|
||||
@ -1111,7 +1111,7 @@ static void matroska_execute_seekhead(MatroskaDemuxContext *matroska)
|
||||
EbmlList *seekhead_list = &matroska->seekhead;
|
||||
MatroskaSeekhead *seekhead = seekhead_list->elem;
|
||||
uint32_t level_up = matroska->level_up;
|
||||
int64_t before_pos = url_ftell(matroska->ctx->pb);
|
||||
int64_t before_pos = avio_tell(matroska->ctx->pb);
|
||||
uint32_t saved_id = matroska->current_id;
|
||||
MatroskaLevel level;
|
||||
int i;
|
||||
@ -1842,7 +1842,7 @@ static int matroska_parse_cluster(MatroskaDemuxContext *matroska)
|
||||
EbmlList *blocks_list;
|
||||
MatroskaBlock *blocks;
|
||||
int i, res;
|
||||
int64_t pos = url_ftell(matroska->ctx->pb);
|
||||
int64_t pos = avio_tell(matroska->ctx->pb);
|
||||
matroska->prev_pkt = NULL;
|
||||
if (matroska->current_id)
|
||||
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
|
||||
*/
|
||||
static void put_ebml_void(AVIOContext *pb, uint64_t size)
|
||||
{
|
||||
int64_t currentpos = url_ftell(pb);
|
||||
int64_t currentpos = avio_tell(pb);
|
||||
|
||||
assert(size >= 2);
|
||||
|
||||
@ -215,7 +215,7 @@ static void put_ebml_void(AVIOContext *pb, uint64_t size)
|
||||
put_ebml_num(pb, size-1, 0);
|
||||
else
|
||||
put_ebml_num(pb, size-9, 8);
|
||||
while(url_ftell(pb) < currentpos + size)
|
||||
while(avio_tell(pb) < currentpos + size)
|
||||
avio_w8(pb, 0);
|
||||
}
|
||||
|
||||
@ -224,12 +224,12 @@ static ebml_master start_ebml_master(AVIOContext *pb, unsigned int elementid, ui
|
||||
int bytes = expectedsize ? ebml_num_size(expectedsize) : 8;
|
||||
put_ebml_id(pb, elementid);
|
||||
put_ebml_size_unknown(pb, bytes);
|
||||
return (ebml_master){ url_ftell(pb), bytes };
|
||||
return (ebml_master){ avio_tell(pb), bytes };
|
||||
}
|
||||
|
||||
static void end_ebml_master(AVIOContext *pb, ebml_master master)
|
||||
{
|
||||
int64_t pos = url_ftell(pb);
|
||||
int64_t pos = avio_tell(pb);
|
||||
|
||||
if (avio_seek(pb, master.pos - master.sizebytes, SEEK_SET) < 0)
|
||||
return;
|
||||
@ -265,7 +265,7 @@ static mkv_seekhead * mkv_start_seekhead(AVIOContext *pb, int64_t segment_offset
|
||||
new_seekhead->segment_offset = segment_offset;
|
||||
|
||||
if (numelements > 0) {
|
||||
new_seekhead->filepos = url_ftell(pb);
|
||||
new_seekhead->filepos = avio_tell(pb);
|
||||
// 21 bytes max for a seek entry, 10 bytes max for the SeekHead ID
|
||||
// and size, and 3 bytes to guarantee that an EBML void element
|
||||
// will fit afterwards
|
||||
@ -310,7 +310,7 @@ static int64_t mkv_write_seekhead(AVIOContext *pb, mkv_seekhead *seekhead)
|
||||
int64_t currentpos;
|
||||
int i;
|
||||
|
||||
currentpos = url_ftell(pb);
|
||||
currentpos = avio_tell(pb);
|
||||
|
||||
if (seekhead->reserved_size > 0)
|
||||
if (avio_seek(pb, seekhead->filepos, SEEK_SET) < 0)
|
||||
@ -332,7 +332,7 @@ static int64_t mkv_write_seekhead(AVIOContext *pb, mkv_seekhead *seekhead)
|
||||
end_ebml_master(pb, metaseek);
|
||||
|
||||
if (seekhead->reserved_size > 0) {
|
||||
uint64_t remaining = seekhead->filepos + seekhead->reserved_size - url_ftell(pb);
|
||||
uint64_t remaining = seekhead->filepos + seekhead->reserved_size - avio_tell(pb);
|
||||
put_ebml_void(pb, remaining);
|
||||
avio_seek(pb, currentpos, SEEK_SET);
|
||||
|
||||
@ -379,7 +379,7 @@ static int64_t mkv_write_cues(AVIOContext *pb, mkv_cues *cues, int num_tracks)
|
||||
int64_t currentpos;
|
||||
int i, j;
|
||||
|
||||
currentpos = url_ftell(pb);
|
||||
currentpos = avio_tell(pb);
|
||||
cues_element = start_ebml_master(pb, MATROSKA_ID_CUES, 0);
|
||||
|
||||
for (i = 0; i < cues->num_entries; i++) {
|
||||
@ -526,7 +526,7 @@ static int mkv_write_tracks(AVFormatContext *s)
|
||||
ebml_master tracks;
|
||||
int i, j, ret;
|
||||
|
||||
ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_TRACKS, url_ftell(pb));
|
||||
ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_TRACKS, avio_tell(pb));
|
||||
if (ret < 0) return ret;
|
||||
|
||||
tracks = start_ebml_master(pb, MATROSKA_ID_TRACKS, 0);
|
||||
@ -658,7 +658,7 @@ static int mkv_write_chapters(AVFormatContext *s)
|
||||
if (!s->nb_chapters)
|
||||
return 0;
|
||||
|
||||
ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_CHAPTERS, url_ftell(pb));
|
||||
ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_CHAPTERS, avio_tell(pb));
|
||||
if (ret < 0) return ret;
|
||||
|
||||
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
|
||||
int ret;
|
||||
|
||||
if (!tags->pos) {
|
||||
ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_TAGS, url_ftell(s->pb));
|
||||
ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_TAGS, avio_tell(s->pb));
|
||||
if (ret < 0) return ret;
|
||||
|
||||
*tags = start_ebml_master(s->pb, MATROSKA_ID_TAGS, 0);
|
||||
@ -813,7 +813,7 @@ static int mkv_write_header(AVFormatContext *s)
|
||||
end_ebml_master(pb, ebml_header);
|
||||
|
||||
mkv->segment = start_ebml_master(pb, MATROSKA_ID_SEGMENT, 0);
|
||||
mkv->segment_offset = url_ftell(pb);
|
||||
mkv->segment_offset = avio_tell(pb);
|
||||
|
||||
// we write 2 seek heads - one at the end of the file to point to each
|
||||
// cluster, and one at the beginning to point to all other level one
|
||||
@ -824,7 +824,7 @@ static int mkv_write_header(AVFormatContext *s)
|
||||
if (!mkv->main_seekhead)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_INFO, url_ftell(pb));
|
||||
ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_INFO, avio_tell(pb));
|
||||
if (ret < 0) return ret;
|
||||
|
||||
segment_info = start_ebml_master(pb, MATROSKA_ID_INFO, 0);
|
||||
@ -847,7 +847,7 @@ static int mkv_write_header(AVFormatContext *s)
|
||||
|
||||
// reserve space for the duration
|
||||
mkv->duration = 0;
|
||||
mkv->duration_offset = url_ftell(pb);
|
||||
mkv->duration_offset = avio_tell(pb);
|
||||
put_ebml_void(pb, 11); // assumes double-precision float to be written
|
||||
end_ebml_master(pb, segment_info);
|
||||
|
||||
@ -928,7 +928,7 @@ static int mkv_write_ass_blocks(AVFormatContext *s, AVIOContext *pb, AVPacket *p
|
||||
|
||||
av_log(s, AV_LOG_DEBUG, "Writing block at offset %" PRIu64 ", size %d, "
|
||||
"pts %" PRId64 ", duration %d\n",
|
||||
url_ftell(pb), size, pkt->pts, duration);
|
||||
avio_tell(pb), size, pkt->pts, duration);
|
||||
blockgroup = start_ebml_master(pb, MATROSKA_ID_BLOCKGROUP, mkv_blockgroup_size(size));
|
||||
put_ebml_id(pb, MATROSKA_ID_BLOCK);
|
||||
put_ebml_num(pb, size+4, 0);
|
||||
@ -957,7 +957,7 @@ static void mkv_write_block(AVFormatContext *s, AVIOContext *pb,
|
||||
|
||||
av_log(s, AV_LOG_DEBUG, "Writing block at offset %" PRIu64 ", size %d, "
|
||||
"pts %" PRId64 ", dts %" PRId64 ", duration %d, flags %d\n",
|
||||
url_ftell(pb), pkt->size, pkt->pts, pkt->dts, pkt->duration, flags);
|
||||
avio_tell(pb), pkt->size, pkt->pts, pkt->dts, pkt->duration, flags);
|
||||
if (codec->codec_id == CODEC_ID_H264 && codec->extradata_size > 0 &&
|
||||
(AV_RB24(codec->extradata) == 1 || AV_RB32(codec->extradata) == 1))
|
||||
ff_avc_parse_nal_units_buf(pkt->data, &data, &size);
|
||||
@ -1045,7 +1045,7 @@ static int mkv_write_packet_internal(AVFormatContext *s, AVPacket *pkt)
|
||||
}
|
||||
|
||||
if (!mkv->cluster_pos) {
|
||||
mkv->cluster_pos = url_ftell(s->pb);
|
||||
mkv->cluster_pos = avio_tell(s->pb);
|
||||
mkv->cluster = start_ebml_master(pb, MATROSKA_ID_CLUSTER, 0);
|
||||
put_ebml_uint(pb, MATROSKA_ID_CLUSTERTIMECODE, FFMAX(0, ts));
|
||||
mkv->cluster_pts = FFMAX(0, ts);
|
||||
@ -1094,7 +1094,7 @@ static int mkv_write_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
AVCodecContext *codec = s->streams[pkt->stream_index]->codec;
|
||||
int ret, keyframe = !!(pkt->flags & AV_PKT_FLAG_KEY);
|
||||
int64_t ts = mkv->tracks[pkt->stream_index].write_dts ? pkt->dts : pkt->pts;
|
||||
int cluster_size = url_ftell(pb) - (url_is_streamed(s->pb) ? 0 : mkv->cluster_pos);
|
||||
int cluster_size = avio_tell(pb) - (url_is_streamed(s->pb) ? 0 : mkv->cluster_pos);
|
||||
|
||||
// start a new cluster every 5 MB or 5 sec, or 32k / 1 sec for streaming or
|
||||
// after 4k and on a keyframe
|
||||
@ -1103,7 +1103,7 @@ static int mkv_write_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
|| cluster_size > 5*1024*1024 || ts > mkv->cluster_pts + 5000
|
||||
|| (codec->codec_type == AVMEDIA_TYPE_VIDEO && keyframe && cluster_size > 4*1024))) {
|
||||
av_log(s, AV_LOG_DEBUG, "Starting new cluster at offset %" PRIu64
|
||||
" bytes, pts %" PRIu64 "\n", url_ftell(pb), ts);
|
||||
" bytes, pts %" PRIu64 "\n", avio_tell(pb), ts);
|
||||
end_ebml_master(pb, mkv->cluster);
|
||||
mkv->cluster_pos = 0;
|
||||
if (mkv->dyn_bc)
|
||||
@ -1162,7 +1162,7 @@ static int mkv_write_trailer(AVFormatContext *s)
|
||||
|
||||
// update the duration
|
||||
av_log(s, AV_LOG_DEBUG, "end duration = %" PRIu64 "\n", mkv->duration);
|
||||
currentpos = url_ftell(pb);
|
||||
currentpos = avio_tell(pb);
|
||||
avio_seek(pb, mkv->duration_offset, SEEK_SET);
|
||||
put_ebml_float(pb, MATROSKA_ID_DURATION, mkv->duration);
|
||||
|
||||
|
@ -52,7 +52,7 @@ static void end_tag_be(AVIOContext *pb, int64_t start)
|
||||
{
|
||||
int64_t pos;
|
||||
|
||||
pos = url_ftell(pb);
|
||||
pos = avio_tell(pb);
|
||||
avio_seek(pb, start - 4, SEEK_SET);
|
||||
avio_wb32(pb, (uint32_t)(pos - start));
|
||||
avio_seek(pb, pos, SEEK_SET);
|
||||
@ -84,7 +84,7 @@ static int mmf_write_header(AVFormatContext *s)
|
||||
|
||||
avio_write(pb, "ATR\x00", 4);
|
||||
avio_wb32(pb, 0);
|
||||
mmf->atrpos = url_ftell(pb);
|
||||
mmf->atrpos = avio_tell(pb);
|
||||
avio_w8(pb, 0); /* format type */
|
||||
avio_w8(pb, 0); /* sequence type */
|
||||
avio_w8(pb, (0 << 7) | (1 << 4) | rate); /* (channel << 7) | (format << 4) | rate */
|
||||
@ -94,7 +94,7 @@ static int mmf_write_header(AVFormatContext *s)
|
||||
|
||||
ffio_wfourcc(pb, "Atsq");
|
||||
avio_wb32(pb, 16);
|
||||
mmf->atsqpos = url_ftell(pb);
|
||||
mmf->atsqpos = avio_tell(pb);
|
||||
/* Will be filled on close */
|
||||
avio_write(pb, "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 16);
|
||||
|
||||
@ -139,7 +139,7 @@ static int mmf_write_trailer(AVFormatContext *s)
|
||||
end_tag_be(pb, mmf->atrpos);
|
||||
end_tag_be(pb, 8);
|
||||
|
||||
pos = url_ftell(pb);
|
||||
pos = avio_tell(pb);
|
||||
size = pos - mmf->awapos;
|
||||
|
||||
/* Fill Atsq chunk */
|
||||
|
@ -298,7 +298,7 @@ static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
||||
if (!parse) { /* skip leaf atoms data */
|
||||
avio_seek(pb, a.size, SEEK_CUR);
|
||||
} else {
|
||||
int64_t start_pos = url_ftell(pb);
|
||||
int64_t start_pos = avio_tell(pb);
|
||||
int64_t left;
|
||||
int err = parse(c, pb, a);
|
||||
if (err < 0)
|
||||
@ -306,7 +306,7 @@ static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
||||
if (c->found_moov && c->found_mdat &&
|
||||
(url_is_streamed(pb) || start_pos + a.size == url_fsize(pb)))
|
||||
return 0;
|
||||
left = a.size - url_ftell(pb) + start_pos;
|
||||
left = a.size - avio_tell(pb) + start_pos;
|
||||
if (left > 0) /* skip garbage at atom end */
|
||||
avio_seek(pb, left, SEEK_CUR);
|
||||
}
|
||||
@ -343,7 +343,7 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
||||
for (i = 0; i < sc->drefs_count; i++) {
|
||||
MOVDref *dref = &sc->drefs[i];
|
||||
uint32_t size = avio_rb32(pb);
|
||||
int64_t next = url_ftell(pb) + size - 4;
|
||||
int64_t next = avio_tell(pb) + size - 4;
|
||||
|
||||
if (size < 12)
|
||||
return -1;
|
||||
@ -383,7 +383,7 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
||||
|
||||
avio_seek(pb, 16, SEEK_CUR);
|
||||
|
||||
for (type = 0; type != -1 && url_ftell(pb) < next; ) {
|
||||
for (type = 0; type != -1 && avio_tell(pb) < next; ) {
|
||||
type = avio_rb16(pb);
|
||||
len = avio_rb16(pb);
|
||||
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)
|
||||
|
||||
static int mov_read_moof(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
||||
{
|
||||
c->fragment.moof_offset = url_ftell(pb) - 8;
|
||||
c->fragment.moof_offset = avio_tell(pb) - 8;
|
||||
av_dlog(c->fc, "moof offset %llx\n", c->fragment.moof_offset);
|
||||
return mov_read_default(c, pb, atom);
|
||||
}
|
||||
@ -925,7 +925,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries)
|
||||
enum CodecID id;
|
||||
int dref_id = 1;
|
||||
MOVAtom a = { AV_RL32("stsd") };
|
||||
int64_t start_pos = url_ftell(pb);
|
||||
int64_t start_pos = avio_tell(pb);
|
||||
int size = avio_rb32(pb); /* size */
|
||||
uint32_t format = avio_rl32(pb); /* data format */
|
||||
|
||||
@ -945,7 +945,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries)
|
||||
* in the MOV demuxer, patch welcome. */
|
||||
multiple_stsd:
|
||||
av_log(c->fc, AV_LOG_WARNING, "multiple fourcc not supported\n");
|
||||
avio_seek(pb, size - (url_ftell(pb) - start_pos), SEEK_CUR);
|
||||
avio_seek(pb, size - (avio_tell(pb) - start_pos), SEEK_CUR);
|
||||
continue;
|
||||
}
|
||||
/* 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)
|
||||
} else if(st->codec->codec_type==AVMEDIA_TYPE_SUBTITLE){
|
||||
// ttxt stsd contains display flags, justification, background
|
||||
// color, fonts, and default styles, so fake an atom to read it
|
||||
MOVAtom fake_atom = { .size = size - (url_ftell(pb) - start_pos) };
|
||||
MOVAtom fake_atom = { .size = size - (avio_tell(pb) - start_pos) };
|
||||
if (format != AV_RL32("mp4s")) // mp4s contains a regular esds atom
|
||||
mov_read_glbl(c, pb, fake_atom);
|
||||
st->codec->codec_id= id;
|
||||
@ -1174,10 +1174,10 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries)
|
||||
st->codec->height = sc->height;
|
||||
} else {
|
||||
/* other codec type, just skip (rtp, mp4s, tmcd ...) */
|
||||
avio_seek(pb, size - (url_ftell(pb) - start_pos), SEEK_CUR);
|
||||
avio_seek(pb, size - (avio_tell(pb) - start_pos), SEEK_CUR);
|
||||
}
|
||||
/* this will read extra atoms at the end (wave, alac, damr, avcC, SMI ...) */
|
||||
a.size = size - (url_ftell(pb) - start_pos);
|
||||
a.size = size - (avio_tell(pb) - start_pos);
|
||||
if (a.size > 8) {
|
||||
if (mov_read_default(c, pb, a) < 0)
|
||||
return -1;
|
||||
@ -2299,7 +2299,7 @@ static void mov_read_chapters(AVFormatContext *s)
|
||||
|
||||
st->discard = AVDISCARD_ALL;
|
||||
sc = st->priv_data;
|
||||
cur_pos = url_ftell(sc->pb);
|
||||
cur_pos = avio_tell(sc->pb);
|
||||
|
||||
for (i = 0; i < st->nb_index_entries; i++) {
|
||||
AVIndexEntry *sample = &st->index_entries[i];
|
||||
@ -2364,7 +2364,7 @@ static int mov_read_header(AVFormatContext *s, AVFormatParameters *ap)
|
||||
av_log(s, AV_LOG_ERROR, "moov atom not found\n");
|
||||
return -1;
|
||||
}
|
||||
av_dlog(mov->fc, "on_parse_exit_offset=%lld\n", url_ftell(pb));
|
||||
av_dlog(mov->fc, "on_parse_exit_offset=%lld\n", avio_tell(pb));
|
||||
|
||||
if (!url_is_streamed(pb) && mov->chapter_track > 0)
|
||||
mov_read_chapters(s);
|
||||
@ -2413,7 +2413,7 @@ static int mov_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
mov_read_default(mov, s->pb, (MOVAtom){ AV_RL32("root"), INT64_MAX }) < 0 ||
|
||||
url_feof(s->pb))
|
||||
return AVERROR_EOF;
|
||||
av_dlog(s, "read fragments, offset 0x%llx\n", url_ftell(s->pb));
|
||||
av_dlog(s, "read fragments, offset 0x%llx\n", avio_tell(s->pb));
|
||||
goto retry;
|
||||
}
|
||||
sc = st->priv_data;
|
||||
|
@ -39,7 +39,7 @@
|
||||
//FIXME support 64 bit variant with wide placeholders
|
||||
static int64_t updateSize(AVIOContext *pb, int64_t pos)
|
||||
{
|
||||
int64_t curpos = url_ftell(pb);
|
||||
int64_t curpos = avio_tell(pb);
|
||||
avio_seek(pb, pos, SEEK_SET);
|
||||
avio_wb32(pb, curpos - pos); /* rewrite size */
|
||||
avio_seek(pb, curpos, SEEK_SET);
|
||||
@ -52,7 +52,7 @@ static int mov_write_stco_tag(AVIOContext *pb, MOVTrack *track)
|
||||
{
|
||||
int i;
|
||||
int mode64 = 0; // use 32 bit size variant if possible
|
||||
int64_t pos = url_ftell(pb);
|
||||
int64_t pos = avio_tell(pb);
|
||||
avio_wb32(pb, 0); /* size */
|
||||
if (pos > UINT32_MAX) {
|
||||
mode64 = 1;
|
||||
@ -76,7 +76,7 @@ static int mov_write_stsz_tag(AVIOContext *pb, MOVTrack *track)
|
||||
int equalChunks = 1;
|
||||
int i, j, entries = 0, tst = -1, oldtst = -1;
|
||||
|
||||
int64_t pos = url_ftell(pb);
|
||||
int64_t pos = avio_tell(pb);
|
||||
avio_wb32(pb, 0); /* size */
|
||||
ffio_wfourcc(pb, "stsz");
|
||||
avio_wb32(pb, 0); /* version & flags */
|
||||
@ -113,11 +113,11 @@ static int mov_write_stsc_tag(AVIOContext *pb, MOVTrack *track)
|
||||
int index = 0, oldval = -1, i;
|
||||
int64_t entryPos, curpos;
|
||||
|
||||
int64_t pos = url_ftell(pb);
|
||||
int64_t pos = avio_tell(pb);
|
||||
avio_wb32(pb, 0); /* size */
|
||||
ffio_wfourcc(pb, "stsc");
|
||||
avio_wb32(pb, 0); // version & flags
|
||||
entryPos = url_ftell(pb);
|
||||
entryPos = avio_tell(pb);
|
||||
avio_wb32(pb, track->entry); // entry count
|
||||
for (i=0; i<track->entry; i++) {
|
||||
if(oldval != track->cluster[i].samplesInChunk)
|
||||
@ -129,7 +129,7 @@ static int mov_write_stsc_tag(AVIOContext *pb, MOVTrack *track)
|
||||
index++;
|
||||
}
|
||||
}
|
||||
curpos = url_ftell(pb);
|
||||
curpos = avio_tell(pb);
|
||||
avio_seek(pb, entryPos, SEEK_SET);
|
||||
avio_wb32(pb, index); // rewrite size
|
||||
avio_seek(pb, curpos, SEEK_SET);
|
||||
@ -142,11 +142,11 @@ static int mov_write_stss_tag(AVIOContext *pb, MOVTrack *track, uint32_t flag)
|
||||
{
|
||||
int64_t curpos, entryPos;
|
||||
int i, index = 0;
|
||||
int64_t pos = url_ftell(pb);
|
||||
int64_t pos = avio_tell(pb);
|
||||
avio_wb32(pb, 0); // size
|
||||
ffio_wfourcc(pb, flag == MOV_SYNC_SAMPLE ? "stss" : "stps");
|
||||
avio_wb32(pb, 0); // version & flags
|
||||
entryPos = url_ftell(pb);
|
||||
entryPos = avio_tell(pb);
|
||||
avio_wb32(pb, track->entry); // entry count
|
||||
for (i=0; i<track->entry; i++) {
|
||||
if (track->cluster[i].flags & flag) {
|
||||
@ -154,7 +154,7 @@ static int mov_write_stss_tag(AVIOContext *pb, MOVTrack *track, uint32_t flag)
|
||||
index++;
|
||||
}
|
||||
}
|
||||
curpos = url_ftell(pb);
|
||||
curpos = avio_tell(pb);
|
||||
avio_seek(pb, entryPos, SEEK_SET);
|
||||
avio_wb32(pb, index); // rewrite size
|
||||
avio_seek(pb, curpos, SEEK_SET);
|
||||
@ -255,7 +255,7 @@ static void putDescr(AVIOContext *pb, int tag, unsigned int size)
|
||||
|
||||
static int mov_write_esds_tag(AVIOContext *pb, MOVTrack *track) // Basic
|
||||
{
|
||||
int64_t pos = url_ftell(pb);
|
||||
int64_t pos = avio_tell(pb);
|
||||
int decoderSpecificInfoLen = track->vosLen ? descrLength(track->vosLen):0;
|
||||
|
||||
avio_wb32(pb, 0); // size
|
||||
@ -317,7 +317,7 @@ static int mov_pcm_le_gt16(enum CodecID codec_id)
|
||||
|
||||
static int mov_write_ms_tag(AVIOContext *pb, MOVTrack *track)
|
||||
{
|
||||
int64_t pos = url_ftell(pb);
|
||||
int64_t pos = avio_tell(pb);
|
||||
avio_wb32(pb, 0);
|
||||
avio_wl32(pb, track->tag); // store it byteswapped
|
||||
track->enc->codec_tag = av_bswap16(track->tag >> 16);
|
||||
@ -327,7 +327,7 @@ static int mov_write_ms_tag(AVIOContext *pb, MOVTrack *track)
|
||||
|
||||
static int mov_write_wave_tag(AVIOContext *pb, MOVTrack *track)
|
||||
{
|
||||
int64_t pos = url_ftell(pb);
|
||||
int64_t pos = avio_tell(pb);
|
||||
|
||||
avio_wb32(pb, 0); /* size */
|
||||
ffio_wfourcc(pb, "wave");
|
||||
@ -400,7 +400,7 @@ static int mov_get_lpcm_flags(enum CodecID codec_id)
|
||||
|
||||
static int mov_write_audio_tag(AVIOContext *pb, MOVTrack *track)
|
||||
{
|
||||
int64_t pos = url_ftell(pb);
|
||||
int64_t pos = avio_tell(pb);
|
||||
int version = 0;
|
||||
uint32_t tag = track->tag;
|
||||
|
||||
@ -518,7 +518,7 @@ static int mov_write_svq3_tag(AVIOContext *pb)
|
||||
|
||||
static int mov_write_avcc_tag(AVIOContext *pb, MOVTrack *track)
|
||||
{
|
||||
int64_t pos = url_ftell(pb);
|
||||
int64_t pos = avio_tell(pb);
|
||||
|
||||
avio_wb32(pb, 0);
|
||||
ffio_wfourcc(pb, "avcC");
|
||||
@ -764,7 +764,7 @@ static int mov_write_uuid_tag_ipod(AVIOContext *pb)
|
||||
|
||||
static int mov_write_subtitle_tag(AVIOContext *pb, MOVTrack *track)
|
||||
{
|
||||
int64_t pos = url_ftell(pb);
|
||||
int64_t pos = avio_tell(pb);
|
||||
avio_wb32(pb, 0); /* size */
|
||||
avio_wl32(pb, track->tag); // store it byteswapped
|
||||
avio_wb32(pb, 0); /* Reserved */
|
||||
@ -792,7 +792,7 @@ static int mov_write_pasp_tag(AVIOContext *pb, MOVTrack *track)
|
||||
|
||||
static int mov_write_video_tag(AVIOContext *pb, MOVTrack *track)
|
||||
{
|
||||
int64_t pos = url_ftell(pb);
|
||||
int64_t pos = avio_tell(pb);
|
||||
char compressor_name[32];
|
||||
|
||||
avio_wb32(pb, 0); /* size */
|
||||
@ -861,7 +861,7 @@ static int mov_write_video_tag(AVIOContext *pb, MOVTrack *track)
|
||||
|
||||
static int mov_write_rtp_tag(AVIOContext *pb, MOVTrack *track)
|
||||
{
|
||||
int64_t pos = url_ftell(pb);
|
||||
int64_t pos = avio_tell(pb);
|
||||
avio_wb32(pb, 0); /* size */
|
||||
ffio_wfourcc(pb, "rtp ");
|
||||
avio_wb32(pb, 0); /* Reserved */
|
||||
@ -881,7 +881,7 @@ static int mov_write_rtp_tag(AVIOContext *pb, MOVTrack *track)
|
||||
|
||||
static int mov_write_stsd_tag(AVIOContext *pb, MOVTrack *track)
|
||||
{
|
||||
int64_t pos = url_ftell(pb);
|
||||
int64_t pos = avio_tell(pb);
|
||||
avio_wb32(pb, 0); /* size */
|
||||
ffio_wfourcc(pb, "stsd");
|
||||
avio_wb32(pb, 0); /* version & flags */
|
||||
@ -988,7 +988,7 @@ static int mov_write_dref_tag(AVIOContext *pb)
|
||||
|
||||
static int mov_write_stbl_tag(AVIOContext *pb, MOVTrack *track)
|
||||
{
|
||||
int64_t pos = url_ftell(pb);
|
||||
int64_t pos = avio_tell(pb);
|
||||
avio_wb32(pb, 0); /* size */
|
||||
ffio_wfourcc(pb, "stbl");
|
||||
mov_write_stsd_tag(pb, track);
|
||||
@ -1010,7 +1010,7 @@ static int mov_write_stbl_tag(AVIOContext *pb, MOVTrack *track)
|
||||
|
||||
static int mov_write_dinf_tag(AVIOContext *pb)
|
||||
{
|
||||
int64_t pos = url_ftell(pb);
|
||||
int64_t pos = avio_tell(pb);
|
||||
avio_wb32(pb, 0); /* size */
|
||||
ffio_wfourcc(pb, "dinf");
|
||||
mov_write_dref_tag(pb);
|
||||
@ -1063,7 +1063,7 @@ static int mov_write_vmhd_tag(AVIOContext *pb)
|
||||
static int mov_write_hdlr_tag(AVIOContext *pb, MOVTrack *track)
|
||||
{
|
||||
const char *hdlr, *descr = NULL, *hdlr_type = NULL;
|
||||
int64_t pos = url_ftell(pb);
|
||||
int64_t pos = avio_tell(pb);
|
||||
|
||||
if (!track) { /* no media --> data handler */
|
||||
hdlr = "dhlr";
|
||||
@ -1120,7 +1120,7 @@ static int mov_write_hmhd_tag(AVIOContext *pb)
|
||||
|
||||
static int mov_write_minf_tag(AVIOContext *pb, MOVTrack *track)
|
||||
{
|
||||
int64_t pos = url_ftell(pb);
|
||||
int64_t pos = avio_tell(pb);
|
||||
avio_wb32(pb, 0); /* size */
|
||||
ffio_wfourcc(pb, "minf");
|
||||
if(track->enc->codec_type == AVMEDIA_TYPE_VIDEO)
|
||||
@ -1172,7 +1172,7 @@ static int mov_write_mdhd_tag(AVIOContext *pb, MOVTrack *track)
|
||||
|
||||
static int mov_write_mdia_tag(AVIOContext *pb, MOVTrack *track)
|
||||
{
|
||||
int64_t pos = url_ftell(pb);
|
||||
int64_t pos = avio_tell(pb);
|
||||
avio_wb32(pb, 0); /* size */
|
||||
ffio_wfourcc(pb, "mdia");
|
||||
mov_write_mdhd_tag(pb, track);
|
||||
@ -1249,7 +1249,7 @@ static int mov_write_tapt_tag(AVIOContext *pb, MOVTrack *track)
|
||||
int32_t width = av_rescale(track->enc->sample_aspect_ratio.num, track->enc->width,
|
||||
track->enc->sample_aspect_ratio.den);
|
||||
|
||||
int64_t pos = url_ftell(pb);
|
||||
int64_t pos = avio_tell(pb);
|
||||
|
||||
avio_wb32(pb, 0); /* size */
|
||||
ffio_wfourcc(pb, "tapt");
|
||||
@ -1338,7 +1338,7 @@ static int mov_write_udta_sdp(AVIOContext *pb, AVCodecContext *ctx, int index)
|
||||
|
||||
static int mov_write_trak_tag(AVIOContext *pb, MOVTrack *track, AVStream *st)
|
||||
{
|
||||
int64_t pos = url_ftell(pb);
|
||||
int64_t pos = avio_tell(pb);
|
||||
avio_wb32(pb, 0); /* size */
|
||||
ffio_wfourcc(pb, "trak");
|
||||
mov_write_tkhd_tag(pb, track, st);
|
||||
@ -1475,7 +1475,7 @@ static int mov_write_string_data_tag(AVIOContext *pb, const char *data, int lang
|
||||
static int mov_write_string_tag(AVIOContext *pb, const char *name, const char *value, int lang, int long_style){
|
||||
int size = 0;
|
||||
if (value && value[0]) {
|
||||
int64_t pos = url_ftell(pb);
|
||||
int64_t pos = avio_tell(pb);
|
||||
avio_wb32(pb, 0); /* size */
|
||||
ffio_wfourcc(pb, name);
|
||||
mov_write_string_data_tag(pb, value, lang, long_style);
|
||||
@ -1534,7 +1534,7 @@ static int mov_write_trkn_tag(AVIOContext *pb, MOVMuxContext *mov,
|
||||
static int mov_write_ilst_tag(AVIOContext *pb, MOVMuxContext *mov,
|
||||
AVFormatContext *s)
|
||||
{
|
||||
int64_t pos = url_ftell(pb);
|
||||
int64_t pos = avio_tell(pb);
|
||||
avio_wb32(pb, 0); /* size */
|
||||
ffio_wfourcc(pb, "ilst");
|
||||
mov_write_string_metadata(s, pb, "\251nam", "title" , 1);
|
||||
@ -1563,7 +1563,7 @@ static int mov_write_meta_tag(AVIOContext *pb, MOVMuxContext *mov,
|
||||
AVFormatContext *s)
|
||||
{
|
||||
int size = 0;
|
||||
int64_t pos = url_ftell(pb);
|
||||
int64_t pos = avio_tell(pb);
|
||||
avio_wb32(pb, 0); /* size */
|
||||
ffio_wfourcc(pb, "meta");
|
||||
avio_wb32(pb, 0);
|
||||
@ -1603,7 +1603,7 @@ static uint16_t language_code(const char *str)
|
||||
static int mov_write_3gp_udta_tag(AVIOContext *pb, AVFormatContext *s,
|
||||
const char *tag, const char *str)
|
||||
{
|
||||
int64_t pos = url_ftell(pb);
|
||||
int64_t pos = avio_tell(pb);
|
||||
AVMetadataTag *t = av_metadata_get(s->metadata, str, NULL, 0);
|
||||
if (!t || !utf8len(t->value))
|
||||
return 0;
|
||||
@ -1624,7 +1624,7 @@ static int mov_write_3gp_udta_tag(AVIOContext *pb, AVFormatContext *s,
|
||||
|
||||
static int mov_write_chpl_tag(AVIOContext *pb, AVFormatContext *s)
|
||||
{
|
||||
int64_t pos = url_ftell(pb);
|
||||
int64_t pos = avio_tell(pb);
|
||||
int i, nb_chapters = FFMIN(s->nb_chapters, 255);
|
||||
|
||||
avio_wb32(pb, 0); // size
|
||||
@ -1720,7 +1720,7 @@ static int mov_write_uuidusmt_tag(AVIOContext *pb, AVFormatContext *s)
|
||||
int64_t pos, pos2;
|
||||
|
||||
if (title) {
|
||||
pos = url_ftell(pb);
|
||||
pos = avio_tell(pb);
|
||||
avio_wb32(pb, 0); /* size placeholder*/
|
||||
ffio_wfourcc(pb, "uuid");
|
||||
ffio_wfourcc(pb, "USMT");
|
||||
@ -1728,7 +1728,7 @@ static int mov_write_uuidusmt_tag(AVIOContext *pb, AVFormatContext *s)
|
||||
avio_wb32(pb, 0xbb88695c);
|
||||
avio_wb32(pb, 0xfac9c740);
|
||||
|
||||
pos2 = url_ftell(pb);
|
||||
pos2 = avio_tell(pb);
|
||||
avio_wb32(pb, 0); /* size placeholder*/
|
||||
ffio_wfourcc(pb, "MTDT");
|
||||
avio_wb16(pb, 4);
|
||||
@ -1756,7 +1756,7 @@ static int mov_write_moov_tag(AVIOContext *pb, MOVMuxContext *mov,
|
||||
AVFormatContext *s)
|
||||
{
|
||||
int i;
|
||||
int64_t pos = url_ftell(pb);
|
||||
int64_t pos = avio_tell(pb);
|
||||
avio_wb32(pb, 0); /* size placeholder*/
|
||||
ffio_wfourcc(pb, "moov");
|
||||
|
||||
@ -1801,7 +1801,7 @@ static int mov_write_mdat_tag(AVIOContext *pb, MOVMuxContext *mov)
|
||||
avio_wb32(pb, 8); // placeholder for extended size field (64 bit)
|
||||
ffio_wfourcc(pb, mov->mode == MODE_MOV ? "wide" : "free");
|
||||
|
||||
mov->mdat_pos = url_ftell(pb);
|
||||
mov->mdat_pos = avio_tell(pb);
|
||||
avio_wb32(pb, 0); /* size placeholder*/
|
||||
ffio_wfourcc(pb, "mdat");
|
||||
return 0;
|
||||
@ -1811,7 +1811,7 @@ static int mov_write_mdat_tag(AVIOContext *pb, MOVMuxContext *mov)
|
||||
static int mov_write_ftyp_tag(AVIOContext *pb, AVFormatContext *s)
|
||||
{
|
||||
MOVMuxContext *mov = s->priv_data;
|
||||
int64_t pos = url_ftell(pb);
|
||||
int64_t pos = avio_tell(pb);
|
||||
int has_h264 = 0, has_video = 0;
|
||||
int minor = 0x200;
|
||||
int i;
|
||||
@ -2011,7 +2011,7 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
return -1;
|
||||
}
|
||||
|
||||
trk->cluster[trk->entry].pos = url_ftell(pb) - size;
|
||||
trk->cluster[trk->entry].pos = avio_tell(pb) - size;
|
||||
trk->cluster[trk->entry].samplesInChunk = samplesInChunk;
|
||||
trk->cluster[trk->entry].size = size;
|
||||
trk->cluster[trk->entry].entries = samplesInChunk;
|
||||
@ -2242,7 +2242,7 @@ static int mov_write_trailer(AVFormatContext *s)
|
||||
int res = 0;
|
||||
int i;
|
||||
|
||||
int64_t moov_pos = url_ftell(pb);
|
||||
int64_t moov_pos = avio_tell(pb);
|
||||
|
||||
/* Write size of mdat tag */
|
||||
if (mov->mdat_size+8 <= UINT32_MAX) {
|
||||
|
@ -316,7 +316,7 @@ static int write_hint_packets(AVIOContext *out, const uint8_t *data,
|
||||
int64_t count_pos, entries_pos;
|
||||
int count = 0, entries;
|
||||
|
||||
count_pos = url_ftell(out);
|
||||
count_pos = avio_tell(out);
|
||||
/* RTPsample header */
|
||||
avio_wb16(out, 0); /* packet count */
|
||||
avio_wb16(out, 0); /* reserved */
|
||||
@ -358,7 +358,7 @@ static int write_hint_packets(AVIOContext *out, const uint8_t *data,
|
||||
avio_write(out, data, 2); /* RTP header */
|
||||
avio_wb16(out, seq); /* RTPsequenceseed */
|
||||
avio_wb16(out, 0); /* reserved + flags */
|
||||
entries_pos = url_ftell(out);
|
||||
entries_pos = avio_tell(out);
|
||||
avio_wb16(out, 0); /* entry count */
|
||||
|
||||
data += 12;
|
||||
@ -371,13 +371,13 @@ static int write_hint_packets(AVIOContext *out, const uint8_t *data,
|
||||
data += packet_len;
|
||||
size -= packet_len;
|
||||
|
||||
curpos = url_ftell(out);
|
||||
curpos = avio_tell(out);
|
||||
avio_seek(out, entries_pos, SEEK_SET);
|
||||
avio_wb16(out, entries);
|
||||
avio_seek(out, curpos, SEEK_SET);
|
||||
}
|
||||
|
||||
curpos = url_ftell(out);
|
||||
curpos = avio_tell(out);
|
||||
avio_seek(out, count_pos, SEEK_SET);
|
||||
avio_wb16(out, count);
|
||||
avio_seek(out, curpos, SEEK_SET);
|
||||
|
@ -147,7 +147,7 @@ static int mp3_read_header(AVFormatContext *s,
|
||||
// lcm of all mp3 sample rates
|
||||
av_set_pts_info(st, 64, 1, 14112000);
|
||||
|
||||
off = url_ftell(s->pb);
|
||||
off = avio_tell(s->pb);
|
||||
|
||||
if (!av_metadata_get(s->metadata, "", NULL, AV_METADATA_IGNORE_SUFFIX))
|
||||
ff_id3v1_read(s);
|
||||
|
@ -211,7 +211,7 @@ static int mp3_write_header(struct AVFormatContext *s)
|
||||
avio_w8(s->pb, 0); /* flags */
|
||||
|
||||
/* reserve space for size */
|
||||
size_pos = url_ftell(s->pb);
|
||||
size_pos = avio_tell(s->pb);
|
||||
avio_wb32(s->pb, 0);
|
||||
|
||||
ff_metadata_conv(&s->metadata, ff_id3v2_34_metadata_conv, NULL);
|
||||
@ -237,7 +237,7 @@ static int mp3_write_header(struct AVFormatContext *s)
|
||||
totlen += ret;
|
||||
}
|
||||
|
||||
cur_pos = url_ftell(s->pb);
|
||||
cur_pos = avio_tell(s->pb);
|
||||
avio_seek(s->pb, size_pos, SEEK_SET);
|
||||
id3v2_put_size(s, totlen);
|
||||
avio_seek(s->pb, cur_pos, SEEK_SET);
|
||||
|
@ -94,7 +94,7 @@ static int mpc_read_header(AVFormatContext *s, AVFormatParameters *ap)
|
||||
|
||||
/* try to read APE tags */
|
||||
if (!url_is_streamed(s->pb)) {
|
||||
int64_t pos = url_ftell(s->pb);
|
||||
int64_t pos = avio_tell(s->pb);
|
||||
ff_ape_parse_tag(s);
|
||||
if (!av_metadata_get(s->metadata, "", NULL, AV_METADATA_IGNORE_SUFFIX))
|
||||
ff_id3v1_read(s);
|
||||
@ -120,7 +120,7 @@ static int mpc_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
c->lastframe = c->curframe;
|
||||
c->curframe++;
|
||||
curbits = c->curbits;
|
||||
pos = url_ftell(s->pb);
|
||||
pos = avio_tell(s->pb);
|
||||
tmp = avio_rl32(s->pb);
|
||||
if(curbits <= 12){
|
||||
size2 = (tmp >> (12 - curbits)) & 0xFFFFF;
|
||||
|
@ -120,10 +120,10 @@ static inline int64_t gb_get_v(GetBitContext *gb)
|
||||
static void mpc8_get_chunk_header(AVIOContext *pb, int *tag, int64_t *size)
|
||||
{
|
||||
int64_t pos;
|
||||
pos = url_ftell(pb);
|
||||
pos = avio_tell(pb);
|
||||
*tag = avio_rl16(pb);
|
||||
*size = ff_get_v(pb);
|
||||
*size -= url_ftell(pb) - pos;
|
||||
*size -= avio_tell(pb) - pos;
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
switch(tag){
|
||||
case TAG_SEEKTBLOFF:
|
||||
pos = url_ftell(pb) + size;
|
||||
pos = avio_tell(pb) + size;
|
||||
off = ff_get_v(pb);
|
||||
mpc8_parse_seektable(s, chunk_pos + off);
|
||||
avio_seek(pb, pos, SEEK_SET);
|
||||
@ -194,14 +194,14 @@ static int mpc8_read_header(AVFormatContext *s, AVFormatParameters *ap)
|
||||
int tag = 0;
|
||||
int64_t size, pos;
|
||||
|
||||
c->header_pos = url_ftell(pb);
|
||||
c->header_pos = avio_tell(pb);
|
||||
if(avio_rl32(pb) != TAG_MPCK){
|
||||
av_log(s, AV_LOG_ERROR, "Not a Musepack8 file\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
while(!url_feof(pb)){
|
||||
pos = url_ftell(pb);
|
||||
pos = avio_tell(pb);
|
||||
mpc8_get_chunk_header(pb, &tag, &size);
|
||||
if(tag == TAG_STREAMHDR)
|
||||
break;
|
||||
@ -211,7 +211,7 @@ static int mpc8_read_header(AVFormatContext *s, AVFormatParameters *ap)
|
||||
av_log(s, AV_LOG_ERROR, "Stream header not found\n");
|
||||
return -1;
|
||||
}
|
||||
pos = url_ftell(pb);
|
||||
pos = avio_tell(pb);
|
||||
avio_seek(pb, 4, SEEK_CUR); //CRC
|
||||
c->ver = avio_r8(pb);
|
||||
if(c->ver != 8){
|
||||
@ -236,7 +236,7 @@ static int mpc8_read_header(AVFormatContext *s, AVFormatParameters *ap)
|
||||
st->codec->sample_rate = mpc8_rate[st->codec->extradata[0] >> 5];
|
||||
av_set_pts_info(st, 32, 1152 << (st->codec->extradata[1]&3)*2, st->codec->sample_rate);
|
||||
st->duration = c->samples / (1152 << (st->codec->extradata[1]&3)*2);
|
||||
size -= url_ftell(pb) - pos;
|
||||
size -= avio_tell(pb) - pos;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -248,7 +248,7 @@ static int mpc8_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
int64_t pos, size;
|
||||
|
||||
while(!url_feof(s->pb)){
|
||||
pos = url_ftell(s->pb);
|
||||
pos = avio_tell(s->pb);
|
||||
mpc8_get_chunk_header(s->pb, &tag, &size);
|
||||
if (size < 0)
|
||||
return -1;
|
||||
|
@ -169,7 +169,7 @@ static int find_prev_start_code(AVIOContext *pb, int *size_ptr)
|
||||
int max_size, start_code;
|
||||
|
||||
max_size = *size_ptr;
|
||||
pos_start = url_ftell(pb);
|
||||
pos_start = avio_tell(pb);
|
||||
|
||||
/* in order to go faster, we fill the buffer */
|
||||
pos = pos_start - 16386;
|
||||
@ -241,7 +241,7 @@ static int mpegps_read_pes_header(AVFormatContext *s,
|
||||
int len, size, startcode, c, flags, header_len;
|
||||
int pes_ext, ext2_len, id_ext, skip;
|
||||
int64_t pts, dts;
|
||||
int64_t last_sync= url_ftell(s->pb);
|
||||
int64_t last_sync= avio_tell(s->pb);
|
||||
|
||||
error_redo:
|
||||
avio_seek(s->pb, last_sync, SEEK_SET);
|
||||
@ -250,8 +250,8 @@ static int mpegps_read_pes_header(AVFormatContext *s,
|
||||
m->header_state = 0xff;
|
||||
size = MAX_SYNC_SIZE;
|
||||
startcode = find_next_start_code(s->pb, &size, &m->header_state);
|
||||
last_sync = url_ftell(s->pb);
|
||||
//printf("startcode=%x pos=0x%"PRIx64"\n", startcode, url_ftell(s->pb));
|
||||
last_sync = avio_tell(s->pb);
|
||||
//printf("startcode=%x pos=0x%"PRIx64"\n", startcode, avio_tell(s->pb));
|
||||
if (startcode < 0){
|
||||
if(url_feof(s->pb))
|
||||
return AVERROR_EOF;
|
||||
@ -295,7 +295,7 @@ static int mpegps_read_pes_header(AVFormatContext *s,
|
||||
(startcode == 0x1bd) || (startcode == 0x1fd)))
|
||||
goto redo;
|
||||
if (ppos) {
|
||||
*ppos = url_ftell(s->pb) - 4;
|
||||
*ppos = avio_tell(s->pb) - 4;
|
||||
}
|
||||
len = avio_rb16(s->pb);
|
||||
pts =
|
||||
|
@ -1265,7 +1265,7 @@ static int handle_packet(MpegTSContext *ts, const uint8_t *packet)
|
||||
if (p >= p_end)
|
||||
return 0;
|
||||
|
||||
pos = url_ftell(ts->stream->pb);
|
||||
pos = avio_tell(ts->stream->pb);
|
||||
ts->pos47= pos % ts->raw_packet_size;
|
||||
|
||||
if (tss->type == MPEGTS_SECTION) {
|
||||
@ -1454,7 +1454,7 @@ static int mpegts_read_header(AVFormatContext *s,
|
||||
}
|
||||
|
||||
/* read the first 1024 bytes to get packet size */
|
||||
pos = url_ftell(pb);
|
||||
pos = avio_tell(pb);
|
||||
len = avio_read(pb, buf, sizeof(buf));
|
||||
if (len != sizeof(buf))
|
||||
goto fail;
|
||||
@ -1552,7 +1552,7 @@ static int mpegts_raw_read_packet(AVFormatContext *s,
|
||||
|
||||
if (av_new_packet(pkt, TS_PACKET_SIZE) < 0)
|
||||
return AVERROR(ENOMEM);
|
||||
pkt->pos= url_ftell(s->pb);
|
||||
pkt->pos= avio_tell(s->pb);
|
||||
ret = read_packet(s, pkt->data, ts->raw_packet_size);
|
||||
if (ret < 0) {
|
||||
av_free_packet(pkt);
|
||||
@ -1562,7 +1562,7 @@ static int mpegts_raw_read_packet(AVFormatContext *s,
|
||||
/* compute exact PCR for each packet */
|
||||
if (parse_pcr(&pcr_h, &pcr_l, pkt->data) == 0) {
|
||||
/* we read the next PCR (XXX: optimize it by using a bigger buffer */
|
||||
pos = url_ftell(s->pb);
|
||||
pos = avio_tell(s->pb);
|
||||
for(i = 0; i < MAX_PACKET_READAHEAD; i++) {
|
||||
avio_seek(s->pb, pos + i * ts->raw_packet_size, SEEK_SET);
|
||||
avio_read(s->pb, pcr_buf, 12);
|
||||
@ -1591,7 +1591,7 @@ static int mpegts_read_packet(AVFormatContext *s,
|
||||
MpegTSContext *ts = s->priv_data;
|
||||
int ret, i;
|
||||
|
||||
if (url_ftell(s->pb) != ts->last_pos) {
|
||||
if (avio_tell(s->pb) != ts->last_pos) {
|
||||
/* seek detected, flush pes buffer */
|
||||
for (i = 0; i < NB_PID_MAX; i++) {
|
||||
if (ts->pids[i] && ts->pids[i]->type == MPEGTS_PES) {
|
||||
@ -1620,7 +1620,7 @@ static int mpegts_read_packet(AVFormatContext *s,
|
||||
}
|
||||
}
|
||||
|
||||
ts->last_pos = url_ftell(s->pb);
|
||||
ts->last_pos = avio_tell(s->pb);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -1771,7 +1771,7 @@ static int read_seek(AVFormatContext *s, int stream_index, int64_t target_ts, in
|
||||
if(av_seek_frame_binary(s, stream_index, target_ts, flags) < 0)
|
||||
return -1;
|
||||
|
||||
pos= url_ftell(s->pb);
|
||||
pos= avio_tell(s->pb);
|
||||
|
||||
for(;;) {
|
||||
avio_seek(s->pb, pos, SEEK_SET);
|
||||
|
@ -595,7 +595,7 @@ static void retransmit_si_info(AVFormatContext *s)
|
||||
|
||||
static int64_t get_pcr(const MpegTSWrite *ts, AVIOContext *pb)
|
||||
{
|
||||
return av_rescale(url_ftell(pb) + 11, 8 * PCR_TIME_BASE, ts->mux_rate) +
|
||||
return av_rescale(avio_tell(pb) + 11, 8 * PCR_TIME_BASE, ts->mux_rate) +
|
||||
ts->first_pcr;
|
||||
}
|
||||
|
||||
|
@ -162,7 +162,7 @@ static int mtv_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
int i;
|
||||
#endif
|
||||
|
||||
if((url_ftell(pb) - s->data_offset + mtv->img_segment_size) % mtv->full_segment_size)
|
||||
if((avio_tell(pb) - s->data_offset + mtv->img_segment_size) % mtv->full_segment_size)
|
||||
{
|
||||
avio_seek(pb, MTV_AUDIO_PADDING_SIZE, SEEK_CUR);
|
||||
|
||||
|
@ -193,7 +193,7 @@ static int klv_read_packet(KLVPacket *klv, AVIOContext *pb)
|
||||
{
|
||||
if (!mxf_read_sync(pb, mxf_klv_key, 4))
|
||||
return -1;
|
||||
klv->offset = url_ftell(pb) - 4;
|
||||
klv->offset = avio_tell(pb) - 4;
|
||||
memcpy(klv->key, mxf_klv_key, 4);
|
||||
avio_read(pb, klv->key + 4, 12);
|
||||
klv->length = klv_decode_ber_length(pb);
|
||||
@ -247,7 +247,7 @@ static int mxf_decrypt_triplet(AVFormatContext *s, AVPacket *pkt, KLVPacket *klv
|
||||
static const uint8_t checkv[16] = {0x43, 0x48, 0x55, 0x4b, 0x43, 0x48, 0x55, 0x4b, 0x43, 0x48, 0x55, 0x4b, 0x43, 0x48, 0x55, 0x4b};
|
||||
MXFContext *mxf = s->priv_data;
|
||||
AVIOContext *pb = s->pb;
|
||||
int64_t end = url_ftell(pb) + klv->length;
|
||||
int64_t end = avio_tell(pb) + klv->length;
|
||||
uint64_t size;
|
||||
uint64_t orig_size;
|
||||
uint64_t plaintext_size;
|
||||
@ -297,7 +297,7 @@ static int mxf_decrypt_triplet(AVFormatContext *s, AVPacket *pkt, KLVPacket *klv
|
||||
&pkt->data[plaintext_size], size >> 4, ivec, 1);
|
||||
pkt->size = orig_size;
|
||||
pkt->stream_index = index;
|
||||
avio_seek(pb, end - url_ftell(pb), SEEK_CUR);
|
||||
avio_seek(pb, end - avio_tell(pb), SEEK_CUR);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -866,14 +866,14 @@ static int mxf_read_local_tags(MXFContext *mxf, KLVPacket *klv, MXFMetadataReadF
|
||||
{
|
||||
AVIOContext *pb = mxf->fc->pb;
|
||||
MXFMetadataSet *ctx = ctx_size ? av_mallocz(ctx_size) : mxf;
|
||||
uint64_t klv_end = url_ftell(pb) + klv->length;
|
||||
uint64_t klv_end = avio_tell(pb) + klv->length;
|
||||
|
||||
if (!ctx)
|
||||
return -1;
|
||||
while (url_ftell(pb) + 4 < klv_end) {
|
||||
while (avio_tell(pb) + 4 < klv_end) {
|
||||
int tag = avio_rb16(pb);
|
||||
int size = avio_rb16(pb); /* KLV specified by 0x53 */
|
||||
uint64_t next = url_ftell(pb) + size;
|
||||
uint64_t next = avio_tell(pb) + size;
|
||||
UID uid = {0};
|
||||
|
||||
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)
|
||||
|
||||
static void mxf_write_klv_fill(AVFormatContext *s)
|
||||
{
|
||||
unsigned pad = klv_fill_size(url_ftell(s->pb));
|
||||
unsigned pad = klv_fill_size(avio_tell(s->pb));
|
||||
if (pad) {
|
||||
avio_write(s->pb, klv_fill_key, 16);
|
||||
pad -= 16 + 4;
|
||||
klv_encode_ber4_length(s->pb, pad);
|
||||
for (; pad; pad--)
|
||||
avio_w8(s->pb, 0);
|
||||
assert(!(url_ftell(s->pb) & (KAG_SIZE-1)));
|
||||
assert(!(avio_tell(s->pb) & (KAG_SIZE-1)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1190,7 +1190,7 @@ static void mxf_write_partition(AVFormatContext *s, int bodysid,
|
||||
AVIOContext *pb = s->pb;
|
||||
int64_t header_byte_count_offset;
|
||||
unsigned index_byte_count = 0;
|
||||
uint64_t partition_offset = url_ftell(pb);
|
||||
uint64_t partition_offset = avio_tell(pb);
|
||||
|
||||
if (!mxf->edit_unit_byte_count && mxf->edit_units_count)
|
||||
index_byte_count = 85 + 12+(s->nb_streams+1)*6 +
|
||||
@ -1233,7 +1233,7 @@ static void mxf_write_partition(AVFormatContext *s, int bodysid,
|
||||
avio_wb64(pb, mxf->footer_partition_offset); // footerPartition
|
||||
|
||||
// set offset
|
||||
header_byte_count_offset = url_ftell(pb);
|
||||
header_byte_count_offset = avio_tell(pb);
|
||||
avio_wb64(pb, 0); // headerByteCount, update later
|
||||
|
||||
// indexTable
|
||||
@ -1260,10 +1260,10 @@ static void mxf_write_partition(AVFormatContext *s, int bodysid,
|
||||
unsigned header_byte_count;
|
||||
|
||||
mxf_write_klv_fill(s);
|
||||
start = url_ftell(s->pb);
|
||||
start = avio_tell(s->pb);
|
||||
mxf_write_primer_pack(s);
|
||||
mxf_write_header_metadata_sets(s);
|
||||
pos = url_ftell(s->pb);
|
||||
pos = avio_tell(s->pb);
|
||||
header_byte_count = pos - start + klv_fill_size(pos);
|
||||
|
||||
// update header_byte_count
|
||||
@ -1617,7 +1617,7 @@ static void mxf_write_d10_video_packet(AVFormatContext *s, AVStream *st, AVPacke
|
||||
klv_encode_ber4_length(s->pb, pad);
|
||||
for (; pad; pad--)
|
||||
avio_w8(s->pb, 0);
|
||||
assert(!(url_ftell(s->pb) & (KAG_SIZE-1)));
|
||||
assert(!(avio_tell(s->pb) & (KAG_SIZE-1)));
|
||||
} else {
|
||||
av_log(s, AV_LOG_WARNING, "cannot fill d-10 video packet\n");
|
||||
for (; pad > 0; pad--)
|
||||
@ -1740,7 +1740,7 @@ static void mxf_write_random_index_pack(AVFormatContext *s)
|
||||
{
|
||||
MXFContext *mxf = s->priv_data;
|
||||
AVIOContext *pb = s->pb;
|
||||
uint64_t pos = url_ftell(pb);
|
||||
uint64_t pos = avio_tell(pb);
|
||||
int i;
|
||||
|
||||
avio_write(pb, random_index_pack_key, 16);
|
||||
@ -1760,7 +1760,7 @@ static void mxf_write_random_index_pack(AVFormatContext *s)
|
||||
avio_wb32(pb, 0); // BodySID of footer partition
|
||||
avio_wb64(pb, mxf->footer_partition_offset);
|
||||
|
||||
avio_wb32(pb, url_ftell(pb) - pos + 4);
|
||||
avio_wb32(pb, avio_tell(pb) - pos + 4);
|
||||
}
|
||||
|
||||
static int mxf_write_footer(AVFormatContext *s)
|
||||
@ -1771,7 +1771,7 @@ static int mxf_write_footer(AVFormatContext *s)
|
||||
mxf->duration = mxf->last_indexed_edit_unit + mxf->edit_units_count;
|
||||
|
||||
mxf_write_klv_fill(s);
|
||||
mxf->footer_partition_offset = url_ftell(pb);
|
||||
mxf->footer_partition_offset = avio_tell(pb);
|
||||
if (mxf->edit_unit_byte_count) { // no need to repeat index
|
||||
mxf_write_partition(s, 0, 0, footer_partition_key, 0);
|
||||
} else {
|
||||
|
@ -225,7 +225,7 @@ static int nsv_resync(AVFormatContext *s)
|
||||
uint32_t v = 0;
|
||||
int i;
|
||||
|
||||
av_dlog(s, "%s(), offset = %"PRId64", state = %d\n", __FUNCTION__, url_ftell(pb), nsv->state);
|
||||
av_dlog(s, "%s(), offset = %"PRId64", state = %d\n", __FUNCTION__, avio_tell(pb), nsv->state);
|
||||
|
||||
//nsv->state = NSV_UNSYNC;
|
||||
|
||||
@ -299,7 +299,7 @@ static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap)
|
||||
if (url_feof(pb))
|
||||
return -1;
|
||||
|
||||
av_dlog(s, "NSV got header; filepos %"PRId64"\n", url_ftell(pb));
|
||||
av_dlog(s, "NSV got header; filepos %"PRId64"\n", avio_tell(pb));
|
||||
|
||||
if (strings_size > 0) {
|
||||
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)
|
||||
if (url_feof(pb))
|
||||
return -1;
|
||||
|
||||
av_dlog(s, "NSV got infos; filepos %"PRId64"\n", url_ftell(pb));
|
||||
av_dlog(s, "NSV got infos; filepos %"PRId64"\n", avio_tell(pb));
|
||||
|
||||
if (table_entries_used > 0) {
|
||||
int i;
|
||||
@ -355,7 +355,7 @@ static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap)
|
||||
}
|
||||
}
|
||||
|
||||
av_dlog(s, "NSV got index; filepos %"PRId64"\n", url_ftell(pb));
|
||||
av_dlog(s, "NSV got index; filepos %"PRId64"\n", avio_tell(pb));
|
||||
|
||||
#ifdef DEBUG_DUMP_INDEX
|
||||
#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
|
||||
static int get_packetheader(NUTContext *nut, AVIOContext *bc, int calculate_checksum, uint64_t startcode)
|
||||
{
|
||||
int64_t size;
|
||||
// start= url_ftell(bc) - 8;
|
||||
// start= avio_tell(bc) - 8;
|
||||
|
||||
startcode= av_be2ne64(startcode);
|
||||
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){
|
||||
for(;;){
|
||||
uint64_t startcode= find_any_startcode(bc, pos);
|
||||
if(startcode == code)
|
||||
return url_ftell(bc) - 8;
|
||||
return avio_tell(bc) - 8;
|
||||
else if(startcode == 0)
|
||||
return -1;
|
||||
pos=-1;
|
||||
@ -176,7 +176,7 @@ static int nut_probe(AVProbeData *p){
|
||||
dst= tmp;
|
||||
|
||||
static int skip_reserved(AVIOContext *bc, int64_t pos){
|
||||
pos -= url_ftell(bc);
|
||||
pos -= avio_tell(bc);
|
||||
if(pos<0){
|
||||
avio_seek(bc, pos, SEEK_CUR);
|
||||
return -1;
|
||||
@ -196,7 +196,7 @@ static int decode_main_header(NUTContext *nut){
|
||||
int64_t tmp_match;
|
||||
|
||||
end= get_packetheader(nut, bc, 1, MAIN_STARTCODE);
|
||||
end += url_ftell(bc);
|
||||
end += avio_tell(bc);
|
||||
|
||||
GET_V(tmp , tmp >=2 && tmp <= 3)
|
||||
GET_V(stream_count , tmp > 0 && tmp <= NUT_MAX_STREAMS)
|
||||
@ -267,7 +267,7 @@ static int decode_main_header(NUTContext *nut){
|
||||
}
|
||||
assert(nut->frame_code['N'].flags == FLAG_INVALID);
|
||||
|
||||
if(end > url_ftell(bc) + 4){
|
||||
if(end > avio_tell(bc) + 4){
|
||||
int rem= 1024;
|
||||
GET_V(nut->header_count, tmp<128U)
|
||||
nut->header_count++;
|
||||
@ -306,7 +306,7 @@ static int decode_stream_header(NUTContext *nut){
|
||||
AVStream *st;
|
||||
|
||||
end= get_packetheader(nut, bc, 1, STREAM_STARTCODE);
|
||||
end += url_ftell(bc);
|
||||
end += avio_tell(bc);
|
||||
|
||||
GET_V(stream_id, tmp < s->nb_streams && !nut->stream[tmp].time_base);
|
||||
stc= &nut->stream[stream_id];
|
||||
@ -409,7 +409,7 @@ static int decode_info_header(NUTContext *nut){
|
||||
AVMetadata **metadata = NULL;
|
||||
|
||||
end= get_packetheader(nut, bc, 1, INFO_STARTCODE);
|
||||
end += url_ftell(bc);
|
||||
end += avio_tell(bc);
|
||||
|
||||
GET_V(stream_id_plus1, tmp <= s->nb_streams)
|
||||
chapter_id = get_s(bc);
|
||||
@ -480,10 +480,10 @@ static int decode_syncpoint(NUTContext *nut, int64_t *ts, int64_t *back_ptr){
|
||||
AVIOContext *bc = s->pb;
|
||||
int64_t end, tmp;
|
||||
|
||||
nut->last_syncpoint_pos= url_ftell(bc)-8;
|
||||
nut->last_syncpoint_pos= avio_tell(bc)-8;
|
||||
|
||||
end= get_packetheader(nut, bc, 1, SYNCPOINT_STARTCODE);
|
||||
end += url_ftell(bc);
|
||||
end += avio_tell(bc);
|
||||
|
||||
tmp= ff_get_v(bc);
|
||||
*back_ptr= nut->last_syncpoint_pos - 16*ff_get_v(bc);
|
||||
@ -521,7 +521,7 @@ static int find_and_decode_index(NUTContext *nut){
|
||||
}
|
||||
|
||||
end= get_packetheader(nut, bc, 1, INDEX_STARTCODE);
|
||||
end += url_ftell(bc);
|
||||
end += avio_tell(bc);
|
||||
|
||||
ff_get_v(bc); //max_pts
|
||||
GET_V(syncpoint_count, tmp < INT_MAX/8 && tmp > 0)
|
||||
@ -635,7 +635,7 @@ static int nut_read_header(AVFormatContext *s, AVFormatParameters *ap)
|
||||
pos=0;
|
||||
for(;;){
|
||||
uint64_t startcode= find_any_startcode(bc, pos);
|
||||
pos= url_ftell(bc);
|
||||
pos= avio_tell(bc);
|
||||
|
||||
if(startcode==0){
|
||||
av_log(s, AV_LOG_ERROR, "EOF before video frames\n");
|
||||
@ -653,7 +653,7 @@ static int nut_read_header(AVFormatContext *s, AVFormatParameters *ap)
|
||||
s->data_offset= pos-8;
|
||||
|
||||
if(!url_is_streamed(bc)){
|
||||
int64_t orig_pos= url_ftell(bc);
|
||||
int64_t orig_pos= avio_tell(bc);
|
||||
find_and_decode_index(nut);
|
||||
avio_seek(bc, orig_pos, SEEK_SET);
|
||||
}
|
||||
@ -671,8 +671,8 @@ static int decode_frame_header(NUTContext *nut, int64_t *pts, int *stream_id, ui
|
||||
int size, flags, size_mul, pts_delta, i, reserved_count;
|
||||
uint64_t tmp;
|
||||
|
||||
if(url_ftell(bc) > nut->last_syncpoint_pos + nut->max_distance){
|
||||
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);
|
||||
if(avio_tell(bc) > nut->last_syncpoint_pos + nut->max_distance){
|
||||
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);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
@ -763,7 +763,7 @@ static int decode_frame(NUTContext *nut, AVPacket *pkt, int frame_code){
|
||||
|
||||
av_new_packet(pkt, size + nut->header_len[header_idx]);
|
||||
memcpy(pkt->data, nut->header[header_idx], nut->header_len[header_idx]);
|
||||
pkt->pos= url_ftell(bc); //FIXME
|
||||
pkt->pos= avio_tell(bc); //FIXME
|
||||
avio_read(bc, pkt->data + nut->header_len[header_idx], size);
|
||||
|
||||
pkt->stream_index = stream_id;
|
||||
@ -782,7 +782,7 @@ static int nut_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
int64_t ts, back_ptr;
|
||||
|
||||
for(;;){
|
||||
int64_t pos= url_ftell(bc);
|
||||
int64_t pos= avio_tell(bc);
|
||||
uint64_t tmp= nut->next_startcode;
|
||||
nut->next_startcode=0;
|
||||
|
||||
|
@ -639,13 +639,13 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt){
|
||||
if(pkt->pts < 0)
|
||||
return -1;
|
||||
|
||||
if(1LL<<(20+3*nut->header_count) <= url_ftell(bc))
|
||||
if(1LL<<(20+3*nut->header_count) <= avio_tell(bc))
|
||||
write_headers(s, bc);
|
||||
|
||||
if(key_frame && !(nus->last_flags & FLAG_KEY))
|
||||
store_sp= 1;
|
||||
|
||||
if(pkt->size + 30/*FIXME check*/ + url_ftell(bc) >= nut->last_syncpoint_pos + nut->max_distance)
|
||||
if(pkt->size + 30/*FIXME check*/ + avio_tell(bc) >= nut->last_syncpoint_pos + nut->max_distance)
|
||||
store_sp= 1;
|
||||
|
||||
//FIXME: Ensure store_sp is 1 in the first place.
|
||||
@ -668,7 +668,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt){
|
||||
sp= av_tree_find(nut->syncpoints, &dummy, (void *) ff_nut_sp_pos_cmp,
|
||||
NULL);
|
||||
|
||||
nut->last_syncpoint_pos= url_ftell(bc);
|
||||
nut->last_syncpoint_pos= avio_tell(bc);
|
||||
ret = url_open_dyn_buf(&dyn_bc);
|
||||
if(ret < 0)
|
||||
return ret;
|
||||
|
@ -197,7 +197,7 @@ static int nuv_packet(AVFormatContext *s, AVPacket *pkt) {
|
||||
int ret, size;
|
||||
while (!url_feof(pb)) {
|
||||
int copyhdrsize = ctx->rtjpg_video ? HDRSIZE : 0;
|
||||
uint64_t pos = url_ftell(pb);
|
||||
uint64_t pos = avio_tell(pb);
|
||||
ret = avio_read(pb, hdr, HDRSIZE);
|
||||
if (ret < HDRSIZE)
|
||||
return ret < 0 ? ret : AVERROR(EIO);
|
||||
|
@ -62,7 +62,7 @@ ogg_save (AVFormatContext * s)
|
||||
struct ogg_state *ost =
|
||||
av_malloc(sizeof (*ost) + (ogg->nstreams-1) * sizeof (*ogg->streams));
|
||||
int i;
|
||||
ost->pos = url_ftell (s->pb);
|
||||
ost->pos = avio_tell (s->pb);
|
||||
ost->curidx = ogg->curidx;
|
||||
ost->next = ogg->state;
|
||||
ost->nstreams = ogg->nstreams;
|
||||
@ -247,7 +247,7 @@ ogg_read_page (AVFormatContext * s, int *str)
|
||||
}
|
||||
|
||||
os = ogg->streams + idx;
|
||||
os->page_pos = url_ftell(bc) - 27;
|
||||
os->page_pos = avio_tell(bc) - 27;
|
||||
|
||||
if(os->psize > 0)
|
||||
ogg_new_buf(ogg, idx);
|
||||
@ -607,7 +607,7 @@ ogg_read_timestamp (AVFormatContext * s, int stream_index, int64_t * pos_arg,
|
||||
avio_seek(bc, *pos_arg, SEEK_SET);
|
||||
ogg_reset(ogg);
|
||||
|
||||
while (url_ftell(bc) < pos_limit && !ogg_packet(s, &i, NULL, NULL, pos_arg)) {
|
||||
while (avio_tell(bc) < pos_limit && !ogg_packet(s, &i, NULL, NULL, pos_arg)) {
|
||||
if (i == stream_index) {
|
||||
pts = ogg_calc_pts(s, i, NULL);
|
||||
if (os->keyframe_seek && !(os->pflags & AV_PKT_FLAG_KEY))
|
||||
|
@ -67,7 +67,7 @@ typedef struct {
|
||||
|
||||
static void ogg_update_checksum(AVFormatContext *s, AVIOContext *pb, int64_t crc_offset)
|
||||
{
|
||||
int64_t pos = url_ftell(pb);
|
||||
int64_t pos = avio_tell(pb);
|
||||
uint32_t checksum = get_checksum(pb);
|
||||
avio_seek(pb, crc_offset, SEEK_SET);
|
||||
avio_wb32(pb, checksum);
|
||||
@ -92,7 +92,7 @@ static int ogg_write_page(AVFormatContext *s, OGGPage *page, int extra_flags)
|
||||
avio_wl64(pb, page->granule);
|
||||
avio_wl32(pb, oggstream->serial_num);
|
||||
avio_wl32(pb, oggstream->page_counter++);
|
||||
crc_offset = url_ftell(pb);
|
||||
crc_offset = avio_tell(pb);
|
||||
avio_wl32(pb, 0); // crc
|
||||
avio_w8(pb, page->segments_count);
|
||||
avio_write(pb, page->segments, page->segments_count);
|
||||
|
@ -186,7 +186,7 @@ static int str_read_packet(AVFormatContext *s,
|
||||
if (av_new_packet(pkt, sector_count*VIDEO_DATA_CHUNK_SIZE))
|
||||
return AVERROR(EIO);
|
||||
|
||||
pkt->pos= url_ftell(pb) - RAW_CD_SECTOR_SIZE;
|
||||
pkt->pos= avio_tell(pb) - RAW_CD_SECTOR_SIZE;
|
||||
pkt->stream_index =
|
||||
str->channels[channel].video_stream_index;
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ static int read_part_of_packet(AVFormatContext *s, int64_t *pts,
|
||||
int64_t pva_pts = AV_NOPTS_VALUE, startpos;
|
||||
|
||||
recover:
|
||||
startpos = url_ftell(pb);
|
||||
startpos = avio_tell(pb);
|
||||
|
||||
syncword = avio_rb16(pb);
|
||||
streamid = avio_r8(pb);
|
||||
@ -190,7 +190,7 @@ static int64_t pva_read_timestamp(struct AVFormatContext *s, int stream_index,
|
||||
continue;
|
||||
}
|
||||
if (streamid - 1 != stream_index || res == AV_NOPTS_VALUE) {
|
||||
*pos = url_ftell(pb) + length;
|
||||
*pos = avio_tell(pb) + length;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
|
@ -165,7 +165,7 @@ static int qcp_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (url_ftell(pb) & 1 && avio_r8(pb))
|
||||
if (avio_tell(pb) & 1 && avio_r8(pb))
|
||||
av_log(s, AV_LOG_WARNING, "Padding should be 0.\n");
|
||||
|
||||
tag = avio_rl32(pb);
|
||||
|
@ -38,7 +38,7 @@ typedef struct {
|
||||
|
||||
static int read_atom(AVFormatContext *s, Atom *atom)
|
||||
{
|
||||
atom->offset = url_ftell(s->pb);
|
||||
atom->offset = avio_tell(s->pb);
|
||||
atom->size = avio_rb32(s->pb);
|
||||
if (atom->size < 8)
|
||||
return -1;
|
||||
@ -175,7 +175,7 @@ static int r3d_read_header(AVFormatContext *s, AVFormatParameters *ap)
|
||||
return -1;
|
||||
}
|
||||
|
||||
s->data_offset = url_ftell(s->pb);
|
||||
s->data_offset = avio_tell(s->pb);
|
||||
av_dlog(s, "data offset %#llx\n", s->data_offset);
|
||||
if (url_is_streamed(s->pb))
|
||||
return 0;
|
||||
@ -210,7 +210,7 @@ static int r3d_read_redv(AVFormatContext *s, AVPacket *pkt, Atom *atom)
|
||||
{
|
||||
AVStream *st = s->streams[0];
|
||||
int tmp, tmp2;
|
||||
uint64_t pos = url_ftell(s->pb);
|
||||
uint64_t pos = avio_tell(s->pb);
|
||||
unsigned dts;
|
||||
int ret;
|
||||
|
||||
@ -241,7 +241,7 @@ static int r3d_read_redv(AVFormatContext *s, AVPacket *pkt, Atom *atom)
|
||||
tmp = avio_rb32(s->pb);
|
||||
av_dlog(s, "metadata len %d\n", tmp);
|
||||
}
|
||||
tmp = atom->size - 8 - (url_ftell(s->pb) - pos);
|
||||
tmp = atom->size - 8 - (avio_tell(s->pb) - pos);
|
||||
if (tmp < 0)
|
||||
return -1;
|
||||
ret = av_get_packet(s->pb, pkt, tmp);
|
||||
@ -264,7 +264,7 @@ static int r3d_read_reda(AVFormatContext *s, AVPacket *pkt, Atom *atom)
|
||||
{
|
||||
AVStream *st = s->streams[1];
|
||||
int tmp, tmp2, samples, size;
|
||||
uint64_t pos = url_ftell(s->pb);
|
||||
uint64_t pos = avio_tell(s->pb);
|
||||
unsigned dts;
|
||||
int ret;
|
||||
|
||||
@ -287,7 +287,7 @@ static int r3d_read_reda(AVFormatContext *s, AVPacket *pkt, Atom *atom)
|
||||
tmp = avio_rb32(s->pb); // unknown
|
||||
av_dlog(s, "unknown %d\n", tmp);
|
||||
|
||||
size = atom->size - 8 - (url_ftell(s->pb) - pos);
|
||||
size = atom->size - 8 - (avio_tell(s->pb) - pos);
|
||||
if (size < 0)
|
||||
return -1;
|
||||
ret = av_get_packet(s->pb, pkt, size);
|
||||
|
@ -80,7 +80,7 @@ int ff_raw_read_partial_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
if (av_new_packet(pkt, size) < 0)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
pkt->pos= url_ftell(s->pb);
|
||||
pkt->pos= avio_tell(s->pb);
|
||||
pkt->stream_index = 0;
|
||||
ret = ffio_read_partial(s->pb, pkt->data, size);
|
||||
if (ret < 0) {
|
||||
|
@ -305,7 +305,7 @@ rdt_parse_packet (AVFormatContext *ctx, PayloadContext *rdt, AVStream *st,
|
||||
flags = (flags & RTP_FLAG_KEY) ? 2 : 0;
|
||||
res = ff_rm_parse_packet (rdt->rmctx, &pb, st, rdt->rmst[st->index], len, pkt,
|
||||
&seq, flags, *timestamp);
|
||||
pos = url_ftell(&pb);
|
||||
pos = avio_tell(&pb);
|
||||
if (res < 0)
|
||||
return res;
|
||||
if (res > 0) {
|
||||
|
@ -324,14 +324,14 @@ int64_t ff_start_tag(AVIOContext *pb, const char *tag)
|
||||
{
|
||||
ffio_wfourcc(pb, tag);
|
||||
avio_wl32(pb, 0);
|
||||
return url_ftell(pb);
|
||||
return avio_tell(pb);
|
||||
}
|
||||
|
||||
void ff_end_tag(AVIOContext *pb, int64_t start)
|
||||
{
|
||||
int64_t pos;
|
||||
|
||||
pos = url_ftell(pb);
|
||||
pos = avio_tell(pb);
|
||||
avio_seek(pb, start - 4, SEEK_SET);
|
||||
avio_wl32(pb, (uint32_t)(pos - start));
|
||||
avio_seek(pb, pos, SEEK_SET);
|
||||
|
@ -131,17 +131,17 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb,
|
||||
version = avio_rb16(pb); /* version */
|
||||
if (version == 3) {
|
||||
int header_size = avio_rb16(pb);
|
||||
int64_t startpos = url_ftell(pb);
|
||||
int64_t startpos = avio_tell(pb);
|
||||
avio_seek(pb, 14, SEEK_CUR);
|
||||
rm_read_metadata(s, 0);
|
||||
if ((startpos + header_size) >= url_ftell(pb) + 2) {
|
||||
if ((startpos + header_size) >= avio_tell(pb) + 2) {
|
||||
// fourcc (should always be "lpcJ")
|
||||
avio_r8(pb);
|
||||
get_str8(pb, buf, sizeof(buf));
|
||||
}
|
||||
// Skip extra header crap (this should never happen)
|
||||
if ((startpos + header_size) > url_ftell(pb))
|
||||
avio_seek(pb, header_size + startpos - url_ftell(pb), SEEK_CUR);
|
||||
if ((startpos + header_size) > avio_tell(pb))
|
||||
avio_seek(pb, header_size + startpos - avio_tell(pb), SEEK_CUR);
|
||||
st->codec->sample_rate = 8000;
|
||||
st->codec->channels = 1;
|
||||
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
|
||||
@ -273,7 +273,7 @@ ff_rm_read_mdpr_codecdata (AVFormatContext *s, AVIOContext *pb,
|
||||
int ret;
|
||||
|
||||
av_set_pts_info(st, 64, 1, 1000);
|
||||
codec_pos = url_ftell(pb);
|
||||
codec_pos = avio_tell(pb);
|
||||
v = avio_rb32(pb);
|
||||
if (v == MKTAG(0xfd, 'a', 'r', '.')) {
|
||||
/* ra type header */
|
||||
@ -301,7 +301,7 @@ ff_rm_read_mdpr_codecdata (AVFormatContext *s, AVIOContext *pb,
|
||||
fps2= avio_rb16(pb);
|
||||
avio_rb16(pb);
|
||||
|
||||
if ((ret = rm_read_extradata(pb, st->codec, codec_data_size - (url_ftell(pb) - codec_pos))) < 0)
|
||||
if ((ret = rm_read_extradata(pb, st->codec, codec_data_size - (avio_tell(pb) - codec_pos))) < 0)
|
||||
return ret;
|
||||
|
||||
// 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,
|
||||
|
||||
skip:
|
||||
/* skip codec info */
|
||||
size = url_ftell(pb) - codec_pos;
|
||||
size = avio_tell(pb) - codec_pos;
|
||||
avio_seek(pb, codec_data_size - size, SEEK_CUR);
|
||||
|
||||
return 0;
|
||||
@ -362,7 +362,7 @@ static int rm_read_index(AVFormatContext *s)
|
||||
}
|
||||
|
||||
skip:
|
||||
if (next_off && url_ftell(pb) != next_off &&
|
||||
if (next_off && avio_tell(pb) != next_off &&
|
||||
avio_seek(pb, next_off, SEEK_SET) < 0)
|
||||
return -1;
|
||||
} while (next_off);
|
||||
@ -480,7 +480,7 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap)
|
||||
avio_rb32(pb); /* next data header */
|
||||
|
||||
if (!data_off)
|
||||
data_off = url_ftell(pb) - 18;
|
||||
data_off = avio_tell(pb) - 18;
|
||||
if (indx_off && !url_is_streamed(pb) && !(s->flags & AVFMT_FLAG_IGNIDX) &&
|
||||
avio_seek(pb, indx_off, SEEK_SET) >= 0) {
|
||||
rm_read_index(s);
|
||||
@ -517,7 +517,7 @@ static int sync(AVFormatContext *s, int64_t *timestamp, int *flags, int *stream_
|
||||
|
||||
while(!url_feof(pb)){
|
||||
int len, num, i;
|
||||
*pos= url_ftell(pb) - 3;
|
||||
*pos= avio_tell(pb) - 3;
|
||||
if(rm->remaining_len > 0){
|
||||
num= rm->current_stream;
|
||||
len= rm->remaining_len;
|
||||
@ -624,7 +624,7 @@ static int rm_assemble_video_frame(AVFormatContext *s, AVIOContext *pb,
|
||||
vst->videobufpos = 8*vst->slices + 1;
|
||||
vst->cur_slice = 0;
|
||||
vst->curpic_num = pic_num;
|
||||
vst->pktpos = url_ftell(pb);
|
||||
vst->pktpos = avio_tell(pb);
|
||||
}
|
||||
if(type == 2)
|
||||
len = FFMIN(len, pos);
|
||||
@ -841,7 +841,7 @@ static int rm_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
len = !ast->audio_framesize ? RAW_PACKET_SIZE :
|
||||
ast->coded_framesize * ast->sub_packet_h / 2;
|
||||
flags = (seq++ == 1) ? 2 : 0;
|
||||
pos = url_ftell(s->pb);
|
||||
pos = avio_tell(s->pb);
|
||||
} else {
|
||||
len=sync(s, ×tamp, &flags, &i, &pos);
|
||||
if (len > 0)
|
||||
|
@ -77,7 +77,7 @@ static int rso_write_trailer(AVFormatContext *s)
|
||||
int64_t file_size;
|
||||
uint16_t coded_file_size;
|
||||
|
||||
file_size = url_ftell(pb);
|
||||
file_size = avio_tell(pb);
|
||||
|
||||
if (file_size < 0)
|
||||
return file_size;
|
||||
|
@ -114,7 +114,7 @@ int ff_wms_parse_sdp_a_line(AVFormatContext *s, const char *p)
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
av_metadata_copy(&s->metadata, rt->asf_ctx->metadata, 0);
|
||||
rt->asf_pb_pos = url_ftell(&pb);
|
||||
rt->asf_pb_pos = avio_tell(&pb);
|
||||
av_free(buf);
|
||||
rt->asf_ctx->pb = NULL;
|
||||
}
|
||||
@ -179,8 +179,8 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf,
|
||||
|
||||
ffio_init_context(pb, buf, len, 0, NULL, NULL, NULL, NULL);
|
||||
|
||||
while (url_ftell(pb) + 4 < len) {
|
||||
int start_off = url_ftell(pb);
|
||||
while (avio_tell(pb) + 4 < len) {
|
||||
int start_off = avio_tell(pb);
|
||||
|
||||
mflags = avio_r8(pb);
|
||||
if (mflags & 0x80)
|
||||
@ -192,7 +192,7 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf,
|
||||
avio_seek(pb, 4, SEEK_CUR);
|
||||
if (mflags & 0x8) /**< has location ID */
|
||||
avio_seek(pb, 4, SEEK_CUR);
|
||||
off = url_ftell(pb);
|
||||
off = avio_tell(pb);
|
||||
|
||||
if (!(mflags & 0x40)) {
|
||||
/**
|
||||
@ -201,7 +201,7 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf,
|
||||
* ASF packet. This is used to spread one ASF packet over
|
||||
* multiple RTP packets.
|
||||
*/
|
||||
if (asf->pktbuf && len_off != url_ftell(asf->pktbuf)) {
|
||||
if (asf->pktbuf && len_off != avio_tell(asf->pktbuf)) {
|
||||
uint8_t *p;
|
||||
url_close_dyn_buf(asf->pktbuf, &p);
|
||||
asf->pktbuf = NULL;
|
||||
@ -248,7 +248,7 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf,
|
||||
int i;
|
||||
|
||||
res = av_read_packet(rt->asf_ctx, pkt);
|
||||
rt->asf_pb_pos = url_ftell(pb);
|
||||
rt->asf_pb_pos = avio_tell(pb);
|
||||
if (res != 0)
|
||||
break;
|
||||
for (i = 0; i < s->nb_streams; i++) {
|
||||
|
@ -115,10 +115,10 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt,
|
||||
if (pos + data_len > len)
|
||||
return AVERROR_INVALIDDATA;
|
||||
/* TLVs */
|
||||
while (url_ftell(&pb) + 4 < pos + data_len) {
|
||||
while (avio_tell(&pb) + 4 < pos + data_len) {
|
||||
int tlv_len = avio_rb16(&pb);
|
||||
tag = avio_rl16(&pb);
|
||||
if (url_ftell(&pb) + tlv_len > pos + data_len)
|
||||
if (avio_tell(&pb) + tlv_len > pos + data_len)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
#define MKTAG16(a,b) MKTAG(a,b,0,0)
|
||||
@ -155,7 +155,7 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt,
|
||||
}
|
||||
|
||||
/* 32-bit alignment */
|
||||
avio_seek(&pb, ((url_ftell(&pb) + 3) & ~3) - url_ftell(&pb), SEEK_CUR);
|
||||
avio_seek(&pb, ((avio_tell(&pb) + 3) & ~3) - avio_tell(&pb), SEEK_CUR);
|
||||
} else
|
||||
avio_seek(&pb, 4, SEEK_SET);
|
||||
|
||||
@ -164,7 +164,7 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt,
|
||||
return AVERROR_NOTSUPP;
|
||||
}
|
||||
|
||||
alen = len - url_ftell(&pb);
|
||||
alen = len - avio_tell(&pb);
|
||||
if (alen <= 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
@ -182,7 +182,7 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt,
|
||||
}
|
||||
if (!qt->pkt.data)
|
||||
return AVERROR(ENOMEM);
|
||||
memcpy(qt->pkt.data + qt->pkt.size, buf + url_ftell(&pb), alen);
|
||||
memcpy(qt->pkt.data + qt->pkt.size, buf + avio_tell(&pb), alen);
|
||||
qt->pkt.size += alen;
|
||||
if (has_marker_bit) {
|
||||
*pkt = qt->pkt;
|
||||
@ -203,7 +203,7 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt,
|
||||
qt->remaining = (alen / qt->bytes_per_frame) - 1;
|
||||
if (av_new_packet(pkt, qt->bytes_per_frame))
|
||||
return AVERROR(ENOMEM);
|
||||
memcpy(pkt->data, buf + url_ftell(&pb), qt->bytes_per_frame);
|
||||
memcpy(pkt->data, buf + avio_tell(&pb), qt->bytes_per_frame);
|
||||
pkt->flags = flags & RTP_FLAG_KEY ? AV_PKT_FLAG_KEY : 0;
|
||||
pkt->stream_index = st->index;
|
||||
if (qt->remaining > 0) {
|
||||
@ -215,7 +215,7 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt,
|
||||
}
|
||||
qt->pkt.size = qt->remaining * qt->bytes_per_frame;
|
||||
memcpy(qt->pkt.data,
|
||||
buf + url_ftell(&pb) + qt->bytes_per_frame,
|
||||
buf + avio_tell(&pb) + qt->bytes_per_frame,
|
||||
qt->remaining * qt->bytes_per_frame);
|
||||
qt->pkt.flags = pkt->flags;
|
||||
return 1;
|
||||
|
@ -405,7 +405,7 @@ AVParserState *ff_store_parser_state(AVFormatContext *s)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
state->fpos = url_ftell(s->pb);
|
||||
state->fpos = avio_tell(s->pb);
|
||||
|
||||
// copy context structures
|
||||
state->cur_st = s->cur_st;
|
||||
|
@ -222,7 +222,7 @@ static int film_read_packet(AVFormatContext *s,
|
||||
/* do a special song and dance when loading FILM Cinepak chunks */
|
||||
if ((sample->stream == film->video_stream_index) &&
|
||||
(film->video_type == CODEC_ID_CINEPAK)) {
|
||||
pkt->pos= url_ftell(pb);
|
||||
pkt->pos= avio_tell(pb);
|
||||
if (av_new_packet(pkt, sample->sample_size))
|
||||
return AVERROR(ENOMEM);
|
||||
avio_read(pb, pkt->data, sample->sample_size);
|
||||
@ -240,7 +240,7 @@ static int film_read_packet(AVFormatContext *s,
|
||||
film->stereo_buffer = av_malloc(film->stereo_buffer_size);
|
||||
}
|
||||
|
||||
pkt->pos= url_ftell(pb);
|
||||
pkt->pos= avio_tell(pb);
|
||||
ret = avio_read(pb, film->stereo_buffer, sample->sample_size);
|
||||
if (ret != sample->sample_size)
|
||||
ret = AVERROR(EIO);
|
||||
|
@ -247,7 +247,7 @@ static int vmd_read_packet(AVFormatContext *s,
|
||||
|
||||
if (av_new_packet(pkt, frame->frame_size + BYTES_PER_FRAME_RECORD))
|
||||
return AVERROR(ENOMEM);
|
||||
pkt->pos= url_ftell(pb);
|
||||
pkt->pos= avio_tell(pb);
|
||||
memcpy(pkt->data, frame->frame_record, BYTES_PER_FRAME_RECORD);
|
||||
if(vmd->is_indeo3)
|
||||
ret = avio_read(pb, pkt->data, frame->frame_size);
|
||||
|
@ -219,7 +219,7 @@ static int smacker_read_header(AVFormatContext *s, AVFormatParameters *ap)
|
||||
((int32_t*)st->codec->extradata)[3] = av_le2ne32(smk->type_size);
|
||||
|
||||
smk->curstream = -1;
|
||||
smk->nextpos = url_ftell(pb);
|
||||
smk->nextpos = avio_tell(pb);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -244,7 +244,7 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
frame_size = smk->frm_size[smk->cur_frame] & (~3);
|
||||
flags = smk->frm_flags[smk->cur_frame];
|
||||
/* handle palette change event */
|
||||
pos = url_ftell(s->pb);
|
||||
pos = avio_tell(s->pb);
|
||||
if(flags & SMACKER_PAL){
|
||||
int size, sz, t, off, j, pos;
|
||||
uint8_t *pal = smk->pal;
|
||||
@ -256,7 +256,7 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
frame_size -= size;
|
||||
frame_size--;
|
||||
sz = 0;
|
||||
pos = url_ftell(s->pb) + size;
|
||||
pos = avio_tell(s->pb) + size;
|
||||
while(sz < 256){
|
||||
t = avio_r8(s->pb);
|
||||
if(t & 0x80){ /* skip palette entries */
|
||||
@ -313,7 +313,7 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
pkt->stream_index = smk->videoindex;
|
||||
pkt->size = ret + 769;
|
||||
smk->cur_frame++;
|
||||
smk->nextpos = url_ftell(s->pb);
|
||||
smk->nextpos = avio_tell(s->pb);
|
||||
} else {
|
||||
if (av_new_packet(pkt, smk->buf_sizes[smk->curstream]))
|
||||
return AVERROR(ENOMEM);
|
||||
|
@ -98,7 +98,7 @@ static int sox_write_trailer(AVFormatContext *s)
|
||||
|
||||
if (!url_is_streamed(s->pb)) {
|
||||
/* update number of samples */
|
||||
int64_t file_size = url_ftell(pb);
|
||||
int64_t file_size = avio_tell(pb);
|
||||
int64_t num_samples = (file_size - sox->header_size - 4LL) >> 2LL;
|
||||
avio_seek(pb, 8, SEEK_SET);
|
||||
if (enc->codec_id == CODEC_ID_PCM_S32LE) {
|
||||
|
@ -185,7 +185,7 @@ static int spdif_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
pkt->pos = url_ftell(pb) - BURST_HEADER_SIZE;
|
||||
pkt->pos = avio_tell(pb) - BURST_HEADER_SIZE;
|
||||
|
||||
if (avio_read(pb, pkt->data, pkt->size) < pkt->size) {
|
||||
av_free_packet(pkt);
|
||||
|
@ -75,7 +75,7 @@ static inline int is_eol(char c)
|
||||
static int srt_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
{
|
||||
char buffer[2048], *ptr = buffer, *ptr2;
|
||||
int64_t pos = url_ftell(s->pb);
|
||||
int64_t pos = avio_tell(s->pb);
|
||||
int res = AVERROR_EOF;
|
||||
|
||||
do {
|
||||
|
@ -87,7 +87,7 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
int tag, len, i, frame, v;
|
||||
|
||||
for(;;) {
|
||||
uint64_t pos = url_ftell(pb);
|
||||
uint64_t pos = avio_tell(pb);
|
||||
tag = get_swf_tag(pb, &len);
|
||||
if (tag < 0)
|
||||
return AVERROR(EIO);
|
||||
|
@ -29,7 +29,7 @@ static void put_swf_tag(AVFormatContext *s, int tag)
|
||||
SWFContext *swf = s->priv_data;
|
||||
AVIOContext *pb = s->pb;
|
||||
|
||||
swf->tag_pos = url_ftell(pb);
|
||||
swf->tag_pos = avio_tell(pb);
|
||||
swf->tag = tag;
|
||||
/* reserve some room for the tag */
|
||||
if (tag & TAG_LONG) {
|
||||
@ -47,7 +47,7 @@ static void put_swf_end_tag(AVFormatContext *s)
|
||||
int64_t pos;
|
||||
int tag_len, tag;
|
||||
|
||||
pos = url_ftell(pb);
|
||||
pos = avio_tell(pb);
|
||||
tag_len = pos - swf->tag_pos - 2;
|
||||
tag = swf->tag;
|
||||
avio_seek(pb, swf->tag_pos, SEEK_SET);
|
||||
@ -246,7 +246,7 @@ static int swf_write_header(AVFormatContext *s)
|
||||
|
||||
put_swf_rect(pb, 0, width * 20, 0, height * 20);
|
||||
avio_wl16(pb, (rate * 256) / rate_base); /* frame rate */
|
||||
swf->duration_pos = url_ftell(pb);
|
||||
swf->duration_pos = avio_tell(pb);
|
||||
avio_wl16(pb, (uint16_t)(DUMMY_DURATION * (int64_t)rate / rate_base)); /* frame count */
|
||||
|
||||
/* avm2/swf v9 (also v8?) files require a file attribute tag */
|
||||
@ -346,7 +346,7 @@ static int swf_write_video(AVFormatContext *s,
|
||||
/* create a new video object */
|
||||
put_swf_tag(s, TAG_VIDEOSTREAM);
|
||||
avio_wl16(pb, VIDEO_ID);
|
||||
swf->vframes_pos = url_ftell(pb);
|
||||
swf->vframes_pos = avio_tell(pb);
|
||||
avio_wl16(pb, 15000); /* hard flash player limit */
|
||||
avio_wl16(pb, enc->width);
|
||||
avio_wl16(pb, enc->height);
|
||||
@ -493,7 +493,7 @@ static int swf_write_trailer(AVFormatContext *s)
|
||||
|
||||
/* patch file size and number of frames if not streamed */
|
||||
if (!url_is_streamed(s->pb) && video_enc) {
|
||||
file_size = url_ftell(pb);
|
||||
file_size = avio_tell(pb);
|
||||
avio_seek(pb, 4, SEEK_SET);
|
||||
avio_wl32(pb, file_size);
|
||||
avio_seek(pb, swf->duration_pos, SEEK_SET);
|
||||
|
@ -46,7 +46,7 @@ static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap)
|
||||
if (!av_metadata_get(s->metadata, "", NULL, AV_METADATA_IGNORE_SUFFIX))
|
||||
ff_id3v1_read(s);
|
||||
|
||||
start_offset = url_ftell(s->pb);
|
||||
start_offset = avio_tell(s->pb);
|
||||
if (avio_rl32(s->pb) != AV_RL32("TTA1"))
|
||||
return -1; // not tta file
|
||||
|
||||
@ -84,7 +84,7 @@ static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap)
|
||||
st->start_time = 0;
|
||||
st->duration = datalen;
|
||||
|
||||
framepos = url_ftell(s->pb) + 4*c->totalframes + 4;
|
||||
framepos = avio_tell(s->pb) + 4*c->totalframes + 4;
|
||||
|
||||
for (i = 0; i < c->totalframes; i++) {
|
||||
uint32_t size = avio_rl32(s->pb);
|
||||
@ -99,7 +99,7 @@ static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap)
|
||||
st->codec->sample_rate = samplerate;
|
||||
st->codec->bits_per_coded_sample = bps;
|
||||
|
||||
st->codec->extradata_size = url_ftell(s->pb) - start_offset;
|
||||
st->codec->extradata_size = avio_tell(s->pb) - start_offset;
|
||||
if(st->codec->extradata_size+FF_INPUT_BUFFER_PADDING_SIZE <= (unsigned)st->codec->extradata_size){
|
||||
//this check is redundant as avio_read should fail
|
||||
av_log(s, AV_LOG_ERROR, "extradata_size too large\n");
|
||||
|
@ -112,7 +112,7 @@ static int read_packet(AVFormatContext *avctx, AVPacket *pkt)
|
||||
n = s->chars_per_frame;
|
||||
if (s->fsize) {
|
||||
// ignore metadata buffer
|
||||
uint64_t p = url_ftell(avctx->pb);
|
||||
uint64_t p = avio_tell(avctx->pb);
|
||||
if (p + s->chars_per_frame > s->fsize)
|
||||
n = s->fsize - p;
|
||||
}
|
||||
|
@ -330,7 +330,7 @@ int av_get_packet(AVIOContext *s, AVPacket *pkt, int size)
|
||||
if(ret<0)
|
||||
return ret;
|
||||
|
||||
pkt->pos= url_ftell(s);
|
||||
pkt->pos= avio_tell(s);
|
||||
|
||||
ret= avio_read(s, pkt->data, size);
|
||||
if(ret<=0)
|
||||
@ -490,7 +490,7 @@ int av_open_input_stream(AVFormatContext **ic_ptr,
|
||||
}
|
||||
|
||||
if (pb && !ic->data_offset)
|
||||
ic->data_offset = url_ftell(ic->pb);
|
||||
ic->data_offset = avio_tell(ic->pb);
|
||||
|
||||
#if FF_API_OLD_METADATA
|
||||
ff_metadata_demux_compat(ic);
|
||||
@ -2212,7 +2212,7 @@ int av_find_stream_info(AVFormatContext *ic)
|
||||
int i, count, ret, read_size, j;
|
||||
AVStream *st;
|
||||
AVPacket pkt1, *pkt;
|
||||
int64_t old_offset = url_ftell(ic->pb);
|
||||
int64_t old_offset = avio_tell(ic->pb);
|
||||
|
||||
for(i=0;i<ic->nb_streams;i++) {
|
||||
AVCodec *codec;
|
||||
|
@ -80,7 +80,7 @@ voc_get_packet(AVFormatContext *s, AVPacket *pkt, AVStream *st, int max_size)
|
||||
if (!voc->remaining_size) {
|
||||
if (url_is_streamed(s->pb))
|
||||
return AVERROR(EIO);
|
||||
voc->remaining_size = url_fsize(pb) - url_ftell(pb);
|
||||
voc->remaining_size = url_fsize(pb) - avio_tell(pb);
|
||||
}
|
||||
max_size -= 4;
|
||||
|
||||
|
@ -200,7 +200,7 @@ static int vqf_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
int ret;
|
||||
int size = (c->frame_bit_len - c->remaining_bits + 7)>>3;
|
||||
|
||||
pkt->pos = url_ftell(s->pb);
|
||||
pkt->pos = avio_tell(s->pb);
|
||||
pkt->stream_index = 0;
|
||||
|
||||
if (av_new_packet(pkt, size+2) < 0)
|
||||
|
@ -102,7 +102,7 @@ static int wav_write_trailer(AVFormatContext *s)
|
||||
ff_end_tag(pb, wav->data);
|
||||
|
||||
/* update file size */
|
||||
file_size = url_ftell(pb);
|
||||
file_size = avio_tell(pb);
|
||||
avio_seek(pb, 4, SEEK_SET);
|
||||
avio_wl32(pb, (uint32_t)(file_size - 8));
|
||||
avio_seek(pb, file_size, SEEK_SET);
|
||||
@ -252,7 +252,7 @@ static int wav_read_header(AVFormatContext *s,
|
||||
if (!size) {
|
||||
wav->data_end = INT64_MAX;
|
||||
} else
|
||||
wav->data_end= url_ftell(pb) + size;
|
||||
wav->data_end= avio_tell(pb) + size;
|
||||
|
||||
if (!sample_count && st->codec->channels && av_get_bits_per_sample(st->codec->codec_id))
|
||||
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,
|
||||
|
||||
st = s->streams[0];
|
||||
|
||||
left = wav->data_end - url_ftell(s->pb);
|
||||
left = wav->data_end - avio_tell(s->pb);
|
||||
if (left <= 0){
|
||||
if (CONFIG_W64_DEMUXER && wav->w64)
|
||||
left = find_guid(s->pb, guid_data) - 24;
|
||||
@ -304,7 +304,7 @@ static int wav_read_packet(AVFormatContext *s,
|
||||
left = find_tag(s->pb, MKTAG('d', 'a', 't', 'a'));
|
||||
if (left < 0)
|
||||
return AVERROR_EOF;
|
||||
wav->data_end= url_ftell(s->pb) + left;
|
||||
wav->data_end= avio_tell(s->pb) + left;
|
||||
}
|
||||
|
||||
size = MAX_SIZE;
|
||||
@ -421,7 +421,7 @@ static int w64_read_header(AVFormatContext *s, AVFormatParameters *ap)
|
||||
av_log(s, AV_LOG_ERROR, "could not find data guid\n");
|
||||
return -1;
|
||||
}
|
||||
wav->data_end = url_ftell(pb) + size - 24;
|
||||
wav->data_end = avio_tell(pb) + size - 24;
|
||||
wav->w64 = 1;
|
||||
|
||||
return 0;
|
||||
|
@ -468,7 +468,7 @@ static void get_attachment(AVFormatContext *s, AVIOContext *pb, int length)
|
||||
char description[1024];
|
||||
unsigned int filesize;
|
||||
AVStream *st;
|
||||
int64_t pos = url_ftell(pb);
|
||||
int64_t pos = avio_tell(pb);
|
||||
|
||||
avio_get_str16le(pb, INT_MAX, mime, sizeof(mime));
|
||||
if (strcmp(mime, "image/jpeg"))
|
||||
@ -980,7 +980,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
|
||||
return ret;
|
||||
avio_seek(wtv->pb, -32, SEEK_CUR);
|
||||
|
||||
timeline_pos = url_ftell(s->pb); // save before opening another file
|
||||
timeline_pos = avio_tell(s->pb); // save before opening another file
|
||||
|
||||
/* read metadata */
|
||||
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
|
||||
int rate, bpp, chan;
|
||||
uint32_t chmask;
|
||||
|
||||
wc->pos = url_ftell(pb);
|
||||
wc->pos = avio_tell(pb);
|
||||
if(!append){
|
||||
tag = avio_rl32(pb);
|
||||
if (tag != MKTAG('w', 'v', 'p', 'k'))
|
||||
@ -120,12 +120,12 @@ static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb, int appen
|
||||
chmask = wc->chmask;
|
||||
}
|
||||
if((rate == -1 || !chan) && !wc->block_parsed){
|
||||
int64_t block_end = url_ftell(pb) + wc->blksize - 24;
|
||||
int64_t block_end = avio_tell(pb) + wc->blksize - 24;
|
||||
if(url_is_streamed(pb)){
|
||||
av_log(ctx, AV_LOG_ERROR, "Cannot determine additional parameters\n");
|
||||
return -1;
|
||||
}
|
||||
while(url_ftell(pb) < block_end){
|
||||
while(avio_tell(pb) < block_end){
|
||||
int id, size;
|
||||
id = avio_r8(pb);
|
||||
size = (id & 0x80) ? avio_rl24(pb) : avio_r8(pb);
|
||||
@ -224,7 +224,7 @@ static int wv_read_header(AVFormatContext *s,
|
||||
st->duration = wc->samples;
|
||||
|
||||
if(!url_is_streamed(s->pb)) {
|
||||
int64_t cur = url_ftell(s->pb);
|
||||
int64_t cur = avio_tell(s->pb);
|
||||
ff_ape_parse_tag(s);
|
||||
if(!av_metadata_get(s->metadata, "", NULL, AV_METADATA_IGNORE_SUFFIX))
|
||||
ff_id3v1_read(s);
|
||||
@ -327,7 +327,7 @@ static int wv_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp,
|
||||
if(timestamp < 0 || timestamp >= s->duration)
|
||||
return -1;
|
||||
|
||||
pos = url_ftell(s->pb);
|
||||
pos = avio_tell(s->pb);
|
||||
do{
|
||||
ret = av_read_frame(s, pkt);
|
||||
if (ret < 0){
|
||||
|
@ -136,7 +136,7 @@ static int yop_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
yop->video_packet.pos = url_ftell(pb);
|
||||
yop->video_packet.pos = avio_tell(pb);
|
||||
|
||||
ret = avio_read(pb, yop->video_packet.data, yop->palette_size);
|
||||
if (ret < 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user