History

fftools/ffmpeg: close output files before cleanup

This allows us to check the return value of avio_closep().

Marton Balint committed 4 years ago

Commit 8d66a071 parent 8a40cfa1 file · +13 −1Browse files

Unified · Split

fftools/ffmpeg.c+13−1
@@ -4699,7 +4699,7 @@ static int transcode(void) · 4698 unmodified lines
46994699
47004700 term_exit();
47014701
4702− /* write the trailer if needed and close file */
4702+ /* write the trailer if needed */
47034703 for (i = 0; i < nb_output_files; i++) {
47044704 os = output_files[i]->ctx;
47054705 if (!output_files[i]->header_written) {
@@ -4719,6 +4719,18 @@ static int transcode(void) · 13 unmodified lines
47194719 /* dump report by using the first video and audio streams */
47204720 print_report(1, timer_start, av_gettime_relative());
47214721
4722+ /* close the output files */
4723+ for (i = 0; i < nb_output_files; i++) {
4724+ os = output_files[i]->ctx;
4725+ if (os && os->oformat && !(os->oformat->flags & AVFMT_NOFILE)) {
4726+ if ((ret = avio_closep(&os->pb)) < 0) {
4727+ av_log(NULL, AV_LOG_ERROR, "Error closing file %s: %s\n", os->url, av_err2str(ret));
4728+ if (exit_on_error)
4729+ exit_program(1);
4730+ }
4731+ }
4732+ }
4733+
47224734 /* close each encoder */
47234735 for (i = 0; i < nb_output_streams; i++) {
47244736 ost = output_streams[i];

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t