diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-11-07 02:41:01 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-11-07 03:01:43 +0100 |
commit | 13b7781ec8d475513c1ee40a6e481763b728a71e (patch) | |
tree | 953bee0a6461e74085e45e1f7793de6f850534e5 /avconv.c | |
parent | ada8d485c0f77a4e79fac7f3f96031c4d0e6bc7a (diff) | |
parent | f2bd8a0786ded12c70d6877f16944b44ea731462 (diff) | |
download | ffmpeg-13b7781ec8d475513c1ee40a6e481763b728a71e.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master: (23 commits)
x86inc: use sse versions of common macros instead of sse2 when applicable
doc/APIchanges: add missing dates and hashes
lavf: don't return from void av_update_cur_dts()
Changelog: add more entries.
Changelog: update ffmpeg/avconv incompatibility list.
avconv: remove some redundant temporary variables.
avconv: fix broken indentation
avconv: move copy_initial_nonkeyframes to the options context.
avconv: use file:stream instead of file.stream in log messages.
doc/avconv: elaborate on basic functionality.
doc/avconv: -sample_fmts, not -help sample_fmts prints the sample formats
openssl: Only use CRYPTO_set_id_callback on OpenSSL < 1.0.0
Call avformat_network_init/deinit in the programs
Remove leftover includes of strings.h
avutil: Don't allow using strcasecmp/strncasecmp
Replace all usage of strcasecmp/strncasecmp
avstring: Add locale independent implementations of strcasecmp/strncasecmp
avstring: Add locale independent implementations of toupper/tolower
cosmetics: insert some spaces in explicit enum value assignments
move 8SVX audio codecs to the audio codec list part on the next bump
...
Conflicts:
avprobe.c
doc/APIchanges
ffplay.c
ffserver.c
libavcodec/avcodec.h
libavdevice/bktr.c
libavdevice/v4l.c
libavdevice/v4l2.c
libavformat/matroskaenc.c
libavformat/wtv.c
libavutil/avstring.c
libavutil/avstring.h
libavutil/avutil.h
libswscale/x86/swscale_template.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'avconv.c')
-rw-r--r-- | avconv.c | 62 |
1 files changed, 33 insertions, 29 deletions
@@ -132,7 +132,6 @@ static int copy_tb= 0; static int opt_shortest = 0; static char *vstats_filename; static FILE *vstats_file; -static int copy_initial_nonkeyframes = 0; static int audio_volume = 256; @@ -240,11 +239,12 @@ typedef struct OutputStream { AVFilterGraph *graph; #endif - int64_t sws_flags; - AVDictionary *opts; - int is_past_recording_time; - int stream_copy; - const char *attachment_filename; + int64_t sws_flags; + AVDictionary *opts; + int is_past_recording_time; + int stream_copy; + const char *attachment_filename; + int copy_initial_nonkeyframes; } OutputStream; #if HAVE_TERMIOS_H @@ -355,6 +355,8 @@ typedef struct OptionsContext { int nb_top_field_first; SpecifierOpt *presets; int nb_presets; + SpecifierOpt *copy_initial_nonkeyframes; + int nb_copy_initial_nonkeyframes; #if CONFIG_AVFILTER SpecifierOpt *filters; int nb_filters; @@ -628,6 +630,7 @@ void exit_program(int ret) #if CONFIG_AVFILTER avfilter_uninit(); #endif + avformat_network_deinit(); if (received_sigterm) { av_log(NULL, AV_LOG_INFO, "Received signal %d: terminating.\n", @@ -822,7 +825,7 @@ need_realloc: if ((ost->audio_resample && !ost->resample) || resample_changed) { if (resample_changed) { - av_log(NULL, AV_LOG_INFO, "Input stream #%d.%d frame changed from rate:%d fmt:%s ch:%d to rate:%d fmt:%s ch:%d\n", + av_log(NULL, AV_LOG_INFO, "Input stream #%d:%d frame changed from rate:%d fmt:%s ch:%d to rate:%d fmt:%s ch:%d\n", ist->file_index, ist->st->index, ost->resample_sample_rate, av_get_sample_fmt_name(ost->resample_sample_fmt), ost->resample_channels, dec->sample_rate, av_get_sample_fmt_name(dec->sample_fmt), dec->channels); @@ -1137,7 +1140,7 @@ static void do_video_resample(OutputStream *ost, #if !CONFIG_AVFILTER if (resample_changed) { av_log(NULL, AV_LOG_INFO, - "Input stream #%d.%d frame changed from size:%dx%d fmt:%s to size:%dx%d fmt:%s\n", + "Input stream #%d:%d frame changed from size:%dx%d fmt:%s to size:%dx%d fmt:%s\n", ist->file_index, ist->st->index, ost->resample_width, ost->resample_height, av_get_pix_fmt_name(ost->resample_pix_fmt), dec->width , dec->height , av_get_pix_fmt_name(dec->pix_fmt)); @@ -1886,7 +1889,8 @@ static int output_packet(InputStream *ist, int ist_index, int64_t ost_tb_start_time= av_rescale_q(of->start_time, AV_TIME_BASE_Q, ost->st->time_base); av_init_packet(&opkt); - if ((!ost->frame_number && !(pkt->flags & AV_PKT_FLAG_KEY)) && !copy_initial_nonkeyframes) + if ((!ost->frame_number && !(pkt->flags & AV_PKT_FLAG_KEY)) && + !ost->copy_initial_nonkeyframes) #if !CONFIG_AVFILTER continue; #else @@ -1994,13 +1998,13 @@ static int init_input_stream(int ist_index, OutputStream *output_streams, int nb if (ist->decoding_needed) { AVCodec *codec = ist->dec; if (!codec) { - snprintf(error, error_len, "Decoder (codec id %d) not found for input stream #%d.%d", + snprintf(error, error_len, "Decoder (codec id %d) not found for input stream #%d:%d", ist->st->codec->codec_id, ist->file_index, ist->st->index); return AVERROR(EINVAL); } if (avcodec_open2(ist->st->codec, codec, &ist->opts) < 0) { - snprintf(error, error_len, "Error while opening decoder for input stream #%d.%d", + snprintf(error, error_len, "Error while opening decoder for input stream #%d:%d", ist->file_index, ist->st->index); return AVERROR(EINVAL); } @@ -2280,7 +2284,7 @@ static int transcode_init(OutputFile *output_files, AVCodec *codec = ost->enc; AVCodecContext *dec = input_streams[ost->source_index].st->codec; if (!codec) { - snprintf(error, sizeof(error), "Encoder (codec id %d) not found for output stream #%d.%d", + snprintf(error, sizeof(error), "Encoder (codec id %d) not found for output stream #%d:%d", ost->st->codec->codec_id, ost->file_index, ost->index); ret = AVERROR(EINVAL); goto dump_format; @@ -2295,7 +2299,7 @@ static int transcode_init(OutputFile *output_files, ost->st->codec->subtitle_header_size = dec->subtitle_header_size; } if (avcodec_open2(ost->st->codec, codec, &ost->opts) < 0) { - snprintf(error, sizeof(error), "Error while opening encoder for output stream #%d.%d - maybe incorrect parameters such as bit_rate, rate, width or height", + snprintf(error, sizeof(error), "Error while opening encoder for output stream #%d:%d - maybe incorrect parameters such as bit_rate, rate, width or height", ost->file_index, ost->index); ret = AVERROR(EINVAL); goto dump_format; @@ -2365,13 +2369,13 @@ static int transcode_init(OutputFile *output_files, ost->attachment_filename, ost->file_index, ost->index); continue; } - av_log(NULL, AV_LOG_INFO, " Stream #%d.%d -> #%d.%d", + av_log(NULL, AV_LOG_INFO, " Stream #%d:%d -> #%d:%d", input_streams[ost->source_index].file_index, input_streams[ost->source_index].st->index, ost->file_index, ost->index); if (ost->sync_ist != &input_streams[ost->source_index]) - av_log(NULL, AV_LOG_INFO, " [sync #%d.%d]", + av_log(NULL, AV_LOG_INFO, " [sync #%d:%d]", ost->sync_ist->file_index, ost->sync_ist->st->index); if (ost->stream_copy) @@ -2591,7 +2595,7 @@ static int transcode(OutputFile *output_files, //fprintf(stderr,"read #%d.%d size=%d\n", ist->file_index, ist->st->index, pkt.size); if (output_packet(ist, ist_index, output_streams, nb_output_streams, &pkt) < 0) { - av_log(NULL, AV_LOG_ERROR, "Error while decoding stream #%d.%d\n", + av_log(NULL, AV_LOG_ERROR, "Error while decoding stream #%d:%d\n", ist->file_index, ist->st->index); if (exit_on_error) exit_program(1); @@ -2909,7 +2913,6 @@ static void add_input_streams(OptionsContext *o, AVFormatContext *ic) AVStream *st = ic->streams[i]; AVCodecContext *dec = st->codec; InputStream *ist; - double scale = 1.0; input_streams = grow_array(input_streams, sizeof(*input_streams), &nb_input_streams, nb_input_streams + 1); ist = &input_streams[nb_input_streams - 1]; @@ -2918,8 +2921,8 @@ static void add_input_streams(OptionsContext *o, AVFormatContext *ic) ist->discard = 1; ist->opts = filter_codec_opts(codec_opts, ist->st->codec->codec_id, ic, st); - MATCH_PER_STREAM_OPT(ts_scale, dbl, scale, ic, st); - ist->ts_scale = scale; + ist->ts_scale = 1.0; + MATCH_PER_STREAM_OPT(ts_scale, dbl, ist->ts_scale, ic, st); ist->dec = choose_decoder(o, ic, st); @@ -3231,7 +3234,6 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e OutputStream *ost; AVStream *st = avformat_new_stream(oc, NULL); int idx = oc->nb_streams - 1, ret = 0; - int64_t max_frames = INT64_MAX; char *bsf = NULL, *next, *codec_tag = NULL; AVBitStreamFilterContext *bsfc, *bsfc_prev = NULL; double qscale = -1; @@ -3286,8 +3288,8 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e exit_program(1); } - MATCH_PER_STREAM_OPT(max_frames, i64, max_frames, oc, st); - ost->max_frames = max_frames; + ost->max_frames = INT64_MAX; + MATCH_PER_STREAM_OPT(max_frames, i64, ost->max_frames, oc, st); MATCH_PER_STREAM_OPT(bitstream_filters, str, bsf, oc, st); while (bsf) { @@ -3359,7 +3361,7 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc) char *forced_key_frames = NULL, *frame_rate = NULL, *frame_size = NULL; char *frame_aspect_ratio = NULL, *frame_pix_fmt = NULL; char *intra_matrix = NULL, *inter_matrix = NULL, *filters = NULL; - int i, force_fps = 0, top_field_first = -1; + int i; MATCH_PER_STREAM_OPT(frame_rates, str, frame_rate, oc, st); if (frame_rate && av_parse_video_rate(&ost->frame_rate, frame_rate) < 0) { @@ -3443,11 +3445,12 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc) if (forced_key_frames) parse_forced_key_frames(forced_key_frames, ost, video_enc); - MATCH_PER_STREAM_OPT(force_fps, i, force_fps, oc, st); - ost->force_fps = force_fps; + MATCH_PER_STREAM_OPT(force_fps, i, ost->force_fps, oc, st); + + ost->top_field_first = -1; + MATCH_PER_STREAM_OPT(top_field_first, i, ost->top_field_first, oc, st); - MATCH_PER_STREAM_OPT(top_field_first, i, top_field_first, oc, st); - ost->top_field_first = top_field_first; + MATCH_PER_STREAM_OPT(copy_initial_nonkeyframes, i, ost->copy_initial_nonkeyframes, oc ,st); #if CONFIG_AVFILTER MATCH_PER_STREAM_OPT(filters, str, filters, oc, st); @@ -3711,7 +3714,7 @@ static void opt_output_file(void *optctx, const char *filename) case AVMEDIA_TYPE_DATA: ost = new_data_stream(o, oc); break; case AVMEDIA_TYPE_ATTACHMENT: ost = new_attachment_stream(o, oc); break; default: - av_log(NULL, AV_LOG_FATAL, "Cannot map stream #%d.%d - unsupported type.\n", + av_log(NULL, AV_LOG_FATAL, "Cannot map stream #%d:%d - unsupported type.\n", map->file_index, map->stream_index); exit_program(1); } @@ -4248,7 +4251,7 @@ static const OptionDef options[] = { { "shortest", OPT_BOOL | OPT_EXPERT, {(void*)&opt_shortest}, "finish encoding within shortest input" }, // { "dts_delta_threshold", HAS_ARG | OPT_FLOAT | OPT_EXPERT, {(void*)&dts_delta_threshold}, "timestamp discontinuity delta threshold", "threshold" }, { "xerror", OPT_BOOL, {(void*)&exit_on_error}, "exit on error", "error" }, - { "copyinkf", OPT_BOOL | OPT_EXPERT, {(void*)©_initial_nonkeyframes}, "copy initial non-keyframes" }, + { "copyinkf", OPT_BOOL | OPT_EXPERT | OPT_SPEC, {.off = OFFSET(copy_initial_nonkeyframes)}, "copy initial non-keyframes" }, { "frames", OPT_INT64 | HAS_ARG | OPT_SPEC, {.off = OFFSET(max_frames)}, "set the number of frames to record", "number" }, { "tag", OPT_STRING | HAS_ARG | OPT_SPEC, {.off = OFFSET(codec_tags)}, "force codec tag/fourcc", "fourcc/tag" }, { "q", HAS_ARG | OPT_EXPERT | OPT_DOUBLE | OPT_SPEC, {.off = OFFSET(qscale)}, "use fixed quality scale (VBR)", "q" }, @@ -4349,6 +4352,7 @@ int main(int argc, char **argv) avfilter_register_all(); #endif av_register_all(); + avformat_network_init(); #if HAVE_ISATTY if(isatty(STDIN_FILENO)) |