avformat/utils: make ff_update_cur_dts() shared

libavdevice needs it.

Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer 2021-06-05 11:09:03 -03:00
parent e01bf559df
commit c768233293
11 changed files with 16 additions and 16 deletions

View File

@ -238,7 +238,7 @@ static int aa_read_header(AVFormatContext *s)
st->duration = (largest_size - CHAPTER_HEADER_SIZE * s->nb_chapters) * TIMEPREC;
ff_update_cur_dts(s, st, 0);
avpriv_update_cur_dts(s, st, 0);
avio_seek(pb, start, SEEK_SET);
c->current_chapter_size = 0;
c->seek_offset = 0;
@ -365,7 +365,7 @@ static int aa_read_seek(AVFormatContext *s,
c->seek_offset = (MP3_FRAME_SIZE - chapter_pos % MP3_FRAME_SIZE) % MP3_FRAME_SIZE;
}
ff_update_cur_dts(s, s->streams[0], ch->start + (chapter_pos + c->seek_offset) * TIMEPREC);
avpriv_update_cur_dts(s, s->streams[0], ch->start + (chapter_pos + c->seek_offset) * TIMEPREC);
return 1;
}

View File

@ -477,7 +477,7 @@ static int read_seek(AVFormatContext *s, int stream_index,
return ret;
b->current_block = timestamp;
ff_update_cur_dts(s, st, timestamp * b->samples_per_block);
avpriv_update_cur_dts(s, st, timestamp * b->samples_per_block);
return 0;
}

View File

@ -358,7 +358,7 @@ static int idcin_read_seek(AVFormatContext *s, int stream_index,
int64_t ret = avio_seek(s->pb, idcin->first_pkt_pos, SEEK_SET);
if (ret < 0)
return ret;
ff_update_cur_dts(s, s->streams[idcin->video_stream_index], 0);
avpriv_update_cur_dts(s, s->streams[idcin->video_stream_index], 0);
idcin->next_chunk_is_video = 1;
idcin->current_audio_chunk = 0;
return 0;

View File

@ -635,7 +635,7 @@ int ff_seek_frame_binary(AVFormatContext *s, int stream_index,
* @param timestamp new dts expressed in time_base of param ref_st
* @param ref_st reference stream giving time_base of param timestamp
*/
void ff_update_cur_dts(AVFormatContext *s, AVStream *ref_st, int64_t timestamp);
void avpriv_update_cur_dts(AVFormatContext *s, AVStream *ref_st, int64_t timestamp);
int ff_find_last_ts(AVFormatContext *s, int stream_index, int64_t *ts, int64_t *pos,
int64_t (*read_timestamp)(struct AVFormatContext *, int , int64_t *, int64_t ));

View File

@ -3859,7 +3859,7 @@ static int matroska_read_seek(AVFormatContext *s, int stream_index,
}
matroska->skip_to_keyframe = 1;
matroska->done = 0;
ff_update_cur_dts(s, st, st->internal->index_entries[index].timestamp);
avpriv_update_cur_dts(s, st, st->internal->index_entries[index].timestamp);
return 0;
err:
// slightly hackish but allows proper fallback to

View File

@ -213,7 +213,7 @@ static int read_seek(AVFormatContext *s, int stream_index,
return ret;
m->current_block = timestamp;
ff_update_cur_dts(s, st, timestamp * m->samples_per_block);
avpriv_update_cur_dts(s, st, timestamp * m->samples_per_block);
return 0;
}

View File

@ -589,7 +589,7 @@ static int mp3_seek(AVFormatContext *s, int stream_index, int64_t timestamp,
ie1.timestamp = frame_duration * av_rescale(best_pos - s->internal->data_offset, mp3->frames, mp3->header_filesize);
}
ff_update_cur_dts(s, st, ie->timestamp);
avpriv_update_cur_dts(s, st, ie->timestamp);
return 0;
}

View File

@ -320,7 +320,7 @@ static int mpc8_read_seek(AVFormatContext *s, int stream_index, int64_t timestam
if(index < 0) return -1;
if (avio_seek(s->pb, st->internal->index_entries[index].pos, SEEK_SET) < 0)
return -1;
ff_update_cur_dts(s, st, st->internal->index_entries[index].timestamp);
avpriv_update_cur_dts(s, st, st->internal->index_entries[index].timestamp);
return 0;
}

View File

@ -3815,7 +3815,7 @@ static int mxf_read_seek(AVFormatContext *s, int stream_index, int64_t sample_ti
if (seekpos < 0)
return seekpos;
ff_update_cur_dts(s, st, sample_time);
avpriv_update_cur_dts(s, st, sample_time);
mxf->current_klv_data = (KLVPacket){{0}};
} else {
MXFPartition *partition;
@ -3868,7 +3868,7 @@ static int mxf_read_seek(AVFormatContext *s, int stream_index, int64_t sample_ti
if ((ret = mxf_edit_unit_absolute_offset(mxf, t, sample_time, source_track->edit_rate, &sample_time, &seekpos, &partition, 1)) < 0)
return ret;
ff_update_cur_dts(s, st, sample_time);
avpriv_update_cur_dts(s, st, sample_time);
if (source_track->wrapping == ClipWrapped) {
KLVPacket klv = partition->first_essence_klv;
if (seekpos < klv.next_klv - klv.length || seekpos >= klv.next_klv) {

View File

@ -1848,7 +1848,7 @@ void ff_read_frame_flush(AVFormatContext *s)
}
}
void ff_update_cur_dts(AVFormatContext *s, AVStream *ref_st, int64_t timestamp)
void avpriv_update_cur_dts(AVFormatContext *s, AVStream *ref_st, int64_t timestamp)
{
int i;
@ -2156,7 +2156,7 @@ int ff_seek_frame_binary(AVFormatContext *s, int stream_index,
return ret;
ff_read_frame_flush(s);
ff_update_cur_dts(s, st, ts);
avpriv_update_cur_dts(s, st, ts);
return 0;
}
@ -2350,7 +2350,7 @@ static int seek_frame_generic(AVFormatContext *s, int stream_index,
ie = &st->internal->index_entries[st->internal->nb_index_entries - 1];
if ((ret = avio_seek(s->pb, ie->pos, SEEK_SET)) < 0)
return ret;
ff_update_cur_dts(s, st, ie->timestamp);
avpriv_update_cur_dts(s, st, ie->timestamp);
} else {
if ((ret = avio_seek(s->pb, s->internal->data_offset, SEEK_SET)) < 0)
return ret;
@ -2388,7 +2388,7 @@ static int seek_frame_generic(AVFormatContext *s, int stream_index,
ie = &st->internal->index_entries[index];
if ((ret = avio_seek(s->pb, ie->pos, SEEK_SET)) < 0)
return ret;
ff_update_cur_dts(s, st, ie->timestamp);
avpriv_update_cur_dts(s, st, ie->timestamp);
return 0;
}

View File

@ -130,7 +130,7 @@ static int vpk_read_seek(AVFormatContext *s, int stream_index,
return ret;
vpk->current_block = timestamp;
ff_update_cur_dts(s, st, timestamp * samples_per_block);
avpriv_update_cur_dts(s, st, timestamp * samples_per_block);
return 0;
}