aboutsummaryrefslogtreecommitdiffstats
path: root/ffmpeg_filter.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-05-08 23:43:19 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-05-08 23:55:06 +0200
commit33ff943f70f04035942a68c725f6cf3426df0677 (patch)
treee71c90d85ca1e32335ed01345d8c4e03854c5ca2 /ffmpeg_filter.c
parent410905f7fd0d7f3274f3260aa508dc50e174105b (diff)
downloadffmpeg-33ff943f70f04035942a68c725f6cf3426df0677.tar.gz
ffmpeg: add -apad option which injects a apad filter only in the presence of video streams
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'ffmpeg_filter.c')
-rw-r--r--ffmpeg_filter.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/ffmpeg_filter.c b/ffmpeg_filter.c
index 58581c20d7..4b5c6768af 100644
--- a/ffmpeg_filter.c
+++ b/ffmpeg_filter.c
@@ -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;