1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-10 06:10:52 +02:00

fftools/ffmpeg_opt: reduce indentation in map_auto_video()

Fix indentation after the previous commit. Also use an early return to
save one extra indentation level.
This commit is contained in:
Anton Khirnov
2022-06-20 14:18:37 +02:00
parent 1a464efae3
commit 74176f3cd6

View File

@@ -2499,44 +2499,46 @@ static void map_auto_video(OutputFile *of, AVFormatContext *oc,
OptionsContext *o) OptionsContext *o)
{ {
InputStream *ist; InputStream *ist;
int best_score = 0, idx = -1;
int qcr;
/* video: highest resolution */ /* video: highest resolution */
if (av_guess_codec(oc->oformat, NULL, oc->url, NULL, AVMEDIA_TYPE_VIDEO) != AV_CODEC_ID_NONE) { if (av_guess_codec(oc->oformat, NULL, oc->url, NULL, AVMEDIA_TYPE_VIDEO) == AV_CODEC_ID_NONE)
int best_score = 0, idx = -1; return;
int qcr = avformat_query_codec(oc->oformat, oc->oformat->video_codec, 0);
for (int j = 0; j < nb_input_files; j++) { qcr = avformat_query_codec(oc->oformat, oc->oformat->video_codec, 0);
InputFile *ifile = input_files[j]; for (int j = 0; j < nb_input_files; j++) {
int file_best_score = 0, file_best_idx = -1; InputFile *ifile = input_files[j];
for (int i = 0; i < ifile->nb_streams; i++) { int file_best_score = 0, file_best_idx = -1;
int score; for (int i = 0; i < ifile->nb_streams; i++) {
ist = input_streams[ifile->ist_index + i]; int score;
score = ist->st->codecpar->width * ist->st->codecpar->height ist = input_streams[ifile->ist_index + i];
+ 100000000 * !!(ist->st->event_flags & AVSTREAM_EVENT_FLAG_NEW_PACKETS) score = ist->st->codecpar->width * ist->st->codecpar->height
+ 5000000*!!(ist->st->disposition & AV_DISPOSITION_DEFAULT); + 100000000 * !!(ist->st->event_flags & AVSTREAM_EVENT_FLAG_NEW_PACKETS)
if (ist->user_set_discard == AVDISCARD_ALL) + 5000000*!!(ist->st->disposition & AV_DISPOSITION_DEFAULT);
continue; if (ist->user_set_discard == AVDISCARD_ALL)
if((qcr!=MKTAG('A', 'P', 'I', 'C')) && (ist->st->disposition & AV_DISPOSITION_ATTACHED_PIC)) continue;
score = 1; if((qcr!=MKTAG('A', 'P', 'I', 'C')) && (ist->st->disposition & AV_DISPOSITION_ATTACHED_PIC))
if (ist->st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && score = 1;
score > file_best_score) { if (ist->st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO &&
if((qcr==MKTAG('A', 'P', 'I', 'C')) && !(ist->st->disposition & AV_DISPOSITION_ATTACHED_PIC)) score > file_best_score) {
continue; if((qcr==MKTAG('A', 'P', 'I', 'C')) && !(ist->st->disposition & AV_DISPOSITION_ATTACHED_PIC))
file_best_score = score; continue;
file_best_idx = ifile->ist_index + i; file_best_score = score;
} file_best_idx = ifile->ist_index + i;
}
if (file_best_idx >= 0) {
if((qcr == MKTAG('A', 'P', 'I', 'C')) || !(ist->st->disposition & AV_DISPOSITION_ATTACHED_PIC))
file_best_score -= 5000000*!!(input_streams[file_best_idx]->st->disposition & AV_DISPOSITION_DEFAULT);
if (file_best_score > best_score) {
best_score = file_best_score;
idx = file_best_idx;
}
}
} }
if (idx >= 0)
new_video_stream(o, oc, idx);
} }
if (file_best_idx >= 0) {
if((qcr == MKTAG('A', 'P', 'I', 'C')) || !(ist->st->disposition & AV_DISPOSITION_ATTACHED_PIC))
file_best_score -= 5000000*!!(input_streams[file_best_idx]->st->disposition & AV_DISPOSITION_DEFAULT);
if (file_best_score > best_score) {
best_score = file_best_score;
idx = file_best_idx;
}
}
}
if (idx >= 0)
new_video_stream(o, oc, idx);
} }
static int open_output_file(OptionsContext *o, const char *filename) static int open_output_file(OptionsContext *o, const char *filename)