diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-11-19 01:55:55 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-11-19 02:00:06 +0100 |
commit | e161b079dee12b11c40df67cf422edeb84772bbe (patch) | |
tree | fe5000d84e5fc4049395822c4bf8b4d600851782 /ffmpeg.c | |
parent | 36a60fad6215db39e9cd9523e3425f64464046c7 (diff) | |
parent | ff3755cbde9bdd2a4dc50e4432f72ddeef1a85ac (diff) | |
download | ffmpeg-e161b079dee12b11c40df67cf422edeb84772bbe.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master: (22 commits)
configure: add check for w32threads to enable it automatically
rtmp: do not hardcode invoke numbers
cinepack: return non-generic errors
fate-lavf-ts: use -mpegts_transport_stream_id option.
Add an APIchanges entry and a minor bump for avio changes.
avio: Mark the old interrupt callback mechanism as deprecated
avplay: Set the new interrupt callback
avconv: Set new interrupt callbacks for all AVFormatContexts, use avio_open2() everywhere
cinepak: remove redundant coordinate checks
cinepak: check strip_size
cinepak, simplify, use AV_RB24()
cinepak: simplify, use FFMIN()
cinepak: Fix division by zero, ask for sample if encoded_buf_size is 0
applehttp: Fix seeking in streams not starting at DTS=0
http: Don't use the normal http proxy mechanism for https
tls: Handle connection via a http proxy
http: Reorder two code blocks
http: Add a new protocol for opening connections via http proxies
http: Split out the non-chunked buffer reading part from http_read
segafilm: add support for raw videos
...
Conflicts:
avconv.c
configure
doc/APIchanges
libavcodec/cinepak.c
libavformat/applehttp.c
libavformat/version.h
tests/lavf-regression.sh
tests/ref/lavf/ts
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'ffmpeg.c')
-rw-r--r-- | ffmpeg.c | 29 |
1 files changed, 15 insertions, 14 deletions
@@ -635,11 +635,13 @@ static int read_key(void) return -1; } -static int decode_interrupt_cb(void) +static int decode_interrupt_cb(void *ctx) { return received_nb_signals > 1; } +static const AVIOInterruptCB int_cb = { decode_interrupt_cb, NULL }; + void av_noreturn exit_program(int ret) { int i; @@ -2403,6 +2405,7 @@ static int transcode_init(OutputFile *output_files, int nb_output_files, /* open files and write file headers */ for (i = 0; i < nb_output_files; i++) { os = output_files[i].ctx; + os->interrupt_callback = int_cb; if (avformat_write_header(os, &output_files[i].opts) < 0) { snprintf(error, sizeof(error), "Could not write header for output file #%d (incorrect codec parameters ?)", i); ret = AVERROR(EINVAL); @@ -2495,7 +2498,6 @@ static int transcode(OutputFile *output_files, int nb_output_files, if (!using_stdin) { av_log(NULL, AV_LOG_INFO, "Press [q] to stop, [?] for help\n"); - avio_set_interrupt_cb(decode_interrupt_cb); } timer_start = av_gettime(); @@ -3243,7 +3245,7 @@ static void dump_attachment(AVStream *st, const char *filename) assert_file_overwrite(filename); - if ((ret = avio_open (&out, filename, AVIO_FLAG_WRITE)) < 0) { + if ((ret = avio_open2(&out, filename, AVIO_FLAG_WRITE, &int_cb, NULL)) < 0) { av_log(NULL, AV_LOG_FATAL, "Could not open file %s for writing.\n", filename); exit_program(1); @@ -3307,6 +3309,7 @@ static int opt_input_file(OptionsContext *o, const char *opt, const char *filena ic->subtitle_codec_id= subtitle_codec_name ? find_codec_or_die(subtitle_codec_name, AVMEDIA_TYPE_SUBTITLE, 0)->id : CODEC_ID_NONE; ic->flags |= AVFMT_FLAG_NONBLOCK; + ic->interrupt_callback = int_cb; if (loop_input) { av_log(NULL, AV_LOG_WARNING, "-loop_input is deprecated, use -loop 1\n"); @@ -3438,12 +3441,12 @@ static int get_preset_file_2(const char *preset_name, const char *codec_name, AV if (codec_name) { snprintf(filename, sizeof(filename), "%s%s/%s-%s.avpreset", base[i], i != 1 ? "" : "/.avconv", codec_name, preset_name); - ret = avio_open(s, filename, AVIO_FLAG_READ); + ret = avio_open2(s, filename, AVIO_FLAG_READ, &int_cb, NULL); } if (ret) { snprintf(filename, sizeof(filename), "%s%s/%s.avpreset", base[i], i != 1 ? "" : "/.avconv", preset_name); - ret = avio_open(s, filename, AVIO_FLAG_READ); + ret = avio_open2(s, filename, AVIO_FLAG_READ, &int_cb, NULL); } } return ret; @@ -3856,8 +3859,9 @@ static int copy_chapters(InputFile *ifile, OutputFile *ofile, int copy_metadata) static int read_ffserver_streams(OptionsContext *o, AVFormatContext *s, const char *filename) { int i, err; - AVFormatContext *ic = NULL; + AVFormatContext *ic = avformat_alloc_context(); + ic->interrupt_callback = int_cb; err = avformat_open_input(&ic, filename, NULL, NULL); if (err < 0) return err; @@ -3908,6 +3912,7 @@ static void opt_output_file(void *optctx, const char *filename) exit_program(1); } file_oformat= oc->oformat; + oc->interrupt_callback = int_cb; if (!strcmp(file_oformat->name, "ffm") && av_strstart(filename, "http:", NULL)) { @@ -4019,7 +4024,7 @@ static void opt_output_file(void *optctx, const char *filename) const char *p; int64_t len; - if ((err = avio_open(&pb, o->attachments[i], AVIO_FLAG_READ)) < 0) { + if ((err = avio_open2(&pb, o->attachments[i], AVIO_FLAG_READ, &int_cb, NULL)) < 0) { av_log(NULL, AV_LOG_FATAL, "Could not open attachment file %s.\n", o->attachments[i]); exit_program(1); @@ -4069,7 +4074,9 @@ static void opt_output_file(void *optctx, const char *filename) assert_file_overwrite(filename); /* open the file */ - if ((err = avio_open(&oc->pb, filename, AVIO_FLAG_WRITE)) < 0) { + if ((err = avio_open2(&oc->pb, filename, AVIO_FLAG_WRITE, + &oc->interrupt_callback, + &output_files[nb_output_files - 1].opts)) < 0) { print_error(filename, err); exit_program(1); } @@ -4725,12 +4732,6 @@ int main(int argc, char **argv) av_register_all(); avformat_network_init(); -#if HAVE_ISATTY - if(isatty(STDIN_FILENO)) - avio_set_interrupt_cb(decode_interrupt_cb); -#endif - - show_banner(); term_init(); |