# HG changeset patch # User reimar # Date 1299016257 0 # Node ID 44f4ead8fdb012f19bbe671953476d0af9e4f0f8 # Parent b623edea8e3cc5b3ff1df61994b243db670da313 Start adding support for lavc audio encoders that use other formats than 16 bit signed. Not yet working properly. diff -r b623edea8e3c -r 44f4ead8fdb0 libmpcodecs/ae_lavc.c --- 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;