changeset 32907:44f4ead8fdb0

Start adding support for lavc audio encoders that use other formats than 16 bit signed. Not yet working properly.
author reimar
date Tue, 01 Mar 2011 21:50:57 +0000
parents b623edea8e3c
children c93ae40fb504
files libmpcodecs/ae_lavc.c
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/ae_lavc.c	Tue Mar 01 21:48:04 2011 +0000
+++ b/libmpcodecs/ae_lavc.c	Tue Mar 01 21:50:57 2011 +0000
@@ -40,6 +40,7 @@
 #include "libavutil/intreadwrite.h"
 #include "libavformat/avformat.h"
 #include "libmpdemux/mp_taglists.h"
+#include "fmt-conversion.h"
 
 static AVCodec        *lavc_acodec;
 static AVCodecContext *lavc_actx;
@@ -108,7 +109,6 @@
 	// Fix allocation
 	mux_a->wf = realloc(mux_a->wf, sizeof(WAVEFORMATEX)+mux_a->wf->cbSize);
 
-	encoder->input_format = AF_FORMAT_S16_NE;
 	encoder->min_buffer_size = mux_a->h.dwSuggestedBufferSize;
 	encoder->max_buffer_size = mux_a->h.dwSuggestedBufferSize*2;
 
@@ -187,7 +187,8 @@
 	lavc_actx->codec_type = AVMEDIA_TYPE_AUDIO;
 	lavc_actx->codec_id = lavc_acodec->id;
 	// put sample parameters
-	lavc_actx->sample_fmt = AV_SAMPLE_FMT_S16;
+	lavc_actx->sample_fmt = lavc_acodec->sample_fmts ? lavc_acodec->sample_fmts[0] : AV_SAMPLE_FMT_S16;
+	encoder->input_format = samplefmt2affmt(lavc_actx->sample_fmt);
 	lavc_actx->channels = encoder->params.channels;
 	lavc_actx->sample_rate = encoder->params.sample_rate;
 	lavc_actx->time_base.num = 1;