aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOana Stratulat <oanaandreeastratulat@gmail.com>2012-01-06 02:02:50 +0100
committerClément Bœsch <ubitux@gmail.com>2012-01-06 02:05:50 +0100
commitee4d43ef7a89626de8eaf02bec5a7ca44d96edbf (patch)
treeeca9308030b2a36f49605dc8c19b4ce5566e3432
parent95afa0a5738793a91aaf093299ac10ee0f83c169 (diff)
downloadffmpeg-ee4d43ef7a89626de8eaf02bec5a7ca44d96edbf.tar.gz
ffmpeg: check if number of input and output channels are valid.
Fix Ticket887.
-rw-r--r--ffmpeg.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/ffmpeg.c b/ffmpeg.c
index e23ea6505c..5bef906c36 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1096,8 +1096,14 @@ need_realloc:
av_opt_set_int(ost->swr, "icl", av_get_default_channel_layout(ost->audio_channels_mapped), 0);
av_opt_set_int(ost->swr, "uch", ost->audio_channels_mapped, 0);
}
- av_opt_set_int(ost->swr, "ich", dec->channels, 0);
- av_opt_set_int(ost->swr, "och", enc->channels, 0);
+ if (av_opt_set_int(ost->swr, "ich", dec->channels, 0) < 0) {
+ av_log(NULL, AV_LOG_FATAL, "Unsupported number of input channels\n");
+ exit_program(1);
+ }
+ if (av_opt_set_int(ost->swr, "och", enc->channels, 0) < 0) {
+ av_log(NULL, AV_LOG_FATAL, "Unsupported number of output channels\n");
+ exit_program(1);
+ }
if(audio_sync_method>1) av_opt_set_int(ost->swr, "flags", SWR_FLAG_RESAMPLE, 0);
if(ost->swr && swr_init(ost->swr) < 0){
av_log(NULL, AV_LOG_FATAL, "swr_init() failed\n");