History

cmdutils: move exit_program() declaration to cmdutils from avconv

Allows cmdutils to call each tool's own cleanup function.

Anton Khirnov committed 15 years ago

Commit dad09ff1 parent 346ea9e7 files · +105 −83Browse files

Unified · Split

7 files
  1. avconv.c +3 −3
  2. avplay.c +5 −0
  3. avprobe.c +5 −0
  4. avserver.c +5 −0
  5. cmdutils.c +8 −7
  6. cmdutils.h +6 −0
  7. ffmpeg.c +73 −73
avconv.c+3−3
@@ -433,7 +433,7 @@ static int decode_interrupt_cb(void) · 432 unmodified lines
433 return received_nb_signals > 1;433 return received_nb_signals > 1;
434}434}
435 435
436static int exit_program(int ret)436void exit_program(int ret)
437{437{
438 int i;438 int i;
439 439
@@ -483,7 +483,6 @@ static int exit_program(int ret) · 43 unmodified lines
483 }483 }
484 484
485 exit(ret); /* not all OS-es handle main() return value */485 exit(ret); /* not all OS-es handle main() return value */
486 return ret;
487}486}
488 487
489static void assert_avoptions(AVDictionary *m)488static void assert_avoptions(AVDictionary *m)
@@ -4192,5 +4191,6 @@ int main(int argc, char **argv) · 3702 unmodified lines
4192 printf("bench: utime=%0.3fs maxrss=%ikB\n", ti / 1000000.0, maxrss);4191 printf("bench: utime=%0.3fs maxrss=%ikB\n", ti / 1000000.0, maxrss);
4193 }4192 }
4194 4193
4195 return exit_program(0);4194 exit_program(0);
4195 return 0;
4196}4196}
avplay.c+5−0
@@ -278,6 +278,11 @@ static AVPacket flush_pkt; · 277 unmodified lines
278 278
279static SDL_Surface *screen;279static SDL_Surface *screen;
280 280
281void exit_program(int ret)
282{
283 exit(ret);
284}
285
281static int packet_queue_put(PacketQueue *q, AVPacket *pkt);286static int packet_queue_put(PacketQueue *q, AVPacket *pkt);
282 287
283/* packet queue handling */288/* packet queue handling */
avprobe.c+5−0
@@ -56,6 +56,11 @@ static const char *unit_hertz_str = "Hz" ; · 55 unmodified lines
56static const char *unit_byte_str = "byte" ;56static const char *unit_byte_str = "byte" ;
57static const char *unit_bit_per_second_str = "bit/s";57static const char *unit_bit_per_second_str = "bit/s";
58 58
59void exit_program(int ret)
60{
61 exit(ret);
62}
63
59static char *value_string(char *buf, int buf_size, double val, const char *unit)64static char *value_string(char *buf, int buf_size, double val, const char *unit)
60{65{
61 if (unit == unit_second_str && use_value_sexagesimal_format) {66 if (unit == unit_second_str && use_value_sexagesimal_format) {
avserver.c+5−0
@@ -320,6 +320,11 @@ static AVLFG random_state; · 319 unmodified lines
320 320
321static FILE *logfile = NULL;321static FILE *logfile = NULL;
322 322
323void exit_program(int ret)
324{
325 exit(ret);
326}
327
323/* FIXME: make avserver work with IPv6 */328/* FIXME: make avserver work with IPv6 */
324/* resolve host with also IP address parsing */329/* resolve host with also IP address parsing */
325static int resolve_host(struct in_addr *sin_addr, const char *hostname)330static int resolve_host(struct in_addr *sin_addr, const char *hostname)
cmdutils.c+8−7
@@ -92,7 +92,8 @@ double parse_number_or_die(const char *context, const char *numstr, int type, do · 91 unmodified lines
92 else92 else
93 return d;93 return d;
94 fprintf(stderr, error, context, numstr, min, max);94 fprintf(stderr, error, context, numstr, min, max);
95 exit(1);95 exit_program(1);
96 return 0;
96}97}
97 98
98int64_t parse_time_or_die(const char *context, const char *timestr, int is_duration)99int64_t parse_time_or_die(const char *context, const char *timestr, int is_duration)
@@ -101,7 +102,7 @@ int64_t parse_time_or_die(const char *context, const char *timestr, int is_durat · 2 unmodified lines
101 if (av_parse_time(&us, timestr, is_duration) < 0) {102 if (av_parse_time(&us, timestr, is_duration) < 0) {
102 fprintf(stderr, "Invalid %s specification for %s: %s\n",103 fprintf(stderr, "Invalid %s specification for %s: %s\n",
103 is_duration ? "duration" : "date", context, timestr);104 is_duration ? "duration" : "date", context, timestr);
104 exit(1);105 exit_program(1);
105 }106 }
106 return us;107 return us;
107}108}
@@ -237,14 +238,14 @@ void parse_options(int argc, char **argv, const OptionDef *options, · 129 unmodified lines
237 if (!po->name) {238 if (!po->name) {
238unknown_opt:239unknown_opt:
239 fprintf(stderr, "%s: unrecognized option '%s'\n", argv[0], opt);240 fprintf(stderr, "%s: unrecognized option '%s'\n", argv[0], opt);
240 exit(1);241 exit_program(1);
241 }242 }
242 arg = NULL;243 arg = NULL;
243 if (po->flags & HAS_ARG) {244 if (po->flags & HAS_ARG) {
244 arg = argv[optindex++];245 arg = argv[optindex++];
245 if (!arg) {246 if (!arg) {
246 fprintf(stderr, "%s: missing argument for option '%s'\n", argv[0], opt);247 fprintf(stderr, "%s: missing argument for option '%s'\n", argv[0], opt);
247 exit(1);248 exit_program(1);
248 }249 }
249 }250 }
250 if (po->flags & OPT_STRING) {251 if (po->flags & OPT_STRING) {
@@ -262,11 +263,11 @@ unknown_opt: · 11 unmodified lines
262 } else if (po->u.func_arg) {263 } else if (po->u.func_arg) {
263 if (po->u.func_arg(opt, arg) < 0) {264 if (po->u.func_arg(opt, arg) < 0) {
264 fprintf(stderr, "%s: failed to set value '%s' for option '%s'\n", argv[0], arg, opt);265 fprintf(stderr, "%s: failed to set value '%s' for option '%s'\n", argv[0], arg, opt);
265 exit(1);266 exit_program(1);
266 }267 }
267 }268 }
268 if(po->flags & OPT_EXIT)269 if(po->flags & OPT_EXIT)
269 exit(0);270 exit_program(0);
270 } else {271 } else {
271 if (parse_arg_function)272 if (parse_arg_function)
272 parse_arg_function(opt);273 parse_arg_function(opt);
@@ -336,7 +337,7 @@ int opt_loglevel(const char *opt, const char *arg) · 63 unmodified lines
336 "Possible levels are numbers or:\n", arg);337 "Possible levels are numbers or:\n", arg);
337 for (i = 0; i < FF_ARRAY_ELEMS(log_levels); i++)338 for (i = 0; i < FF_ARRAY_ELEMS(log_levels); i++)
338 fprintf(stderr, "\"%s\"\n", log_levels[i].name);339 fprintf(stderr, "\"%s\"\n", log_levels[i].name);
339 exit(1);340 exit_program(1);
340 }341 }
341 av_log_set_level(level);342 av_log_set_level(level);
342 return 0;343 return 0;
cmdutils.h+6−0
@@ -327,4 +327,10 @@ extern AVFilter ffsink; · 326 unmodified lines
327int get_filtered_video_frame(AVFilterContext *sink, AVFrame *frame,327int get_filtered_video_frame(AVFilterContext *sink, AVFrame *frame,
328 AVFilterBufferRef **picref, AVRational *pts_tb);328 AVFilterBufferRef **picref, AVRational *pts_tb);
329 329
330/**
331 * Do all the necessary cleanup and abort.
332 * This function is implemented in the avtools, not cmdutils.
333 */
334void exit_program(int ret);
335
330#endif /* LIBAV_CMDUTILS_H */336#endif /* LIBAV_CMDUTILS_H */
ffmpeg.c+73−73
@@ -445,7 +445,7 @@ static int decode_interrupt_cb(void) · 444 unmodified lines
445 return received_nb_signals > 1;445 return received_nb_signals > 1;
446}446}
447 447
448static int ffmpeg_exit(int ret)448void exit_program(int ret)
449{449{
450 int i;450 int i;
451 451
@@ -501,7 +501,6 @@ static int ffmpeg_exit(int ret) · 49 unmodified lines
501 }501 }
502 502
503 exit(ret); /* not all OS-es handle main() return value */503 exit(ret); /* not all OS-es handle main() return value */
504 return ret;
505}504}
506 505
507static void assert_avoptions(AVDictionary *m)506static void assert_avoptions(AVDictionary *m)
@@ -509,7 +508,7 @@ static void assert_avoptions(AVDictionary *m) · 1 unmodified line
509 AVDictionaryEntry *t;508 AVDictionaryEntry *t;
510 if ((t = av_dict_get(m, "", NULL, AV_DICT_IGNORE_SUFFIX))) {509 if ((t = av_dict_get(m, "", NULL, AV_DICT_IGNORE_SUFFIX))) {
511 av_log(NULL, AV_LOG_ERROR, "Option %s not found.\n", t->key);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 if (!(codec->capabilities & CODEC_CAP_EXPERIMENTAL))525 if (!(codec->capabilities & CODEC_CAP_EXPERIMENTAL))
527 av_log(NULL, AV_LOG_ERROR, "Or use the non experimental %s '%s'.\n",526 av_log(NULL, AV_LOG_ERROR, "Or use the non experimental %s '%s'.\n",
528 codec_string, codec->name);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 if (new_size >= INT_MAX / elem_size) {535 if (new_size >= INT_MAX / elem_size) {
537 fprintf(stderr, "Array too big.\n");536 fprintf(stderr, "Array too big.\n");
538 ffmpeg_exit(1);537 exit_program(1);
539 }538 }
540 if (*size < new_size) {539 if (*size < new_size) {
541 uint8_t *tmp = av_realloc(array, new_size*elem_size);540 uint8_t *tmp = av_realloc(array, new_size*elem_size);
542 if (!tmp) {541 if (!tmp) {
543 fprintf(stderr, "Could not alloc buffer.\n");542 fprintf(stderr, "Could not alloc buffer.\n");
544 ffmpeg_exit(1);543 exit_program(1);
545 }544 }
546 memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size);545 memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size);
547 *size = new_size;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 if (!st) {664 if (!st) {
666 av_log(NULL, AV_LOG_ERROR, "Could not alloc stream.\n");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 output_streams_for_file[file_idx] =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 av_mallocz(sizeof(OutputStream));675 av_mallocz(sizeof(OutputStream));
677 if (!ost) {676 if (!ost) {
678 fprintf(stderr, "Could not alloc output stream\n");677 fprintf(stderr, "Could not alloc output stream\n");
679 ffmpeg_exit(1);678 exit_program(1);
680 }679 }
681 ost->file_index = file_idx;680 ost->file_index = file_idx;
682 ost->index = idx;681 ost->index = idx;
@@ -756,7 +755,7 @@ static void write_frame(AVFormatContext *s, AVPacket *pkt, AVCodecContext *avctx · 73 unmodified lines
756 avctx->codec ? avctx->codec->name : "copy");755 avctx->codec ? avctx->codec->name : "copy");
757 print_error("", a);756 print_error("", a);
758 if (exit_on_error)757 if (exit_on_error)
759 ffmpeg_exit(1);758 exit_program(1);
760 }759 }
761 *pkt= new_pkt;760 *pkt= new_pkt;
762 761
@@ -766,7 +765,7 @@ static void write_frame(AVFormatContext *s, AVPacket *pkt, AVCodecContext *avctx · 3 unmodified lines
766 ret= av_interleaved_write_frame(s, pkt);765 ret= av_interleaved_write_frame(s, pkt);
767 if(ret < 0){766 if(ret < 0){
768 print_error("av_interleaved_write_frame()", ret);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 if(audio_out_size > INT_MAX || audio_buf_size > INT_MAX){802 if(audio_out_size > INT_MAX || audio_buf_size > INT_MAX){
804 fprintf(stderr, "Buffer sizes too large\n");803 fprintf(stderr, "Buffer sizes too large\n");
805 ffmpeg_exit(1);804 exit_program(1);
806 }805 }
807 806
808 av_fast_malloc(&audio_buf, &allocated_audio_buf_size, audio_buf_size);807 av_fast_malloc(&audio_buf, &allocated_audio_buf_size, audio_buf_size);
809 av_fast_malloc(&audio_out, &allocated_audio_out_size, audio_out_size);808 av_fast_malloc(&audio_out, &allocated_audio_out_size, audio_out_size);
810 if (!audio_buf || !audio_out){809 if (!audio_buf || !audio_out){
811 fprintf(stderr, "Out of memory in do_audio_out\n");810 fprintf(stderr, "Out of memory in do_audio_out\n");
812 ffmpeg_exit(1);811 exit_program(1);
813 }812 }
814 813
815 if (enc->channels != dec->channels || enc->sample_rate != dec->sample_rate)814 if (enc->channels != dec->channels || enc->sample_rate != dec->sample_rate)
@@ -849,7 +848,7 @@ need_realloc: · 33 unmodified lines
849 fprintf(stderr, "Can not resample %d channels @ %d Hz to %d channels @ %d Hz\n",848 fprintf(stderr, "Can not resample %d channels @ %d Hz to %d channels @ %d Hz\n",
850 dec->channels, dec->sample_rate,849 dec->channels, dec->sample_rate,
851 enc->channels, enc->sample_rate);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 fprintf(stderr, "Cannot convert %s sample format to %s sample format\n",864 fprintf(stderr, "Cannot convert %s sample format to %s sample format\n",
866 av_get_sample_fmt_name(dec->sample_fmt),865 av_get_sample_fmt_name(dec->sample_fmt),
867 av_get_sample_fmt_name(enc->sample_fmt));866 av_get_sample_fmt_name(enc->sample_fmt));
868 ffmpeg_exit(1);867 exit_program(1);
869 }868 }
870 ost->reformat_pair=MAKE_SFMT_PAIR(enc->sample_fmt,dec->sample_fmt);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 if (av_audio_convert(ost->reformat_ctx, obuf, ostride, ibuf, istride, len)<0) {937 if (av_audio_convert(ost->reformat_ctx, obuf, ostride, ibuf, istride, len)<0) {
939 printf("av_audio_convert() failed\n");938 printf("av_audio_convert() failed\n");
940 if (exit_on_error)939 if (exit_on_error)
941 ffmpeg_exit(1);940 exit_program(1);
942 return;941 return;
943 }942 }
944 buftmp = audio_buf;943 buftmp = audio_buf;
@@ -950,7 +949,7 @@ need_realloc: · 5 unmodified lines
950 /* output resampled raw samples */949 /* output resampled raw samples */
951 if (av_fifo_realloc2(ost->fifo, av_fifo_size(ost->fifo) + size_out) < 0) {950 if (av_fifo_realloc2(ost->fifo, av_fifo_size(ost->fifo) + size_out) < 0) {
952 fprintf(stderr, "av_fifo_realloc2() failed\n");951 fprintf(stderr, "av_fifo_realloc2() failed\n");
953 ffmpeg_exit(1);952 exit_program(1);
954 }953 }
955 av_fifo_generic_write(ost->fifo, buftmp, size_out, NULL);954 av_fifo_generic_write(ost->fifo, buftmp, size_out, NULL);
956 955
@@ -968,7 +967,7 @@ need_realloc: · 11 unmodified lines
968 (short *)audio_buf);967 (short *)audio_buf);
969 if (ret < 0) {968 if (ret < 0) {
970 fprintf(stderr, "Audio encoding failed\n");969 fprintf(stderr, "Audio encoding failed\n");
971 ffmpeg_exit(1);970 exit_program(1);
972 }971 }
973 audio_size += ret;972 audio_size += ret;
974 pkt.stream_index= ost->index;973 pkt.stream_index= ost->index;
@@ -995,7 +994,7 @@ need_realloc: · 20 unmodified lines
995 994
996 if(size_out > audio_out_size){995 if(size_out > audio_out_size){
997 fprintf(stderr, "Internal error, buffer size too small\n");996 fprintf(stderr, "Internal error, buffer size too small\n");
998 ffmpeg_exit(1);997 exit_program(1);
999 }998 }
1000 999
1001 //FIXME pass ost->sync_opts as AVFrame.pts in avcodec_encode_audio()1000 //FIXME pass ost->sync_opts as AVFrame.pts in avcodec_encode_audio()
@@ -1003,7 +1002,7 @@ need_realloc: · 1 unmodified line
1003 (short *)buftmp);1002 (short *)buftmp);
1004 if (ret < 0) {1003 if (ret < 0) {
1005 fprintf(stderr, "Audio encoding failed\n");1004 fprintf(stderr, "Audio encoding failed\n");
1006 ffmpeg_exit(1);1005 exit_program(1);
1007 }1006 }
1008 audio_size += ret;1007 audio_size += ret;
1009 pkt.stream_index= ost->index;1008 pkt.stream_index= ost->index;
@@ -1073,7 +1072,7 @@ static void do_subtitle_out(AVFormatContext *s, · 63 unmodified lines
1073 if (pts == AV_NOPTS_VALUE) {1072 if (pts == AV_NOPTS_VALUE) {
1074 fprintf(stderr, "Subtitle packets must have a pts\n");1073 fprintf(stderr, "Subtitle packets must have a pts\n");
1075 if (exit_on_error)1074 if (exit_on_error)
1076 ffmpeg_exit(1);1075 exit_program(1);
1077 return;1076 return;
1078 }1077 }
1079 1078
@@ -1101,7 +1100,7 @@ static void do_subtitle_out(AVFormatContext *s, · 21 unmodified lines
1101 subtitle_out_max_size, sub);1100 subtitle_out_max_size, sub);
1102 if (subtitle_out_size < 0) {1101 if (subtitle_out_size < 0) {
1103 fprintf(stderr, "Subtitle encoding failed\n");1102 fprintf(stderr, "Subtitle encoding failed\n");
1104 ffmpeg_exit(1);1103 exit_program(1);
1105 }1104 }
1106 1105
1107 av_init_packet(&pkt);1106 av_init_packet(&pkt);
@@ -1188,7 +1187,7 @@ static void do_video_out(AVFormatContext *s, · 80 unmodified lines
1188 ost->resample_width, ost->resample_height, av_get_pix_fmt_name(ost->resample_pix_fmt),1187 ost->resample_width, ost->resample_height, av_get_pix_fmt_name(ost->resample_pix_fmt),
1189 dec->width , dec->height , av_get_pix_fmt_name(dec->pix_fmt));1188 dec->width , dec->height , av_get_pix_fmt_name(dec->pix_fmt));
1190 if(!ost->video_resample)1189 if(!ost->video_resample)
1191 ffmpeg_exit(1);1190 exit_program(1);
1192 }1191 }
1193 1192
1194#if !CONFIG_AVFILTER1193#if !CONFIG_AVFILTER
@@ -1207,7 +1206,7 @@ static void do_video_out(AVFormatContext *s, · 12 unmodified lines
1207 ost->sws_flags, NULL, NULL, NULL);1206 ost->sws_flags, NULL, NULL, NULL);
1208 if (ost->img_resample_ctx == NULL) {1207 if (ost->img_resample_ctx == NULL) {
1209 fprintf(stderr, "Cannot get resampling context\n");1208 fprintf(stderr, "Cannot get resampling context\n");
1210 ffmpeg_exit(1);1209 exit_program(1);
1211 }1210 }
1212 }1211 }
1213 sws_scale(ost->img_resample_ctx, formatted_picture->data, formatted_picture->linesize,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 &big_picture);1266 &big_picture);
1268 if (ret < 0) {1267 if (ret < 0) {
1269 fprintf(stderr, "Video encoding failed\n");1268 fprintf(stderr, "Video encoding failed\n");
1270 ffmpeg_exit(1);1269 exit_program(1);
1271 }1270 }
1272 1271
1273 if(ret>0){1272 if(ret>0){
@@ -1313,7 +1312,7 @@ static void do_video_stats(AVFormatContext *os, OutputStream *ost, · 39 unmodified lines
1313 vstats_file = fopen(vstats_filename, "w");1312 vstats_file = fopen(vstats_filename, "w");
1314 if (!vstats_file) {1313 if (!vstats_file) {
1315 perror("fopen");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 } else { /* pad */1817 } else { /* pad */
1819 int frame_bytes = enc->frame_size*osize*enc->channels;1818 int frame_bytes = enc->frame_size*osize*enc->channels;
1820 if (allocated_audio_buf_size < frame_bytes)1819 if (allocated_audio_buf_size < frame_bytes)
1821 ffmpeg_exit(1);1820 exit_program(1);
1822 generate_silence(audio_buf+fifo_bytes, enc->sample_fmt, frame_bytes - fifo_bytes);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 if (ret < 0) {1832 if (ret < 0) {
1834 fprintf(stderr, "Audio encoding failed\n");1833 fprintf(stderr, "Audio encoding failed\n");
1835 ffmpeg_exit(1);1834 exit_program(1);
1836 }1835 }
1837 audio_size += ret;1836 audio_size += ret;
1838 pkt.flags |= AV_PKT_FLAG_KEY;1837 pkt.flags |= AV_PKT_FLAG_KEY;
@@ -1841,7 +1840,7 @@ static int output_packet(InputStream *ist, int ist_index, · 2 unmodified lines
1841 ret = avcodec_encode_video(enc, bit_buffer, bit_buffer_size, NULL);1840 ret = avcodec_encode_video(enc, bit_buffer, bit_buffer_size, NULL);
1842 if (ret < 0) {1841 if (ret < 0) {
1843 fprintf(stderr, "Video encoding failed\n");1842 fprintf(stderr, "Video encoding failed\n");
1844 ffmpeg_exit(1);1843 exit_program(1);
1845 }1844 }
1846 video_size += ret;1845 video_size += ret;
1847 if(enc->coded_frame && enc->coded_frame->key_frame)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 ost->forced_kf_pts = av_malloc(sizeof(*ost->forced_kf_pts) * n);1932 ost->forced_kf_pts = av_malloc(sizeof(*ost->forced_kf_pts) * n);
1934 if (!ost->forced_kf_pts) {1933 if (!ost->forced_kf_pts) {
1935 av_log(NULL, AV_LOG_FATAL, "Could not allocate forced key frames array.\n");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 for (i = 0; i < n; i++) {1937 for (i = 0; i < n; i++) {
1939 p = i ? strchr(p, ',') + 1 : kf;1938 p = i ? strchr(p, ',') + 1 : kf;
@@ -2024,7 +2023,7 @@ static int transcode(AVFormatContext **output_files, · 84 unmodified lines
2024 fprintf(stderr, "Codec type mismatch for mapping #%d.%d -> #%d.%d\n",2023 fprintf(stderr, "Codec type mismatch for mapping #%d.%d -> #%d.%d\n",
2025 stream_maps[n].file_index, stream_maps[n].stream_index,2024 stream_maps[n].file_index, stream_maps[n].stream_index,
2026 ost->file_index, ost->index);2025 ost->file_index, ost->index);
2027 ffmpeg_exit(1);2026 exit_program(1);
2028 }2027 }
2029 2028
2030 } else {2029 } else {
@@ -2074,7 +2073,7 @@ static int transcode(AVFormatContext **output_files, · 43 unmodified lines
2074 av_dump_format(output_files[i], i, output_files[i]->filename, 1);2073 av_dump_format(output_files[i], i, output_files[i]->filename, 1);
2075 fprintf(stderr, "Could not find input stream matching output stream #%d.%d\n",2074 fprintf(stderr, "Could not find input stream matching output stream #%d.%d\n",
2076 ost->file_index, ost->index);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 case AVMEDIA_TYPE_AUDIO:2138 case AVMEDIA_TYPE_AUDIO:
2140 if(audio_volume != 256) {2139 if(audio_volume != 256) {
2141 fprintf(stderr,"-acodec copy and -vol are incompatible (frames are not decoded)\n");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 codec->channel_layout = icodec->channel_layout;2143 codec->channel_layout = icodec->channel_layout;
2145 codec->sample_rate = icodec->sample_rate;2144 codec->sample_rate = icodec->sample_rate;
@@ -2213,7 +2212,7 @@ static int transcode(AVFormatContext **output_files, · 67 unmodified lines
2213 2212
2214 if (ost->st->codec->pix_fmt == PIX_FMT_NONE) {2213 if (ost->st->codec->pix_fmt == PIX_FMT_NONE) {
2215 fprintf(stderr, "Video pixel format is unknown, stream cannot be encoded\n");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 if (!codec->width || !codec->height) {2218 if (!codec->width || !codec->height) {
@@ -2230,7 +2229,7 @@ static int transcode(AVFormatContext **output_files, · 10 unmodified lines
2230 if(avpicture_alloc((AVPicture*)&ost->pict_tmp, codec->pix_fmt,2229 if(avpicture_alloc((AVPicture*)&ost->pict_tmp, codec->pix_fmt,
2231 codec->width, codec->height)) {2230 codec->width, codec->height)) {
2232 fprintf(stderr, "Cannot allocate temp picture, check pix fmt\n");2231 fprintf(stderr, "Cannot allocate temp picture, check pix fmt\n");
2233 ffmpeg_exit(1);2232 exit_program(1);
2234 }2233 }
2235 ost->img_resample_ctx = sws_getContext(2234 ost->img_resample_ctx = sws_getContext(
2236 icodec->width,2235 icodec->width,
@@ -2242,7 +2241,7 @@ static int transcode(AVFormatContext **output_files, · 5 unmodified lines
2242 ost->sws_flags, NULL, NULL, NULL);2241 ost->sws_flags, NULL, NULL, NULL);
2243 if (ost->img_resample_ctx == NULL) {2242 if (ost->img_resample_ctx == NULL) {
2244 fprintf(stderr, "Cannot get resampling context\n");2243 fprintf(stderr, "Cannot get resampling context\n");
2245 ffmpeg_exit(1);2244 exit_program(1);
2246 }2245 }
2247#endif2246#endif
2248 codec->bits_per_raw_sample= 0;2247 codec->bits_per_raw_sample= 0;
@@ -2290,7 +2289,7 @@ static int transcode(AVFormatContext **output_files, · 41 unmodified lines
2290 f = fopen(logfilename, "wb");2289 f = fopen(logfilename, "wb");
2291 if (!f) {2290 if (!f) {
2292 fprintf(stderr, "Cannot write log file '%s' for pass-1 encoding: %s\n", logfilename, strerror(errno));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 ost->logfile = f;2294 ost->logfile = f;
2296 } else {2295 } else {
@@ -2298,7 +2297,7 @@ static int transcode(AVFormatContext **output_files, · 1 unmodified line
2298 size_t logbuffer_size;2297 size_t logbuffer_size;
2299 if (read_file(logfilename, &logbuffer, &logbuffer_size) < 0) {2298 if (read_file(logfilename, &logbuffer, &logbuffer_size) < 0) {
2300 fprintf(stderr, "Error reading log file '%s' for pass-2 encoding\n", logfilename);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 codec->stats_in = logbuffer;2302 codec->stats_in = logbuffer;
2304 }2303 }
@@ -2670,7 +2669,7 @@ static int transcode(AVFormatContext **output_files, · 365 unmodified lines
2670 fprintf(stderr, "Error while decoding stream #%d.%d\n",2669 fprintf(stderr, "Error while decoding stream #%d.%d\n",
2671 ist->file_index, ist->st->index);2670 ist->file_index, ist->st->index);
2672 if (exit_on_error)2671 if (exit_on_error)
2673 ffmpeg_exit(1);2672 exit_program(1);
2674 av_free_packet(&pkt);2673 av_free_packet(&pkt);
2675 goto redo;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 if (av_parse_video_rate(&frame_rate, arg) < 0) {2785 if (av_parse_video_rate(&frame_rate, arg) < 0) {
2787 fprintf(stderr, "Incorrect value for %s: %s\n", opt, arg);2786 fprintf(stderr, "Incorrect value for %s: %s\n", opt, arg);
2788 ffmpeg_exit(1);2787 exit_program(1);
2789 }2788 }
2790 return 0;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 } else {2820 } else {
2822 show_pix_fmts();2821 show_pix_fmts();
2823 ffmpeg_exit(0);2822 exit_program(0);
2824 }2823 }
2825 return 0;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 if(!mid){2856 if(!mid){
2858 fprintf(stderr, "Missing =\n");2857 fprintf(stderr, "Missing =\n");
2859 ffmpeg_exit(1);2858 exit_program(1);
2860 }2859 }
2861 *mid++= 0;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 char fmt_str[128];2903 char fmt_str[128];
2905 for (i = -1; i < AV_SAMPLE_FMT_NB; i++)2904 for (i = -1; i < AV_SAMPLE_FMT_NB; i++)
2906 printf("%s\n", av_get_sample_fmt_string(fmt_str, sizeof(fmt_str), i));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 return 0;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 break;3025 break;
3027 default:3026 default:
3028 fprintf(stderr, "Invalid metadata type %c.\n", *arg);3027 fprintf(stderr, "Invalid metadata type %c.\n", *arg);
3029 ffmpeg_exit(1);3028 exit_program(1);
3030 }3029 }
3031 } else3030 } else
3032 *type = 'g';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 avcodec_find_decoder_by_name(name);3141 avcodec_find_decoder_by_name(name);
3143 if(!codec) {3142 if(!codec) {
3144 fprintf(stderr, "Unknown %s '%s'\n", codec_string, name);3143 fprintf(stderr, "Unknown %s '%s'\n", codec_string, name);
3145 ffmpeg_exit(1);3144 exit_program(1);
3146 }3145 }
3147 if(codec->type != type) {3146 if(codec->type != type) {
3148 fprintf(stderr, "Invalid %s type '%s'\n", codec_string, name);3147 fprintf(stderr, "Invalid %s type '%s'\n", codec_string, name);
3149 ffmpeg_exit(1);3148 exit_program(1);
3150 }3149 }
3151 return codec->id;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 if (last_asked_format) {3163 if (last_asked_format) {
3165 if (!(file_iformat = av_find_input_format(last_asked_format))) {3164 if (!(file_iformat = av_find_input_format(last_asked_format))) {
3166 fprintf(stderr, "Unknown input format: '%s'\n", last_asked_format);3165 fprintf(stderr, "Unknown input format: '%s'\n", last_asked_format);
3167 ffmpeg_exit(1);3166 exit_program(1);
3168 }3167 }
3169 last_asked_format = NULL;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 ic = avformat_alloc_context();3178 ic = avformat_alloc_context();
3180 if (!ic) {3179 if (!ic) {
3181 print_error(filename, AVERROR(ENOMEM));3180 print_error(filename, AVERROR(ENOMEM));
3182 ffmpeg_exit(1);3181 exit_program(1);
3183 }3182 }
3184 if (audio_sample_rate) {3183 if (audio_sample_rate) {
3185 snprintf(buf, sizeof(buf), "%d", audio_sample_rate);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 err = avformat_open_input(&ic, filename, file_iformat, &format_opts);3211 err = avformat_open_input(&ic, filename, file_iformat, &format_opts);
3213 if (err < 0) {3212 if (err < 0) {
3214 print_error(filename, err);3213 print_error(filename, err);
3215 ffmpeg_exit(1);3214 exit_program(1);
3216 }3215 }
3217 assert_avoptions(format_opts);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 if(!found){3235 if(!found){
3237 fprintf(stderr, "Specified program id not found\n");3236 fprintf(stderr, "Specified program id not found\n");
3238 ffmpeg_exit(1);3237 exit_program(1);
3239 }3238 }
3240 opt_programid=0;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 if (ret < 0 && verbose >= 0) {3254 if (ret < 0 && verbose >= 0) {
3256 fprintf(stderr, "%s: could not find codec parameters\n", filename);3255 fprintf(stderr, "%s: could not find codec parameters\n", filename);
3257 av_close_input_file(ic);3256 av_close_input_file(ic);
3258 ffmpeg_exit(1);3257 exit_program(1);
3259 }3258 }
3260 3259
3261 timestamp = start_time;3260 timestamp = start_time;
@@ -3491,7 +3490,7 @@ static void new_video_stream(AVFormatContext *oc, int file_idx) · 229 unmodified lines
3491 int e=sscanf(p, "%d,%d,%d", &start, &end, &q);3490 int e=sscanf(p, "%d,%d,%d", &start, &end, &q);
3492 if(e!=3){3491 if(e!=3){
3493 fprintf(stderr, "error parsing rc_override\n");3492 fprintf(stderr, "error parsing rc_override\n");
3494 ffmpeg_exit(1);3493 exit_program(1);
3495 }3494 }
3496 video_enc->rc_override=3495 video_enc->rc_override=
3497 av_realloc(video_enc->rc_override,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 data_enc = st->codec;3614 data_enc = st->codec;
3616 if (!data_stream_copy) {3615 if (!data_stream_copy) {
3617 fprintf(stderr, "Data stream encoding not supported yet (only streamcopy)\n");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 data_enc->codec_type = AVMEDIA_TYPE_DATA;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 int file_idx = nb_output_files - 1;3688 int file_idx = nb_output_files - 1;
3690 if (nb_output_files <= 0) {3689 if (nb_output_files <= 0) {
3691 fprintf(stderr, "At least one output file must be specified\n");3690 fprintf(stderr, "At least one output file must be specified\n");
3692 ffmpeg_exit(1);3691 exit_program(1);
3693 }3692 }
3694 oc = output_files[file_idx];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 fprintf(stderr,3713 fprintf(stderr,
3715 "Invalid value '%s' for option '%s', required syntax is 'index:value'\n",3714 "Invalid value '%s' for option '%s', required syntax is 'index:value'\n",
3716 arg, opt);3715 arg, opt);
3717 ffmpeg_exit(1);3716 exit_program(1);
3718 }3717 }
3719 *p++ = '\0';3718 *p++ = '\0';
3720 idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, INT_MAX);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 oc = avformat_alloc_context();3735 oc = avformat_alloc_context();
3737 if (!oc) {3736 if (!oc) {
3738 print_error(filename, AVERROR(ENOMEM));3737 print_error(filename, AVERROR(ENOMEM));
3739 ffmpeg_exit(1);3738 exit_program(1);
3740 }3739 }
3741 3740
3742 if (last_asked_format) {3741 if (last_asked_format) {
3743 file_oformat = av_guess_format(last_asked_format, NULL, NULL);3742 file_oformat = av_guess_format(last_asked_format, NULL, NULL);
3744 if (!file_oformat) {3743 if (!file_oformat) {
3745 fprintf(stderr, "Requested output format '%s' is not a suitable output format\n", last_asked_format);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 last_asked_format = NULL;3747 last_asked_format = NULL;
3749 } else {3748 } else {
@@ -3751,7 +3750,7 @@ static void opt_output_file(const char *filename) · 1 unmodified line
3751 if (!file_oformat) {3750 if (!file_oformat) {
3752 fprintf(stderr, "Unable to find a suitable output format for '%s'\n",3751 fprintf(stderr, "Unable to find a suitable output format for '%s'\n",
3753 filename);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 int err = read_avserver_streams(oc, filename);3764 int err = read_avserver_streams(oc, filename);
3766 if (err < 0) {3765 if (err < 0) {
3767 print_error(filename, err);3766 print_error(filename, err);
3768 ffmpeg_exit(1);3767 exit_program(1);
3769 }3768 }
3770 } else {3769 } else {
3771 use_video = file_oformat->video_codec != CODEC_ID_NONE || video_stream_copy || video_codec_name;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 if (oc->oformat->flags & AVFMT_NEEDNUMBER) {3809 if (oc->oformat->flags & AVFMT_NEEDNUMBER) {
3811 if (!av_filename_number_test(oc->filename)) {3810 if (!av_filename_number_test(oc->filename)) {
3812 print_error(oc->filename, AVERROR(EINVAL));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 fflush(stderr);3825 fflush(stderr);
3827 if (!read_yesno()) {3826 if (!read_yesno()) {
3828 fprintf(stderr, "Not overwriting - exiting\n");3827 fprintf(stderr, "Not overwriting - exiting\n");
3829 ffmpeg_exit(1);3828 exit_program(1);
3830 }3829 }
3831 }3830 }
3832 else {3831 else {
3833 fprintf(stderr,"File '%s' already exists. Exiting.\n", filename);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 /* open the file */3838 /* open the file */
3840 if ((err = avio_open(&oc->pb, filename, AVIO_FLAG_WRITE)) < 0) {3839 if ((err = avio_open(&oc->pb, filename, AVIO_FLAG_WRITE)) < 0) {
3841 print_error(filename, err);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 p = strchr(p, ',');3916 p = strchr(p, ',');
3918 if(!p) {3917 if(!p) {
3919 fprintf(stderr, "Syntax error in matrix \"%s\" at coeff %d\n", str, i);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 p++;3921 p++;
3923 }3922 }
@@ -4065,7 +4064,7 @@ static int opt_target(const char *opt, const char *arg) · 141 unmodified lines
4065 fprintf(stderr, "Could not determine norm (PAL/NTSC/NTSC-Film) for target.\n");4064 fprintf(stderr, "Could not determine norm (PAL/NTSC/NTSC-Film) for target.\n");
4066 fprintf(stderr, "Please prefix target with \"pal-\", \"ntsc-\" or \"film-\",\n");4065 fprintf(stderr, "Please prefix target with \"pal-\", \"ntsc-\" or \"film-\",\n");
4067 fprintf(stderr, "or set a framerate with \"-r xxx\".\n");4066 fprintf(stderr, "or set a framerate with \"-r xxx\".\n");
4068 ffmpeg_exit(1);4067 exit_program(1);
4069 }4068 }
4070 4069
4071 if(!strcmp(arg, "vcd")) {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 if(!bsfc){4182 if(!bsfc){
4184 fprintf(stderr, "Unknown bitstream filter %s\n", arg);4183 fprintf(stderr, "Unknown bitstream filter %s\n", arg);
4185 ffmpeg_exit(1);4184 exit_program(1);
4186 }4185 }
4187 4186
4188 bsfp= *opt == 'v' ? &video_bitstream_filters :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 if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) {4206 if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) {
4208 fprintf(stderr, "File for preset '%s' not found\n", arg);4207 fprintf(stderr, "File for preset '%s' not found\n", arg);
4209 ffmpeg_exit(1);4208 exit_program(1);
4210 }4209 }
4211 4210
4212 while(!feof(f)){4211 while(!feof(f)){
@@ -4216,7 +4215,7 @@ static int opt_preset(const char *opt, const char *arg) · 3 unmodified lines
4216 e|= sscanf(line, "%999[^=]=%999[^\n]\n", tmp, tmp2) - 2;4215 e|= sscanf(line, "%999[^=]=%999[^\n]\n", tmp, tmp2) - 2;
4217 if(e){4216 if(e){
4218 fprintf(stderr, "%s: Invalid syntax: '%s'\n", filename, line);4217 fprintf(stderr, "%s: Invalid syntax: '%s'\n", filename, line);
4219 ffmpeg_exit(1);4218 exit_program(1);
4220 }4219 }
4221 if(!strcmp(tmp, "acodec")){4220 if(!strcmp(tmp, "acodec")){
4222 opt_audio_codec(tmp, tmp2);4221 opt_audio_codec(tmp, tmp2);
@@ -4228,7 +4227,7 @@ static int opt_preset(const char *opt, const char *arg) · 5 unmodified lines
4228 opt_data_codec(tmp, tmp2);4227 opt_data_codec(tmp, tmp2);
4229 }else if(opt_default(tmp, tmp2) < 0){4228 }else if(opt_default(tmp, tmp2) < 0){
4230 fprintf(stderr, "%s: Invalid option or argument: '%s', parsed as '%s' = '%s'\n", filename, line, tmp, tmp2);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 if(nb_output_files <= 0 && nb_input_files == 0) {4401 if(nb_output_files <= 0 && nb_input_files == 0) {
4403 show_usage();4402 show_usage();
4404 fprintf(stderr, "Use -h to get full help or, even better, run 'man ffmpeg'\n");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 /* file converter / grab */4407 /* file converter / grab */
4409 if (nb_output_files <= 0) {4408 if (nb_output_files <= 0) {
4410 fprintf(stderr, "At least one output file must be specified\n");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 if (nb_input_files == 0) {4413 if (nb_input_files == 0) {
4415 fprintf(stderr, "At least one input file must be specified\n");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 ti = getutime();4418 ti = getutime();
4420 if (transcode(output_files, nb_output_files, input_files, nb_input_files,4419 if (transcode(output_files, nb_output_files, input_files, nb_input_files,
4421 stream_maps, nb_stream_maps) < 0)4420 stream_maps, nb_stream_maps) < 0)
4422 ffmpeg_exit(1);4421 exit_program(1);
4423 ti = getutime() - ti;4422 ti = getutime() - ti;
4424 if (do_benchmark) {4423 if (do_benchmark) {
4425 int maxrss = getmaxrss() / 1024;4424 int maxrss = getmaxrss() / 1024;
4426 printf("bench: utime=%0.3fs maxrss=%ikB\n", ti / 1000000.0, maxrss);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}

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