ffmpeg: add -apad option which injects a apad filter only in the presence of video streams
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
@@ -424,6 +424,7 @@ static int configure_output_audio_filter(FilterGraph *fg, OutputFilter *ofilter,
|
||||
OutputStream *ost = ofilter->ost;
|
||||
AVCodecContext *codec = ost->st->codec;
|
||||
AVFilterContext *last_filter = out->filter_ctx;
|
||||
OutputFile *of = output_files[ost->file_index];
|
||||
int pad_idx = out->pad_idx;
|
||||
char *sample_fmts, *sample_rates, *channel_layouts;
|
||||
char name[255];
|
||||
@@ -519,6 +520,20 @@ static int configure_output_audio_filter(FilterGraph *fg, OutputFilter *ofilter,
|
||||
AUTO_INSERT_FILTER("-vol", "volume", args);
|
||||
}
|
||||
|
||||
if (ost->apad && of->shortest) {
|
||||
char args[256];
|
||||
int i;
|
||||
|
||||
for (i=0; i<of->ctx->nb_streams; i++)
|
||||
if (of->ctx->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO)
|
||||
break;
|
||||
|
||||
if (i<of->ctx->nb_streams) {
|
||||
snprintf(args, sizeof(args), "%s", ost->apad);
|
||||
AUTO_INSERT_FILTER("-apad", "apad", args);
|
||||
}
|
||||
}
|
||||
|
||||
ret = insert_trim(ost, &last_filter, &pad_idx);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
Reference in New Issue
Block a user