examples/muxing: set sample formats from list of codec supported sample formats
[ffmpeg.git] / doc / examples / muxing.c
index 4cd3f65455a6b2b1a6ea56f2c6a2481a45bc7199..4cf72e5bcc6393c9f656b701f85c8f740e184d2d 100644 (file)
@@ -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;