aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2022-08-03 11:32:10 +0200
committerAnton Khirnov <anton@khirnov.net>2022-08-08 16:20:58 +0200
commit8e092c3eac399d457e470decffa1081251d00648 (patch)
treef94a867475f826836297c8c8756f5100213000c6
parent80e7feb48b99660754f4313bb12b216aeacebf4f (diff)
downloadffmpeg-8e092c3eac399d457e470decffa1081251d00648.tar.gz
fftools/ffmpeg: remove OutputStream.encoding_needed
It is unnecessary, as it is always exactly equivalent to !!ost->enc_ctx
-rw-r--r--fftools/ffmpeg.c10
-rw-r--r--fftools/ffmpeg.h1
-rw-r--r--fftools/ffmpeg_opt.c8
3 files changed, 7 insertions, 12 deletions
diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index cf61706ac0..a38e758e77 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -1536,7 +1536,7 @@ static void print_final_stats(int64_t total_size)
av_log(NULL, AV_LOG_VERBOSE, " Output stream #%d:%d (%s): ",
i, j, av_get_media_type_string(type));
- if (ost->encoding_needed) {
+ if (ost->enc_ctx) {
av_log(NULL, AV_LOG_VERBOSE, "%"PRIu64" frames encoded",
ost->frames_encoded);
if (type == AVMEDIA_TYPE_AUDIO)
@@ -1788,7 +1788,7 @@ static void flush_encoders(void)
AVCodecContext *enc = ost->enc_ctx;
OutputFile *of = output_files[ost->file_index];
- if (!ost->encoding_needed)
+ if (!enc)
continue;
// Try to enable encoding with no input frames.
@@ -2359,7 +2359,7 @@ static int transcode_subtitles(InputStream *ist, AVPacket *pkt, int *got_output,
for (i = 0; i < nb_output_streams; i++) {
OutputStream *ost = output_streams[i];
- if (!check_output_constraints(ist, ost) || !ost->encoding_needed
+ if (!check_output_constraints(ist, ost) || !ost->enc_ctx
|| ost->enc->type != AVMEDIA_TYPE_SUBTITLE)
continue;
@@ -2568,7 +2568,7 @@ static int process_input_packet(InputStream *ist, const AVPacket *pkt, int no_eo
for (i = 0; i < nb_output_streams; i++) {
OutputStream *ost = output_streams[i];
- if (!check_output_constraints(ist, ost) || ost->encoding_needed ||
+ if (!check_output_constraints(ist, ost) || ost->enc_ctx ||
(!pkt && no_eof))
continue;
@@ -3137,7 +3137,7 @@ static int init_output_stream(OutputStream *ost, AVFrame *frame,
OutputFile *of = output_files[ost->file_index];
int ret = 0;
- if (ost->encoding_needed) {
+ if (ost->enc_ctx) {
const AVCodec *codec = ost->enc;
AVCodecContext *dec = NULL;
InputStream *ist;
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index 713de42e2b..69e4758a2d 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -464,7 +464,6 @@ typedef struct OutputStream {
int index; /* stream index in the output file */
int source_index; /* InputStream index */
AVStream *st; /* stream in the output file */
- int encoding_needed; /* true if encoding needed for this stream */
/* number of frames emitted by the video-encoding sync code */
int64_t vsync_frame_number;
/* input pts and corresponding output pts
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 784209e770..ffa320da87 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -1559,10 +1559,6 @@ static int choose_encoder(OptionsContext *o, AVFormatContext *s, OutputStream *o
ost->enc = find_codec_or_die(codec_name, ost->st->codecpar->codec_type, 1);
ost->st->codecpar->codec_id = ost->enc->id;
}
- ost->encoding_needed = !!ost->enc;
- } else {
- /* no encoding supported for other media types */
- ost->encoding_needed = 0;
}
return 0;
@@ -2433,7 +2429,7 @@ static int setup_sync_queues(OutputFile *of, AVFormatContext *oc, int64_t buf_si
int limit_frames = 0, limit_frames_av_enc = 0;
#define IS_AV_ENC(ost, type) \
- (ost->encoding_needed && (type == AVMEDIA_TYPE_VIDEO || type == AVMEDIA_TYPE_AUDIO))
+ (ost->enc_ctx && (type == AVMEDIA_TYPE_VIDEO || type == AVMEDIA_TYPE_AUDIO))
#define IS_INTERLEAVED(type) (type != AVMEDIA_TYPE_ATTACHMENT)
for (int i = 0; i < oc->nb_streams; i++) {
@@ -3043,7 +3039,7 @@ static int open_output_file(OptionsContext *o, const char *filename)
for (i = of->ost_index; i < nb_output_streams; i++) {
OutputStream *ost = output_streams[i];
- if (ost->encoding_needed && ost->source_index >= 0) {
+ if (ost->enc_ctx && ost->source_index >= 0) {
InputStream *ist = input_streams[ost->source_index];
ist->decoding_needed |= DECODING_FOR_OST;
ist->processing_needed = 1;