avformat: move AVStream.probe_packets to AVStreamInternal

It's a private fields, no reason to have it exposed in a public header.

Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer 2021-05-01 23:13:41 -03:00
parent 1262f67cca
commit fab2ed4704
7 changed files with 17 additions and 17 deletions

View File

@ -1003,11 +1003,6 @@ typedef struct AVStream {
int64_t first_dts;
int64_t cur_dts;
/**
* Number of packets to buffer for codec probing
*/
int probe_packets;
/**
* Number of frames that have been demuxed during avformat_find_stream_info()
*/

View File

@ -368,6 +368,11 @@ struct AVStreamInternal {
int64_t last_IP_pts;
int last_IP_duration;
/**
* Number of packets to buffer for codec probing
*/
int probe_packets;
};
#ifdef __GNUC__

View File

@ -954,7 +954,7 @@ static int mpegts_set_stream_info(AVStream *st, PESContext *pes,
}
if ((st->codecpar->codec_id == AV_CODEC_ID_NONE ||
(st->internal->request_probe > 0 && st->internal->request_probe < AVPROBE_SCORE_STREAM_RETRY / 5)) &&
st->probe_packets > 0 &&
st->internal->probe_packets > 0 &&
stream_type == STREAM_TYPE_PRIVATE_DATA) {
st->codecpar->codec_type = AVMEDIA_TYPE_DATA;
st->codecpar->codec_id = AV_CODEC_ID_BIN_DATA;

View File

@ -1438,7 +1438,7 @@ static av_cold int sbg_read_header(AVFormatContext *avf)
st->codecpar->sample_rate = sbg->sample_rate;
st->codecpar->frame_size = sbg->frame_size;
avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate);
st->probe_packets = 0;
st->internal->probe_packets = 0;
st->start_time = av_rescale(script.start_ts,
sbg->sample_rate, AV_TIME_BASE);
st->duration = script.end_ts == AV_NOPTS_VALUE ? AV_NOPTS_VALUE :

View File

@ -299,7 +299,7 @@ static av_cold int tedcaptions_read_header(AVFormatContext *avf)
st->codecpar->codec_type = AVMEDIA_TYPE_SUBTITLE;
st->codecpar->codec_id = AV_CODEC_ID_TEXT;
avpriv_set_pts_info(st, 64, 1, 1000);
st->probe_packets = 0;
st->internal->probe_packets = 0;
st->start_time = 0;
st->duration = last->pts + last->duration;
st->cur_dts = 0;

View File

@ -334,7 +334,7 @@ static int set_codec_from_probe_data(AVFormatContext *s, AVStream *st,
int i;
av_log(s, AV_LOG_DEBUG,
"Probe with size=%d, packets=%d detected %s with score=%d\n",
pd->buf_size, s->max_probe_packets - st->probe_packets,
pd->buf_size, s->max_probe_packets - st->internal->probe_packets,
fmt->name, score);
for (i = 0; fmt_id_type[i].name; i++) {
if (!strcmp(fmt->name, fmt_id_type[i].name)) {
@ -648,8 +648,8 @@ static int probe_codec(AVFormatContext *s, AVStream *st, const AVPacket *pkt)
if (st->internal->request_probe>0) {
AVProbeData *pd = &st->internal->probe_data;
int end;
av_log(s, AV_LOG_DEBUG, "probing stream %d pp:%d\n", st->index, st->probe_packets);
--st->probe_packets;
av_log(s, AV_LOG_DEBUG, "probing stream %d pp:%d\n", st->index, st->internal->probe_packets);
--st->internal->probe_packets;
if (pkt) {
uint8_t *new_buf = av_realloc(pd->buf, pd->buf_size+pkt->size+AVPROBE_PADDING_SIZE);
@ -665,7 +665,7 @@ static int probe_codec(AVFormatContext *s, AVStream *st, const AVPacket *pkt)
memset(pd->buf + pd->buf_size, 0, AVPROBE_PADDING_SIZE);
} else {
no_packet:
st->probe_packets = 0;
st->internal->probe_packets = 0;
if (!pd->buf_size) {
av_log(s, AV_LOG_WARNING,
"nothing to probe for stream %d\n", st->index);
@ -673,7 +673,7 @@ no_packet:
}
end= s->internal->raw_packet_buffer_remaining_size <= 0
|| st->probe_packets<= 0;
|| st->internal->probe_packets<= 0;
if (end || av_log2(pd->buf_size) != av_log2(pd->buf_size - pkt->size)) {
int score = set_codec_from_probe_data(s, st, pd);
@ -804,7 +804,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
return err;
for (i = 0; i < s->nb_streams; i++) {
st = s->streams[i];
if (st->probe_packets || st->internal->request_probe > 0)
if (st->internal->probe_packets || st->internal->request_probe > 0)
if ((err = probe_codec(s, st, NULL)) < 0)
return err;
av_assert0(st->internal->request_probe <= 0);
@ -1831,7 +1831,7 @@ void ff_read_frame_flush(AVFormatContext *s)
/* We set the current DTS to an unspecified origin. */
st->cur_dts = AV_NOPTS_VALUE;
st->probe_packets = s->max_probe_packets;
st->internal->probe_packets = s->max_probe_packets;
for (j = 0; j < MAX_REORDER_DELAY + 1; j++)
st->internal->pts_buffer[j] = AV_NOPTS_VALUE;
@ -4419,7 +4419,7 @@ AVStream *avformat_new_stream(AVFormatContext *s, const AVCodec *c)
st->start_time = AV_NOPTS_VALUE;
st->duration = AV_NOPTS_VALUE;
st->first_dts = AV_NOPTS_VALUE;
st->probe_packets = s->max_probe_packets;
st->internal->probe_packets = s->max_probe_packets;
st->internal->pts_wrap_reference = AV_NOPTS_VALUE;
st->internal->pts_wrap_behavior = AV_PTS_WRAP_IGNORE;

View File

@ -167,7 +167,7 @@ static void handle_stream_probing(AVStream *st)
{
if (st->codecpar->codec_id == AV_CODEC_ID_PCM_S16LE) {
st->internal->request_probe = AVPROBE_SCORE_EXTENSION;
st->probe_packets = FFMIN(st->probe_packets, 32);
st->internal->probe_packets = FFMIN(st->internal->probe_packets, 32);
}
}