This allows us to check the return value of avio_closep().
Unified · Split
| @@ -4699,7 +4699,7 @@ static int transcode(void) · 4698 unmodified lines | ||
| 4699 | 4699 | |
| 4700 | 4700 | term_exit(); |
| 4701 | 4701 | |
| 4702 | − /* write the trailer if needed and close file */ | |
| 4702 | + /* write the trailer if needed */ | |
| 4703 | 4703 | for (i = 0; i < nb_output_files; i++) { |
| 4704 | 4704 | os = output_files[i]->ctx; |
| 4705 | 4705 | if (!output_files[i]->header_written) { |
| @@ -4719,6 +4719,18 @@ static int transcode(void) · 13 unmodified lines | ||
| 4719 | 4719 | /* dump report by using the first video and audio streams */ |
| 4720 | 4720 | print_report(1, timer_start, av_gettime_relative()); |
| 4721 | 4721 | |
| 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 | + | |
| 4722 | 4734 | /* close each encoder */ |
| 4723 | 4735 | for (i = 0; i < nb_output_streams; i++) { |
| 4724 | 4736 | ost = output_streams[i]; |