diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-04-17 12:13:22 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-04-17 12:13:22 +0200 |
commit | 15141f939dc725451644869f4d413adb46927677 (patch) | |
tree | e0aba01c6ebbe093e4b3265ae94f639628c1053f /ffmpeg.c | |
parent | 68ca49dc7256bbe413ce29fa3fc47bb4143304c0 (diff) | |
parent | 8b84e082ed27fb635fca524fbd14b1db094ee8b0 (diff) | |
download | ffmpeg-15141f939dc725451644869f4d413adb46927677.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master:
indeo3: add parens around some macro arguments
h264: use proper PROLOGUE statement for a function using 8 registers.
doc: Update sample Vim config with suitable (function) indentation settings.
dv: Merge dvquant.h into dvdata.c where all other DV tables reside.
dv: Move static tables only used in one place to where they are used.
graphparser: set next to NULL on an entry extracted from inputs list
doc/filters: update documentation.
avconv: flush decoders immediately after an EOF.
avconv: send EOF to vsrc_buffer.
avconv: reindent.
Conflicts:
doc/filters.texi
ffmpeg.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'ffmpeg.c')
-rw-r--r-- | ffmpeg.c | 121 |
1 files changed, 65 insertions, 56 deletions
@@ -2492,6 +2492,9 @@ static int transcode_video(InputStream *ist, AVPacket *pkt, int *got_output, int quality = same_quant ? decoded_frame->quality : 0; if (!*got_output) { /* no picture yet */ + if (!pkt->size) + for (i = 0; i < ist->nb_filters; i++) + av_buffersrc_buffer(ist->filters[i]->filter, NULL); return ret; } @@ -3488,6 +3491,13 @@ static int transcode(void) } if (ret < 0) { input_files[file_index]->eof_reached = 1; + + for (i = 0; i < input_files[file_index]->nb_streams; i++) { + ist = input_streams[input_files[file_index]->ist_index + i]; + if (ist->decoding_needed) + output_packet(ist, NULL); + } + if (opt_shortest) break; else @@ -3586,7 +3596,7 @@ static int transcode(void) /* at the end of stream, we must flush the decoder buffers */ for (i = 0; i < nb_input_streams; i++) { ist = input_streams[i]; - if (ist->decoding_needed) { + if (!input_files[ist->file_index]->eof_reached && ist->decoding_needed) { output_packet(ist, NULL); } } @@ -3746,41 +3756,41 @@ static int opt_map(OptionsContext *o, const char *opt, const char *arg) exit_program(1); } } else { - file_idx = strtol(map, &p, 0); - if (file_idx >= nb_input_files || file_idx < 0) { - av_log(NULL, AV_LOG_FATAL, "Invalid input file index: %d.\n", file_idx); - exit_program(1); - } - if (negative) - /* disable some already defined maps */ - for (i = 0; i < o->nb_stream_maps; i++) { - m = &o->stream_maps[i]; - if (file_idx == m->file_index && - check_stream_specifier(input_files[m->file_index]->ctx, - input_files[m->file_index]->ctx->streams[m->stream_index], - *p == ':' ? p + 1 : p) > 0) - m->disabled = 1; + file_idx = strtol(map, &p, 0); + if (file_idx >= nb_input_files || file_idx < 0) { + av_log(NULL, AV_LOG_FATAL, "Invalid input file index: %d.\n", file_idx); + exit_program(1); } - else - for (i = 0; i < input_files[file_idx]->nb_streams; i++) { - if (check_stream_specifier(input_files[file_idx]->ctx, input_files[file_idx]->ctx->streams[i], - *p == ':' ? p + 1 : p) <= 0) - continue; - o->stream_maps = grow_array(o->stream_maps, sizeof(*o->stream_maps), - &o->nb_stream_maps, o->nb_stream_maps + 1); - m = &o->stream_maps[o->nb_stream_maps - 1]; - - m->file_index = file_idx; - m->stream_index = i; - - if (sync_file_idx >= 0) { - m->sync_file_index = sync_file_idx; - m->sync_stream_index = sync_stream_idx; - } else { - m->sync_file_index = file_idx; - m->sync_stream_index = i; + if (negative) + /* disable some already defined maps */ + for (i = 0; i < o->nb_stream_maps; i++) { + m = &o->stream_maps[i]; + if (file_idx == m->file_index && + check_stream_specifier(input_files[m->file_index]->ctx, + input_files[m->file_index]->ctx->streams[m->stream_index], + *p == ':' ? p + 1 : p) > 0) + m->disabled = 1; + } + else + for (i = 0; i < input_files[file_idx]->nb_streams; i++) { + if (check_stream_specifier(input_files[file_idx]->ctx, input_files[file_idx]->ctx->streams[i], + *p == ':' ? p + 1 : p) <= 0) + continue; + o->stream_maps = grow_array(o->stream_maps, sizeof(*o->stream_maps), + &o->nb_stream_maps, o->nb_stream_maps + 1); + m = &o->stream_maps[o->nb_stream_maps - 1]; + + m->file_index = file_idx; + m->stream_index = i; + + if (sync_file_idx >= 0) { + m->sync_file_index = sync_file_idx; + m->sync_stream_index = sync_stream_idx; + } else { + m->sync_file_index = file_idx; + m->sync_stream_index = i; + } } - } } if (!m) { @@ -4971,28 +4981,27 @@ loop_end: } init_output_filter(ofilter, o, oc); } else { - ist = input_streams[input_files[map->file_index]->ist_index + map->stream_index]; - if(o->subtitle_disable && ist->st->codec->codec_type == AVMEDIA_TYPE_SUBTITLE) - continue; - if(o-> audio_disable && ist->st->codec->codec_type == AVMEDIA_TYPE_AUDIO) - continue; - if(o-> video_disable && ist->st->codec->codec_type == AVMEDIA_TYPE_VIDEO) - continue; - if(o-> data_disable && ist->st->codec->codec_type == AVMEDIA_TYPE_DATA) - continue; - - switch (ist->st->codec->codec_type) { - case AVMEDIA_TYPE_VIDEO: ost = new_video_stream(o, oc, src_idx); break; - case AVMEDIA_TYPE_AUDIO: ost = new_audio_stream(o, oc, src_idx); break; - case AVMEDIA_TYPE_SUBTITLE: ost = new_subtitle_stream(o, oc, src_idx); break; - case AVMEDIA_TYPE_DATA: ost = new_data_stream(o, oc, src_idx); break; - case AVMEDIA_TYPE_ATTACHMENT: ost = new_attachment_stream(o, oc, src_idx); break; - default: - av_log(NULL, AV_LOG_FATAL, "Cannot map stream #%d:%d - unsupported type.\n", - map->file_index, map->stream_index); - exit_program(1); - } - + ist = input_streams[input_files[map->file_index]->ist_index + map->stream_index]; + if(o->subtitle_disable && ist->st->codec->codec_type == AVMEDIA_TYPE_SUBTITLE) + continue; + if(o-> audio_disable && ist->st->codec->codec_type == AVMEDIA_TYPE_AUDIO) + continue; + if(o-> video_disable && ist->st->codec->codec_type == AVMEDIA_TYPE_VIDEO) + continue; + if(o-> data_disable && ist->st->codec->codec_type == AVMEDIA_TYPE_DATA) + continue; + + switch (ist->st->codec->codec_type) { + case AVMEDIA_TYPE_VIDEO: ost = new_video_stream (o, oc, src_idx); break; + case AVMEDIA_TYPE_AUDIO: ost = new_audio_stream (o, oc, src_idx); break; + case AVMEDIA_TYPE_SUBTITLE: ost = new_subtitle_stream (o, oc, src_idx); break; + case AVMEDIA_TYPE_DATA: ost = new_data_stream (o, oc, src_idx); break; + case AVMEDIA_TYPE_ATTACHMENT: ost = new_attachment_stream(o, oc, src_idx); break; + default: + av_log(NULL, AV_LOG_FATAL, "Cannot map stream #%d:%d - unsupported type.\n", + map->file_index, map->stream_index); + exit_program(1); + } } } } |