fftools/ffmpeg: store stream media type in OutputStream

Reduces access to a deeply nested muxer property
OutputStream.st->codecpar->codec_type for this fundamental and immutable
stream property.

Besides making the code shorter, this will allow making the AVStream
(OutputStream.st) private to the muxer in the future.
This commit is contained in:
Anton Khirnov
2023-04-11 10:15:55 +02:00
parent de38e17583
commit a064aed4c3
4 changed files with 21 additions and 22 deletions

View File

@@ -748,12 +748,12 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti
const AVCodecContext * const enc = ost->enc_ctx;
const float q = enc ? ost->quality / (float) FF_QP2LAMBDA : -1;
if (vid && ost->st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
if (vid && ost->type == AVMEDIA_TYPE_VIDEO) {
av_bprintf(&buf, "q=%2.1f ", q);
av_bprintf(&buf_script, "stream_%d_%d_q=%.1f\n",
ost->file_index, ost->index, q);
}
if (!vid && ost->st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
if (!vid && ost->type == AVMEDIA_TYPE_VIDEO) {
float fps;
uint64_t frame_number = atomic_load(&ost->packets_written);