summaryrefslogtreecommitdiff
path: root/doc/examples/muxing.c
diff options
context:
space:
mode:
authorStefano Sabatini <stefasab@gmail.com>2014-01-07 12:59:50 +0100
committerStefano Sabatini <stefasab@gmail.com>2014-01-09 10:51:41 +0100
commiteadc42125905ae889a7d9d793ebae38dd48d9552 (patch)
tree463c07c1d68137d677ae65dbfb242025e219b6aa /doc/examples/muxing.c
parentfb8f5d0510619cea2204246631f1c0dcd994ee25 (diff)
examples/muxing: set sample formats from list of codec supported sample formats
Avoid the need of tweaking, also show how to get list of supported sample formats.
Diffstat (limited to 'doc/examples/muxing.c')
-rw-r--r--doc/examples/muxing.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/doc/examples/muxing.c b/doc/examples/muxing.c
index 4cd3f65455..4cf72e5bcc 100644
--- a/doc/examples/muxing.c
+++ b/doc/examples/muxing.c
@@ -73,7 +73,8 @@ static AVStream *add_stream(AVFormatContext *oc, AVCodec **codec,
switch ((*codec)->type) {
case AVMEDIA_TYPE_AUDIO:
- c->sample_fmt = AV_SAMPLE_FMT_FLTP;
+ c->sample_fmt = (*codec)->sample_fmts ?
+ (*codec)->sample_fmts[0] : AV_SAMPLE_FMT_FLTP;
c->bit_rate = 64000;
c->sample_rate = 44100;
c->channels = 2;