summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-07-26 22:19:10 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-07-26 22:27:50 +0200
commit5d2cf1ae8642608dcddf6a237f34f4c14123cfcc (patch)
treea01f4c8c2f8adc2de4cb82710ef72f806bfda06e /doc
parentead22f42f4fc078bb60549238233d5862da5a488 (diff)
doc/examples/muxing: select a supported sample rate for the encoder, favor 44100
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'doc')
-rw-r--r--doc/examples/muxing.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/doc/examples/muxing.c b/doc/examples/muxing.c
index 76169a4911..c52492dc77 100644
--- a/doc/examples/muxing.c
+++ b/doc/examples/muxing.c
@@ -117,6 +117,14 @@ static void add_stream(OutputStream *ost, AVFormatContext *oc,
(*codec)->sample_fmts[0] : AV_SAMPLE_FMT_FLTP;
c->bit_rate = 64000;
c->sample_rate = 44100;
+ if ((*codec)->supported_samplerates) {
+ c->sample_rate = (*codec)->supported_samplerates[0];
+ for (i = 0; (*codec)->supported_samplerates[i]; i++) {
+ if ((*codec)->supported_samplerates[i] == 44100)
+ c->sample_rate = 44100;
+ }
+ }
+ c->channels = av_get_channel_layout_nb_channels(c->channel_layout);
c->channel_layout = AV_CH_LAYOUT_STEREO;
if ((*codec)->channel_layouts) {
c->channel_layout = (*codec)->channel_layouts[0];