fftools/ffmpeg: move InputStream.discard to private data

It is not used outside of ffmpeg_demux.
This commit is contained in:
Anton Khirnov
2023-12-13 19:15:11 +01:00
parent 4224895a87
commit 9afe3f5274
2 changed files with 15 additions and 9 deletions

View File

@@ -344,7 +344,6 @@ typedef struct InputStream {
int index; int index;
AVStream *st; AVStream *st;
int discard; /* true if stream data should be discarded */
int user_set_discard; int user_set_discard;
int decoding_needed; /* non zero if the packets must be decoded in 'raw_fifo', see DECODING_FOR_* */ int decoding_needed; /* non zero if the packets must be decoded in 'raw_fifo', see DECODING_FOR_* */
#define DECODING_FOR_OST 1 #define DECODING_FOR_OST 1

View File

@@ -63,6 +63,9 @@ typedef struct DemuxStream {
double ts_scale; double ts_scale;
/* true if stream data should be discarded */
int discard;
// scheduler returned EOF for this stream // scheduler returned EOF for this stream
int finished; int finished;
@@ -136,7 +139,8 @@ static Demuxer *demuxer_from_ifile(InputFile *f)
InputStream *ist_find_unused(enum AVMediaType type) InputStream *ist_find_unused(enum AVMediaType type)
{ {
for (InputStream *ist = ist_iter(NULL); ist; ist = ist_iter(ist)) { for (InputStream *ist = ist_iter(NULL); ist; ist = ist_iter(ist)) {
if (ist->par->codec_type == type && ist->discard && DemuxStream *ds = ds_from_ist(ist);
if (ist->par->codec_type == type && ds->discard &&
ist->user_set_discard != AVDISCARD_ALL) ist->user_set_discard != AVDISCARD_ALL)
return ist; return ist;
} }
@@ -553,11 +557,14 @@ static void discard_unused_programs(InputFile *ifile)
AVProgram *p = ifile->ctx->programs[j]; AVProgram *p = ifile->ctx->programs[j];
int discard = AVDISCARD_ALL; int discard = AVDISCARD_ALL;
for (int k = 0; k < p->nb_stream_indexes; k++) for (int k = 0; k < p->nb_stream_indexes; k++) {
if (!ifile->streams[p->stream_index[k]]->discard) { DemuxStream *ds = ds_from_ist(ifile->streams[p->stream_index[k]]);
if (!ds->discard) {
discard = AVDISCARD_DEFAULT; discard = AVDISCARD_DEFAULT;
break; break;
} }
}
p->discard = discard; p->discard = discard;
} }
} }
@@ -634,7 +641,7 @@ static void *input_thread(void *arg)
dynamically in stream : we ignore them */ dynamically in stream : we ignore them */
ds = pkt->stream_index < f->nb_streams ? ds = pkt->stream_index < f->nb_streams ?
ds_from_ist(f->streams[pkt->stream_index]) : NULL; ds_from_ist(f->streams[pkt->stream_index]) : NULL;
if (!ds || ds->ist.discard || ds->finished) { if (!ds || ds->discard || ds->finished) {
report_new_stream(d, pkt); report_new_stream(d, pkt);
av_packet_unref(pkt); av_packet_unref(pkt);
continue; continue;
@@ -686,7 +693,7 @@ static void demux_final_stats(Demuxer *d)
DemuxStream *ds = ds_from_ist(ist); DemuxStream *ds = ds_from_ist(ist);
enum AVMediaType type = ist->par->codec_type; enum AVMediaType type = ist->par->codec_type;
if (ist->discard || type == AVMEDIA_TYPE_ATTACHMENT) if (ds->discard || type == AVMEDIA_TYPE_ATTACHMENT)
continue; continue;
total_size += ds->data_size; total_size += ds->data_size;
@@ -774,8 +781,8 @@ static int ist_use(InputStream *ist, int decoding_needed)
ds->sch_idx_stream = ret; ds->sch_idx_stream = ret;
} }
if (ist->discard) { if (ds->discard) {
ist->discard = 0; ds->discard = 0;
d->nb_streams_used++; d->nb_streams_used++;
} }
@@ -1021,7 +1028,7 @@ static int ist_add(const OptionsContext *o, Demuxer *d, AVStream *st)
ist = &ds->ist; ist = &ds->ist;
ist->discard = 1; ds->discard = 1;
st->discard = AVDISCARD_ALL; st->discard = AVDISCARD_ALL;
ds->first_dts = AV_NOPTS_VALUE; ds->first_dts = AV_NOPTS_VALUE;
ds->next_dts = AV_NOPTS_VALUE; ds->next_dts = AV_NOPTS_VALUE;