libvorbis takes float input, so we can just deinterleave/reorder the input
as-is instead of also converting.
---
 libavcodec/libvorbis.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/libvorbis.c b/libavcodec/libvorbis.c
index 1fc9e1d..955c249 100644
--- a/libavcodec/libvorbis.c
+++ b/libavcodec/libvorbis.c
@@ -235,7 +235,7 @@ static int oggvorbis_encode_frame(AVCodecContext *avctx, 
unsigned char *packets,
 {
     OggVorbisContext *s = avctx->priv_data;
     ogg_packet op;
-    signed short *audio = data;
+    float *audio = data;
     int pkt_size;
 
     /* send samples to libvorbis */
@@ -250,7 +250,7 @@ static int oggvorbis_encode_frame(AVCodecContext *avctx, 
unsigned char *packets,
             int co = (channels > 8) ? c :
                      ff_vorbis_encoding_channel_layout_offsets[channels - 
1][c];
             for (i = 0; i < samples; i++)
-                buffer[c][i] = audio[i * channels + co] / 32768.f;
+                buffer[c][i] = audio[i * channels + co];
         }
         vorbis_analysis_wrote(&s->vd, samples);
     } else {
@@ -314,7 +314,7 @@ AVCodec ff_libvorbis_encoder = {
     .encode         = oggvorbis_encode_frame,
     .close          = oggvorbis_encode_close,
     .capabilities   = CODEC_CAP_DELAY,
-    .sample_fmts    = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16,
+    .sample_fmts    = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLT,
                                                       AV_SAMPLE_FMT_NONE },
     .long_name      = NULL_IF_CONFIG_SMALL("libvorbis Vorbis"),
     .priv_class     = &class,
-- 
1.7.1

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to