| @@ -445,7 +445,7 @@ static int decode_interrupt_cb(void) · 444 unmodified lines |
| 445 | 445 | return received_nb_signals > 1; |
| 446 | 446 | } |
| 447 | 447 | |
| 448 | | −static int ffmpeg_exit(int ret) |
| 448 | +void exit_program(int ret) |
| 449 | 449 | { |
| 450 | 450 | int i; |
| 451 | 451 | |
| @@ -501,7 +501,6 @@ static int ffmpeg_exit(int ret) · 49 unmodified lines |
| 501 | 501 | } |
| 502 | 502 | |
| 503 | 503 | exit(ret); /* not all OS-es handle main() return value */ |
| 504 | | − return ret; |
| 505 | 504 | } |
| 506 | 505 | |
| 507 | 506 | static void assert_avoptions(AVDictionary *m) |
| @@ -509,7 +508,7 @@ static void assert_avoptions(AVDictionary *m) · 1 unmodified line |
| 509 | 508 | AVDictionaryEntry *t; |
| 510 | 509 | if ((t = av_dict_get(m, "", NULL, AV_DICT_IGNORE_SUFFIX))) { |
| 511 | 510 | av_log(NULL, AV_LOG_ERROR, "Option %s not found.\n", t->key); |
| 512 | | − ffmpeg_exit(1); |
| 511 | + exit_program(1); |
| 513 | 512 | } |
| 514 | 513 | } |
| 515 | 514 | |
| @@ -526,7 +525,7 @@ static void assert_codec_experimental(AVCodecContext *c, int encoder) · 10 unmodified lines |
| 526 | 525 | if (!(codec->capabilities & CODEC_CAP_EXPERIMENTAL)) |
| 527 | 526 | av_log(NULL, AV_LOG_ERROR, "Or use the non experimental %s '%s'.\n", |
| 528 | 527 | codec_string, codec->name); |
| 529 | | − ffmpeg_exit(1); |
| 528 | + exit_program(1); |
| 530 | 529 | } |
| 531 | 530 | } |
| 532 | 531 | |
| @@ -535,13 +534,13 @@ static void *grow_array(void *array, int elem_size, int *size, int new_size) · 2 unmodified lines |
| 535 | 534 | { |
| 536 | 535 | if (new_size >= INT_MAX / elem_size) { |
| 537 | 536 | fprintf(stderr, "Array too big.\n"); |
| 538 | | − ffmpeg_exit(1); |
| 537 | + exit_program(1); |
| 539 | 538 | } |
| 540 | 539 | if (*size < new_size) { |
| 541 | 540 | uint8_t *tmp = av_realloc(array, new_size*elem_size); |
| 542 | 541 | if (!tmp) { |
| 543 | 542 | fprintf(stderr, "Could not alloc buffer.\n"); |
| 544 | | − ffmpeg_exit(1); |
| 543 | + exit_program(1); |
| 545 | 544 | } |
| 546 | 545 | memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size); |
| 547 | 546 | *size = new_size; |
| @@ -664,7 +663,7 @@ static OutputStream *new_output_stream(AVFormatContext *oc, int file_idx, AVCode · 116 unmodified lines |
| 664 | 663 | |
| 665 | 664 | if (!st) { |
| 666 | 665 | av_log(NULL, AV_LOG_ERROR, "Could not alloc stream.\n"); |
| 667 | | − ffmpeg_exit(1); |
| 666 | + exit_program(1); |
| 668 | 667 | } |
| 669 | 668 | |
| 670 | 669 | output_streams_for_file[file_idx] = |
| @@ -676,7 +675,7 @@ static OutputStream *new_output_stream(AVFormatContext *oc, int file_idx, AVCode · 5 unmodified lines |
| 676 | 675 | av_mallocz(sizeof(OutputStream)); |
| 677 | 676 | if (!ost) { |
| 678 | 677 | fprintf(stderr, "Could not alloc output stream\n"); |
| 679 | | − ffmpeg_exit(1); |
| 678 | + exit_program(1); |
| 680 | 679 | } |
| 681 | 680 | ost->file_index = file_idx; |
| 682 | 681 | ost->index = idx; |
| @@ -756,7 +755,7 @@ static void write_frame(AVFormatContext *s, AVPacket *pkt, AVCodecContext *avctx · 73 unmodified lines |
| 756 | 755 | avctx->codec ? avctx->codec->name : "copy"); |
| 757 | 756 | print_error("", a); |
| 758 | 757 | if (exit_on_error) |
| 759 | | − ffmpeg_exit(1); |
| 758 | + exit_program(1); |
| 760 | 759 | } |
| 761 | 760 | *pkt= new_pkt; |
| 762 | 761 | |
| @@ -766,7 +765,7 @@ static void write_frame(AVFormatContext *s, AVPacket *pkt, AVCodecContext *avctx · 3 unmodified lines |
| 766 | 765 | ret= av_interleaved_write_frame(s, pkt); |
| 767 | 766 | if(ret < 0){ |
| 768 | 767 | print_error("av_interleaved_write_frame()", ret); |
| 769 | | − ffmpeg_exit(1); |
| 768 | + exit_program(1); |
| 770 | 769 | } |
| 771 | 770 | } |
| 772 | 771 | |
| @@ -802,14 +801,14 @@ need_realloc: · 29 unmodified lines |
| 802 | 801 | |
| 803 | 802 | if(audio_out_size > INT_MAX || audio_buf_size > INT_MAX){ |
| 804 | 803 | fprintf(stderr, "Buffer sizes too large\n"); |
| 805 | | − ffmpeg_exit(1); |
| 804 | + exit_program(1); |
| 806 | 805 | } |
| 807 | 806 | |
| 808 | 807 | av_fast_malloc(&audio_buf, &allocated_audio_buf_size, audio_buf_size); |
| 809 | 808 | av_fast_malloc(&audio_out, &allocated_audio_out_size, audio_out_size); |
| 810 | 809 | if (!audio_buf || !audio_out){ |
| 811 | 810 | fprintf(stderr, "Out of memory in do_audio_out\n"); |
| 812 | | − ffmpeg_exit(1); |
| 811 | + exit_program(1); |
| 813 | 812 | } |
| 814 | 813 | |
| 815 | 814 | if (enc->channels != dec->channels || enc->sample_rate != dec->sample_rate) |
| @@ -849,7 +848,7 @@ need_realloc: · 33 unmodified lines |
| 849 | 848 | fprintf(stderr, "Can not resample %d channels @ %d Hz to %d channels @ %d Hz\n", |
| 850 | 849 | dec->channels, dec->sample_rate, |
| 851 | 850 | enc->channels, enc->sample_rate); |
| 852 | | − ffmpeg_exit(1); |
| 851 | + exit_program(1); |
| 853 | 852 | } |
| 854 | 853 | } |
| 855 | 854 | } |
| @@ -865,7 +864,7 @@ need_realloc: · 9 unmodified lines |
| 865 | 864 | fprintf(stderr, "Cannot convert %s sample format to %s sample format\n", |
| 866 | 865 | av_get_sample_fmt_name(dec->sample_fmt), |
| 867 | 866 | av_get_sample_fmt_name(enc->sample_fmt)); |
| 868 | | − ffmpeg_exit(1); |
| 867 | + exit_program(1); |
| 869 | 868 | } |
| 870 | 869 | ost->reformat_pair=MAKE_SFMT_PAIR(enc->sample_fmt,dec->sample_fmt); |
| 871 | 870 | } |
| @@ -938,7 +937,7 @@ need_realloc: · 66 unmodified lines |
| 938 | 937 | if (av_audio_convert(ost->reformat_ctx, obuf, ostride, ibuf, istride, len)<0) { |
| 939 | 938 | printf("av_audio_convert() failed\n"); |
| 940 | 939 | if (exit_on_error) |
| 941 | | − ffmpeg_exit(1); |
| 940 | + exit_program(1); |
| 942 | 941 | return; |
| 943 | 942 | } |
| 944 | 943 | buftmp = audio_buf; |
| @@ -950,7 +949,7 @@ need_realloc: · 5 unmodified lines |
| 950 | 949 | /* output resampled raw samples */ |
| 951 | 950 | if (av_fifo_realloc2(ost->fifo, av_fifo_size(ost->fifo) + size_out) < 0) { |
| 952 | 951 | fprintf(stderr, "av_fifo_realloc2() failed\n"); |
| 953 | | − ffmpeg_exit(1); |
| 952 | + exit_program(1); |
| 954 | 953 | } |
| 955 | 954 | av_fifo_generic_write(ost->fifo, buftmp, size_out, NULL); |
| 956 | 955 | |
| @@ -968,7 +967,7 @@ need_realloc: · 11 unmodified lines |
| 968 | 967 | (short *)audio_buf); |
| 969 | 968 | if (ret < 0) { |
| 970 | 969 | fprintf(stderr, "Audio encoding failed\n"); |
| 971 | | − ffmpeg_exit(1); |
| 970 | + exit_program(1); |
| 972 | 971 | } |
| 973 | 972 | audio_size += ret; |
| 974 | 973 | pkt.stream_index= ost->index; |
| @@ -995,7 +994,7 @@ need_realloc: · 20 unmodified lines |
| 995 | 994 | |
| 996 | 995 | if(size_out > audio_out_size){ |
| 997 | 996 | fprintf(stderr, "Internal error, buffer size too small\n"); |
| 998 | | − ffmpeg_exit(1); |
| 997 | + exit_program(1); |
| 999 | 998 | } |
| 1000 | 999 | |
| 1001 | 1000 | //FIXME pass ost->sync_opts as AVFrame.pts in avcodec_encode_audio() |
| @@ -1003,7 +1002,7 @@ need_realloc: · 1 unmodified line |
| 1003 | 1002 | (short *)buftmp); |
| 1004 | 1003 | if (ret < 0) { |
| 1005 | 1004 | fprintf(stderr, "Audio encoding failed\n"); |
| 1006 | | − ffmpeg_exit(1); |
| 1005 | + exit_program(1); |
| 1007 | 1006 | } |
| 1008 | 1007 | audio_size += ret; |
| 1009 | 1008 | pkt.stream_index= ost->index; |
| @@ -1073,7 +1072,7 @@ static void do_subtitle_out(AVFormatContext *s, · 63 unmodified lines |
| 1073 | 1072 | if (pts == AV_NOPTS_VALUE) { |
| 1074 | 1073 | fprintf(stderr, "Subtitle packets must have a pts\n"); |
| 1075 | 1074 | if (exit_on_error) |
| 1076 | | − ffmpeg_exit(1); |
| 1075 | + exit_program(1); |
| 1077 | 1076 | return; |
| 1078 | 1077 | } |
| 1079 | 1078 | |
| @@ -1101,7 +1100,7 @@ static void do_subtitle_out(AVFormatContext *s, · 21 unmodified lines |
| 1101 | 1100 | subtitle_out_max_size, sub); |
| 1102 | 1101 | if (subtitle_out_size < 0) { |
| 1103 | 1102 | fprintf(stderr, "Subtitle encoding failed\n"); |
| 1104 | | − ffmpeg_exit(1); |
| 1103 | + exit_program(1); |
| 1105 | 1104 | } |
| 1106 | 1105 | |
| 1107 | 1106 | av_init_packet(&pkt); |
| @@ -1188,7 +1187,7 @@ static void do_video_out(AVFormatContext *s, · 80 unmodified lines |
| 1188 | 1187 | ost->resample_width, ost->resample_height, av_get_pix_fmt_name(ost->resample_pix_fmt), |
| 1189 | 1188 | dec->width , dec->height , av_get_pix_fmt_name(dec->pix_fmt)); |
| 1190 | 1189 | if(!ost->video_resample) |
| 1191 | | − ffmpeg_exit(1); |
| 1190 | + exit_program(1); |
| 1192 | 1191 | } |
| 1193 | 1192 | |
| 1194 | 1193 | #if !CONFIG_AVFILTER |
| @@ -1207,7 +1206,7 @@ static void do_video_out(AVFormatContext *s, · 12 unmodified lines |
| 1207 | 1206 | ost->sws_flags, NULL, NULL, NULL); |
| 1208 | 1207 | if (ost->img_resample_ctx == NULL) { |
| 1209 | 1208 | fprintf(stderr, "Cannot get resampling context\n"); |
| 1210 | | − ffmpeg_exit(1); |
| 1209 | + exit_program(1); |
| 1211 | 1210 | } |
| 1212 | 1211 | } |
| 1213 | 1212 | sws_scale(ost->img_resample_ctx, formatted_picture->data, formatted_picture->linesize, |
| @@ -1267,7 +1266,7 @@ static void do_video_out(AVFormatContext *s, · 53 unmodified lines |
| 1267 | 1266 | &big_picture); |
| 1268 | 1267 | if (ret < 0) { |
| 1269 | 1268 | fprintf(stderr, "Video encoding failed\n"); |
| 1270 | | − ffmpeg_exit(1); |
| 1269 | + exit_program(1); |
| 1271 | 1270 | } |
| 1272 | 1271 | |
| 1273 | 1272 | if(ret>0){ |
| @@ -1313,7 +1312,7 @@ static void do_video_stats(AVFormatContext *os, OutputStream *ost, · 39 unmodified lines |
| 1313 | 1312 | vstats_file = fopen(vstats_filename, "w"); |
| 1314 | 1313 | if (!vstats_file) { |
| 1315 | 1314 | perror("fopen"); |
| 1316 | | − ffmpeg_exit(1); |
| 1315 | + exit_program(1); |
| 1317 | 1316 | } |
| 1318 | 1317 | } |
| 1319 | 1318 | |
| @@ -1818,7 +1817,7 @@ static int output_packet(InputStream *ist, int ist_index, · 498 unmodified lines |
| 1818 | 1817 | } else { /* pad */ |
| 1819 | 1818 | int frame_bytes = enc->frame_size*osize*enc->channels; |
| 1820 | 1819 | if (allocated_audio_buf_size < frame_bytes) |
| 1821 | | − ffmpeg_exit(1); |
| 1820 | + exit_program(1); |
| 1822 | 1821 | generate_silence(audio_buf+fifo_bytes, enc->sample_fmt, frame_bytes - fifo_bytes); |
| 1823 | 1822 | } |
| 1824 | 1823 | |
| @@ -1832,7 +1831,7 @@ static int output_packet(InputStream *ist, int ist_index, · 7 unmodified lines |
| 1832 | 1831 | } |
| 1833 | 1832 | if (ret < 0) { |
| 1834 | 1833 | fprintf(stderr, "Audio encoding failed\n"); |
| 1835 | | − ffmpeg_exit(1); |
| 1834 | + exit_program(1); |
| 1836 | 1835 | } |
| 1837 | 1836 | audio_size += ret; |
| 1838 | 1837 | pkt.flags |= AV_PKT_FLAG_KEY; |
| @@ -1841,7 +1840,7 @@ static int output_packet(InputStream *ist, int ist_index, · 2 unmodified lines |
| 1841 | 1840 | ret = avcodec_encode_video(enc, bit_buffer, bit_buffer_size, NULL); |
| 1842 | 1841 | if (ret < 0) { |
| 1843 | 1842 | fprintf(stderr, "Video encoding failed\n"); |
| 1844 | | − ffmpeg_exit(1); |
| 1843 | + exit_program(1); |
| 1845 | 1844 | } |
| 1846 | 1845 | video_size += ret; |
| 1847 | 1846 | if(enc->coded_frame && enc->coded_frame->key_frame) |
| @@ -1933,7 +1932,7 @@ static void parse_forced_key_frames(char *kf, OutputStream *ost, · 85 unmodified lines |
| 1933 | 1932 | ost->forced_kf_pts = av_malloc(sizeof(*ost->forced_kf_pts) * n); |
| 1934 | 1933 | if (!ost->forced_kf_pts) { |
| 1935 | 1934 | av_log(NULL, AV_LOG_FATAL, "Could not allocate forced key frames array.\n"); |
| 1936 | | − ffmpeg_exit(1); |
| 1935 | + exit_program(1); |
| 1937 | 1936 | } |
| 1938 | 1937 | for (i = 0; i < n; i++) { |
| 1939 | 1938 | p = i ? strchr(p, ',') + 1 : kf; |
| @@ -2024,7 +2023,7 @@ static int transcode(AVFormatContext **output_files, · 84 unmodified lines |
| 2024 | 2023 | fprintf(stderr, "Codec type mismatch for mapping #%d.%d -> #%d.%d\n", |
| 2025 | 2024 | stream_maps[n].file_index, stream_maps[n].stream_index, |
| 2026 | 2025 | ost->file_index, ost->index); |
| 2027 | | − ffmpeg_exit(1); |
| 2026 | + exit_program(1); |
| 2028 | 2027 | } |
| 2029 | 2028 | |
| 2030 | 2029 | } else { |
| @@ -2074,7 +2073,7 @@ static int transcode(AVFormatContext **output_files, · 43 unmodified lines |
| 2074 | 2073 | av_dump_format(output_files[i], i, output_files[i]->filename, 1); |
| 2075 | 2074 | fprintf(stderr, "Could not find input stream matching output stream #%d.%d\n", |
| 2076 | 2075 | ost->file_index, ost->index); |
| 2077 | | − ffmpeg_exit(1); |
| 2076 | + exit_program(1); |
| 2078 | 2077 | } |
| 2079 | 2078 | } |
| 2080 | 2079 | } |
| @@ -2139,7 +2138,7 @@ static int transcode(AVFormatContext **output_files, · 58 unmodified lines |
| 2139 | 2138 | case AVMEDIA_TYPE_AUDIO: |
| 2140 | 2139 | if(audio_volume != 256) { |
| 2141 | 2140 | fprintf(stderr,"-acodec copy and -vol are incompatible (frames are not decoded)\n"); |
| 2142 | | − ffmpeg_exit(1); |
| 2141 | + exit_program(1); |
| 2143 | 2142 | } |
| 2144 | 2143 | codec->channel_layout = icodec->channel_layout; |
| 2145 | 2144 | codec->sample_rate = icodec->sample_rate; |
| @@ -2213,7 +2212,7 @@ static int transcode(AVFormatContext **output_files, · 67 unmodified lines |
| 2213 | 2212 | |
| 2214 | 2213 | if (ost->st->codec->pix_fmt == PIX_FMT_NONE) { |
| 2215 | 2214 | fprintf(stderr, "Video pixel format is unknown, stream cannot be encoded\n"); |
| 2216 | | − ffmpeg_exit(1); |
| 2215 | + exit_program(1); |
| 2217 | 2216 | } |
| 2218 | 2217 | |
| 2219 | 2218 | if (!codec->width || !codec->height) { |
| @@ -2230,7 +2229,7 @@ static int transcode(AVFormatContext **output_files, · 10 unmodified lines |
| 2230 | 2229 | if(avpicture_alloc((AVPicture*)&ost->pict_tmp, codec->pix_fmt, |
| 2231 | 2230 | codec->width, codec->height)) { |
| 2232 | 2231 | fprintf(stderr, "Cannot allocate temp picture, check pix fmt\n"); |
| 2233 | | − ffmpeg_exit(1); |
| 2232 | + exit_program(1); |
| 2234 | 2233 | } |
| 2235 | 2234 | ost->img_resample_ctx = sws_getContext( |
| 2236 | 2235 | icodec->width, |
| @@ -2242,7 +2241,7 @@ static int transcode(AVFormatContext **output_files, · 5 unmodified lines |
| 2242 | 2241 | ost->sws_flags, NULL, NULL, NULL); |
| 2243 | 2242 | if (ost->img_resample_ctx == NULL) { |
| 2244 | 2243 | fprintf(stderr, "Cannot get resampling context\n"); |
| 2245 | | − ffmpeg_exit(1); |
| 2244 | + exit_program(1); |
| 2246 | 2245 | } |
| 2247 | 2246 | #endif |
| 2248 | 2247 | codec->bits_per_raw_sample= 0; |
| @@ -2290,7 +2289,7 @@ static int transcode(AVFormatContext **output_files, · 41 unmodified lines |
| 2290 | 2289 | f = fopen(logfilename, "wb"); |
| 2291 | 2290 | if (!f) { |
| 2292 | 2291 | fprintf(stderr, "Cannot write log file '%s' for pass-1 encoding: %s\n", logfilename, strerror(errno)); |
| 2293 | | − ffmpeg_exit(1); |
| 2292 | + exit_program(1); |
| 2294 | 2293 | } |
| 2295 | 2294 | ost->logfile = f; |
| 2296 | 2295 | } else { |
| @@ -2298,7 +2297,7 @@ static int transcode(AVFormatContext **output_files, · 1 unmodified line |
| 2298 | 2297 | size_t logbuffer_size; |
| 2299 | 2298 | if (read_file(logfilename, &logbuffer, &logbuffer_size) < 0) { |
| 2300 | 2299 | fprintf(stderr, "Error reading log file '%s' for pass-2 encoding\n", logfilename); |
| 2301 | | − ffmpeg_exit(1); |
| 2300 | + exit_program(1); |
| 2302 | 2301 | } |
| 2303 | 2302 | codec->stats_in = logbuffer; |
| 2304 | 2303 | } |
| @@ -2670,7 +2669,7 @@ static int transcode(AVFormatContext **output_files, · 365 unmodified lines |
| 2670 | 2669 | fprintf(stderr, "Error while decoding stream #%d.%d\n", |
| 2671 | 2670 | ist->file_index, ist->st->index); |
| 2672 | 2671 | if (exit_on_error) |
| 2673 | | − ffmpeg_exit(1); |
| 2672 | + exit_program(1); |
| 2674 | 2673 | av_free_packet(&pkt); |
| 2675 | 2674 | goto redo; |
| 2676 | 2675 | } |
| @@ -2785,7 +2784,7 @@ static int opt_frame_rate(const char *opt, const char *arg) · 108 unmodified lines |
| 2785 | 2784 | { |
| 2786 | 2785 | if (av_parse_video_rate(&frame_rate, arg) < 0) { |
| 2787 | 2786 | fprintf(stderr, "Incorrect value for %s: %s\n", opt, arg); |
| 2788 | | − ffmpeg_exit(1); |
| 2787 | + exit_program(1); |
| 2789 | 2788 | } |
| 2790 | 2789 | return 0; |
| 2791 | 2790 | } |
| @@ -2820,7 +2819,7 @@ static int opt_frame_pix_fmt(const char *opt, const char *arg) · 28 unmodified lines |
| 2820 | 2819 | } |
| 2821 | 2820 | } else { |
| 2822 | 2821 | show_pix_fmts(); |
| 2823 | | − ffmpeg_exit(0); |
| 2822 | + exit_program(0); |
| 2824 | 2823 | } |
| 2825 | 2824 | return 0; |
| 2826 | 2825 | } |
| @@ -2856,7 +2855,7 @@ static int opt_metadata(const char *opt, const char *arg) · 29 unmodified lines |
| 2856 | 2855 | |
| 2857 | 2856 | if(!mid){ |
| 2858 | 2857 | fprintf(stderr, "Missing =\n"); |
| 2859 | | − ffmpeg_exit(1); |
| 2858 | + exit_program(1); |
| 2860 | 2859 | } |
| 2861 | 2860 | *mid++= 0; |
| 2862 | 2861 | |
| @@ -2904,7 +2903,7 @@ static int opt_audio_sample_fmt(const char *opt, const char *arg) · 41 unmodified lines |
| 2904 | 2903 | char fmt_str[128]; |
| 2905 | 2904 | for (i = -1; i < AV_SAMPLE_FMT_NB; i++) |
| 2906 | 2905 | printf("%s\n", av_get_sample_fmt_string(fmt_str, sizeof(fmt_str), i)); |
| 2907 | | − ffmpeg_exit(0); |
| 2906 | + exit_program(0); |
| 2908 | 2907 | } |
| 2909 | 2908 | return 0; |
| 2910 | 2909 | } |
| @@ -3026,7 +3025,7 @@ static void parse_meta_type(char *arg, char *type, int *index, char **endptr) · 115 unmodified lines |
| 3026 | 3025 | break; |
| 3027 | 3026 | default: |
| 3028 | 3027 | fprintf(stderr, "Invalid metadata type %c.\n", *arg); |
| 3029 | | − ffmpeg_exit(1); |
| 3028 | + exit_program(1); |
| 3030 | 3029 | } |
| 3031 | 3030 | } else |
| 3032 | 3031 | *type = 'g'; |
| @@ -3142,11 +3141,11 @@ static enum CodecID find_codec_or_die(const char *name, int type, int encoder) · 109 unmodified lines |
| 3142 | 3141 | avcodec_find_decoder_by_name(name); |
| 3143 | 3142 | if(!codec) { |
| 3144 | 3143 | fprintf(stderr, "Unknown %s '%s'\n", codec_string, name); |
| 3145 | | − ffmpeg_exit(1); |
| 3144 | + exit_program(1); |
| 3146 | 3145 | } |
| 3147 | 3146 | if(codec->type != type) { |
| 3148 | 3147 | fprintf(stderr, "Invalid %s type '%s'\n", codec_string, name); |
| 3149 | | − ffmpeg_exit(1); |
| 3148 | + exit_program(1); |
| 3150 | 3149 | } |
| 3151 | 3150 | return codec->id; |
| 3152 | 3151 | } |
| @@ -3164,7 +3163,7 @@ static int opt_input_file(const char *opt, const char *filename) · 11 unmodified lines |
| 3164 | 3163 | if (last_asked_format) { |
| 3165 | 3164 | if (!(file_iformat = av_find_input_format(last_asked_format))) { |
| 3166 | 3165 | fprintf(stderr, "Unknown input format: '%s'\n", last_asked_format); |
| 3167 | | − ffmpeg_exit(1); |
| 3166 | + exit_program(1); |
| 3168 | 3167 | } |
| 3169 | 3168 | last_asked_format = NULL; |
| 3170 | 3169 | } |
| @@ -3179,7 +3178,7 @@ static int opt_input_file(const char *opt, const char *filename) · 8 unmodified lines |
| 3179 | 3178 | ic = avformat_alloc_context(); |
| 3180 | 3179 | if (!ic) { |
| 3181 | 3180 | print_error(filename, AVERROR(ENOMEM)); |
| 3182 | | − ffmpeg_exit(1); |
| 3181 | + exit_program(1); |
| 3183 | 3182 | } |
| 3184 | 3183 | if (audio_sample_rate) { |
| 3185 | 3184 | snprintf(buf, sizeof(buf), "%d", audio_sample_rate); |
| @@ -3212,7 +3211,7 @@ static int opt_input_file(const char *opt, const char *filename) · 26 unmodified lines |
| 3212 | 3211 | err = avformat_open_input(&ic, filename, file_iformat, &format_opts); |
| 3213 | 3212 | if (err < 0) { |
| 3214 | 3213 | print_error(filename, err); |
| 3215 | | − ffmpeg_exit(1); |
| 3214 | + exit_program(1); |
| 3216 | 3215 | } |
| 3217 | 3216 | assert_avoptions(format_opts); |
| 3218 | 3217 | |
| @@ -3235,7 +3234,7 @@ static int opt_input_file(const char *opt, const char *filename) · 16 unmodified lines |
| 3235 | 3234 | } |
| 3236 | 3235 | if(!found){ |
| 3237 | 3236 | fprintf(stderr, "Specified program id not found\n"); |
| 3238 | | − ffmpeg_exit(1); |
| 3237 | + exit_program(1); |
| 3239 | 3238 | } |
| 3240 | 3239 | opt_programid=0; |
| 3241 | 3240 | } |
| @@ -3255,7 +3254,7 @@ static int opt_input_file(const char *opt, const char *filename) · 13 unmodified lines |
| 3255 | 3254 | if (ret < 0 && verbose >= 0) { |
| 3256 | 3255 | fprintf(stderr, "%s: could not find codec parameters\n", filename); |
| 3257 | 3256 | av_close_input_file(ic); |
| 3258 | | − ffmpeg_exit(1); |
| 3257 | + exit_program(1); |
| 3259 | 3258 | } |
| 3260 | 3259 | |
| 3261 | 3260 | timestamp = start_time; |
| @@ -3491,7 +3490,7 @@ static void new_video_stream(AVFormatContext *oc, int file_idx) · 229 unmodified lines |
| 3491 | 3490 | int e=sscanf(p, "%d,%d,%d", &start, &end, &q); |
| 3492 | 3491 | if(e!=3){ |
| 3493 | 3492 | fprintf(stderr, "error parsing rc_override\n"); |
| 3494 | | − ffmpeg_exit(1); |
| 3493 | + exit_program(1); |
| 3495 | 3494 | } |
| 3496 | 3495 | video_enc->rc_override= |
| 3497 | 3496 | av_realloc(video_enc->rc_override, |
| @@ -3615,7 +3614,7 @@ static void new_data_stream(AVFormatContext *oc, int file_idx) · 117 unmodified lines |
| 3615 | 3614 | data_enc = st->codec; |
| 3616 | 3615 | if (!data_stream_copy) { |
| 3617 | 3616 | fprintf(stderr, "Data stream encoding not supported yet (only streamcopy)\n"); |
| 3618 | | − ffmpeg_exit(1); |
| 3617 | + exit_program(1); |
| 3619 | 3618 | } |
| 3620 | 3619 | |
| 3621 | 3620 | data_enc->codec_type = AVMEDIA_TYPE_DATA; |
| @@ -3689,7 +3688,7 @@ static int opt_new_stream(const char *opt, const char *arg) · 67 unmodified lines |
| 3689 | 3688 | int file_idx = nb_output_files - 1; |
| 3690 | 3689 | if (nb_output_files <= 0) { |
| 3691 | 3690 | fprintf(stderr, "At least one output file must be specified\n"); |
| 3692 | | − ffmpeg_exit(1); |
| 3691 | + exit_program(1); |
| 3693 | 3692 | } |
| 3694 | 3693 | oc = output_files[file_idx]; |
| 3695 | 3694 | |
| @@ -3714,7 +3713,7 @@ static int opt_streamid(const char *opt, const char *arg) · 18 unmodified lines |
| 3714 | 3713 | fprintf(stderr, |
| 3715 | 3714 | "Invalid value '%s' for option '%s', required syntax is 'index:value'\n", |
| 3716 | 3715 | arg, opt); |
| 3717 | | − ffmpeg_exit(1); |
| 3716 | + exit_program(1); |
| 3718 | 3717 | } |
| 3719 | 3718 | *p++ = '\0'; |
| 3720 | 3719 | idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, INT_MAX); |
| @@ -3736,14 +3735,14 @@ static void opt_output_file(const char *filename) · 15 unmodified lines |
| 3736 | 3735 | oc = avformat_alloc_context(); |
| 3737 | 3736 | if (!oc) { |
| 3738 | 3737 | print_error(filename, AVERROR(ENOMEM)); |
| 3739 | | − ffmpeg_exit(1); |
| 3738 | + exit_program(1); |
| 3740 | 3739 | } |
| 3741 | 3740 | |
| 3742 | 3741 | if (last_asked_format) { |
| 3743 | 3742 | file_oformat = av_guess_format(last_asked_format, NULL, NULL); |
| 3744 | 3743 | if (!file_oformat) { |
| 3745 | 3744 | fprintf(stderr, "Requested output format '%s' is not a suitable output format\n", last_asked_format); |
| 3746 | | − ffmpeg_exit(1); |
| 3745 | + exit_program(1); |
| 3747 | 3746 | } |
| 3748 | 3747 | last_asked_format = NULL; |
| 3749 | 3748 | } else { |
| @@ -3751,7 +3750,7 @@ static void opt_output_file(const char *filename) · 1 unmodified line |
| 3751 | 3750 | if (!file_oformat) { |
| 3752 | 3751 | fprintf(stderr, "Unable to find a suitable output format for '%s'\n", |
| 3753 | 3752 | filename); |
| 3754 | | − ffmpeg_exit(1); |
| 3753 | + exit_program(1); |
| 3755 | 3754 | } |
| 3756 | 3755 | } |
| 3757 | 3756 | |
| @@ -3765,7 +3764,7 @@ static void opt_output_file(const char *filename) · 7 unmodified lines |
| 3765 | 3764 | int err = read_avserver_streams(oc, filename); |
| 3766 | 3765 | if (err < 0) { |
| 3767 | 3766 | print_error(filename, err); |
| 3768 | | − ffmpeg_exit(1); |
| 3767 | + exit_program(1); |
| 3769 | 3768 | } |
| 3770 | 3769 | } else { |
| 3771 | 3770 | use_video = file_oformat->video_codec != CODEC_ID_NONE || video_stream_copy || video_codec_name; |
| @@ -3810,7 +3809,7 @@ static void opt_output_file(const char *filename) · 38 unmodified lines |
| 3810 | 3809 | if (oc->oformat->flags & AVFMT_NEEDNUMBER) { |
| 3811 | 3810 | if (!av_filename_number_test(oc->filename)) { |
| 3812 | 3811 | print_error(oc->filename, AVERROR(EINVAL)); |
| 3813 | | − ffmpeg_exit(1); |
| 3812 | + exit_program(1); |
| 3814 | 3813 | } |
| 3815 | 3814 | } |
| 3816 | 3815 | |
| @@ -3826,12 +3825,12 @@ static void opt_output_file(const char *filename) · 9 unmodified lines |
| 3826 | 3825 | fflush(stderr); |
| 3827 | 3826 | if (!read_yesno()) { |
| 3828 | 3827 | fprintf(stderr, "Not overwriting - exiting\n"); |
| 3829 | | − ffmpeg_exit(1); |
| 3828 | + exit_program(1); |
| 3830 | 3829 | } |
| 3831 | 3830 | } |
| 3832 | 3831 | else { |
| 3833 | 3832 | fprintf(stderr,"File '%s' already exists. Exiting.\n", filename); |
| 3834 | | − ffmpeg_exit(1); |
| 3833 | + exit_program(1); |
| 3835 | 3834 | } |
| 3836 | 3835 | } |
| 3837 | 3836 | } |
| @@ -3839,7 +3838,7 @@ static void opt_output_file(const char *filename) · 1 unmodified line |
| 3839 | 3838 | /* open the file */ |
| 3840 | 3839 | if ((err = avio_open(&oc->pb, filename, AVIO_FLAG_WRITE)) < 0) { |
| 3841 | 3840 | print_error(filename, err); |
| 3842 | | − ffmpeg_exit(1); |
| 3841 | + exit_program(1); |
| 3843 | 3842 | } |
| 3844 | 3843 | } |
| 3845 | 3844 | |
| @@ -3917,7 +3916,7 @@ static void parse_matrix_coeffs(uint16_t *dest, const char *str) · 71 unmodified lines |
| 3917 | 3916 | p = strchr(p, ','); |
| 3918 | 3917 | if(!p) { |
| 3919 | 3918 | fprintf(stderr, "Syntax error in matrix \"%s\" at coeff %d\n", str, i); |
| 3920 | | − ffmpeg_exit(1); |
| 3919 | + exit_program(1); |
| 3921 | 3920 | } |
| 3922 | 3921 | p++; |
| 3923 | 3922 | } |
| @@ -4065,7 +4064,7 @@ static int opt_target(const char *opt, const char *arg) · 141 unmodified lines |
| 4065 | 4064 | fprintf(stderr, "Could not determine norm (PAL/NTSC/NTSC-Film) for target.\n"); |
| 4066 | 4065 | fprintf(stderr, "Please prefix target with \"pal-\", \"ntsc-\" or \"film-\",\n"); |
| 4067 | 4066 | fprintf(stderr, "or set a framerate with \"-r xxx\".\n"); |
| 4068 | | − ffmpeg_exit(1); |
| 4067 | + exit_program(1); |
| 4069 | 4068 | } |
| 4070 | 4069 | |
| 4071 | 4070 | if(!strcmp(arg, "vcd")) { |
| @@ -4182,7 +4181,7 @@ static int opt_bsf(const char *opt, const char *arg) · 110 unmodified lines |
| 4182 | 4181 | |
| 4183 | 4182 | if(!bsfc){ |
| 4184 | 4183 | fprintf(stderr, "Unknown bitstream filter %s\n", arg); |
| 4185 | | − ffmpeg_exit(1); |
| 4184 | + exit_program(1); |
| 4186 | 4185 | } |
| 4187 | 4186 | |
| 4188 | 4187 | bsfp= *opt == 'v' ? &video_bitstream_filters : |
| @@ -4206,7 +4205,7 @@ static int opt_preset(const char *opt, const char *arg) · 17 unmodified lines |
| 4206 | 4205 | |
| 4207 | 4206 | if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) { |
| 4208 | 4207 | fprintf(stderr, "File for preset '%s' not found\n", arg); |
| 4209 | | − ffmpeg_exit(1); |
| 4208 | + exit_program(1); |
| 4210 | 4209 | } |
| 4211 | 4210 | |
| 4212 | 4211 | while(!feof(f)){ |
| @@ -4216,7 +4215,7 @@ static int opt_preset(const char *opt, const char *arg) · 3 unmodified lines |
| 4216 | 4215 | e|= sscanf(line, "%999[^=]=%999[^\n]\n", tmp, tmp2) - 2; |
| 4217 | 4216 | if(e){ |
| 4218 | 4217 | fprintf(stderr, "%s: Invalid syntax: '%s'\n", filename, line); |
| 4219 | | − ffmpeg_exit(1); |
| 4218 | + exit_program(1); |
| 4220 | 4219 | } |
| 4221 | 4220 | if(!strcmp(tmp, "acodec")){ |
| 4222 | 4221 | opt_audio_codec(tmp, tmp2); |
| @@ -4228,7 +4227,7 @@ static int opt_preset(const char *opt, const char *arg) · 5 unmodified lines |
| 4228 | 4227 | opt_data_codec(tmp, tmp2); |
| 4229 | 4228 | }else if(opt_default(tmp, tmp2) < 0){ |
| 4230 | 4229 | fprintf(stderr, "%s: Invalid option or argument: '%s', parsed as '%s' = '%s'\n", filename, line, tmp, tmp2); |
| 4231 | | − ffmpeg_exit(1); |
| 4230 | + exit_program(1); |
| 4232 | 4231 | } |
| 4233 | 4232 | } |
| 4234 | 4233 | |
| @@ -4402,29 +4401,30 @@ int main(int argc, char **argv) · 167 unmodified lines |
| 4402 | 4401 | if(nb_output_files <= 0 && nb_input_files == 0) { |
| 4403 | 4402 | show_usage(); |
| 4404 | 4403 | fprintf(stderr, "Use -h to get full help or, even better, run 'man ffmpeg'\n"); |
| 4405 | | − ffmpeg_exit(1); |
| 4404 | + exit_program(1); |
| 4406 | 4405 | } |
| 4407 | 4406 | |
| 4408 | 4407 | /* file converter / grab */ |
| 4409 | 4408 | if (nb_output_files <= 0) { |
| 4410 | 4409 | fprintf(stderr, "At least one output file must be specified\n"); |
| 4411 | | − ffmpeg_exit(1); |
| 4410 | + exit_program(1); |
| 4412 | 4411 | } |
| 4413 | 4412 | |
| 4414 | 4413 | if (nb_input_files == 0) { |
| 4415 | 4414 | fprintf(stderr, "At least one input file must be specified\n"); |
| 4416 | | − ffmpeg_exit(1); |
| 4415 | + exit_program(1); |
| 4417 | 4416 | } |
| 4418 | 4417 | |
| 4419 | 4418 | ti = getutime(); |
| 4420 | 4419 | if (transcode(output_files, nb_output_files, input_files, nb_input_files, |
| 4421 | 4420 | stream_maps, nb_stream_maps) < 0) |
| 4422 | | − ffmpeg_exit(1); |
| 4421 | + exit_program(1); |
| 4423 | 4422 | ti = getutime() - ti; |
| 4424 | 4423 | if (do_benchmark) { |
| 4425 | 4424 | int maxrss = getmaxrss() / 1024; |
| 4426 | 4425 | printf("bench: utime=%0.3fs maxrss=%ikB\n", ti / 1000000.0, maxrss); |
| 4427 | 4426 | } |
| 4428 | 4427 | |
| 4429 | | − return ffmpeg_exit(0); |
| 4428 | + exit_program(0); |
| 4429 | + return 0; |
| 4430 | 4430 | } |