On 09/07/15 9:10 AM, Hendrik Leppkes wrote: > On Thu, Jul 9, 2015 at 1:32 PM, wm4 <nfx...@googlemail.com> wrote: >> On Tue, 7 Jul 2015 03:06:24 -0300 >> James Almer <jamr...@gmail.com> wrote: >> >>> Signed-off-by: James Almer <jamr...@gmail.com> >>> --- >>> libavcodec/libdcadec.c | 34 ++++++++++++++++++++++++++++++++++ >>> 1 file changed, 34 insertions(+) >>> >>> diff --git a/libavcodec/libdcadec.c b/libavcodec/libdcadec.c >>> index 4bc3765..796826e 100644 >>> --- a/libavcodec/libdcadec.c >>> +++ b/libavcodec/libdcadec.c >>> @@ -36,6 +36,8 @@ typedef struct DCADecContext { >>> int buffer_size; >>> } DCADecContext; >>> >>> +static int downmix_warned = 0; >>> + >>> static int dcadec_decode_frame(AVCodecContext *avctx, void *data, >>> int *got_frame_ptr, AVPacket *avpkt) >>> { >>> @@ -131,6 +133,17 @@ static int dcadec_decode_frame(AVCodecContext *avctx, >>> void *data, >>> if (exss = dcadec_context_get_exss_info(s->ctx)) { >>> enum AVMatrixEncoding matrix_encoding = AV_MATRIX_ENCODING_NONE; >>> >>> + if (!downmix_warned) { >>> + uint64_t layout = avctx->request_channel_layout; >>> + >>> + if (((layout == AV_CH_LAYOUT_STEREO_DOWNMIX || layout == >>> AV_CH_LAYOUT_STEREO) && !exss->embedded_stereo) || >>> + ( layout == AV_CH_LAYOUT_5POINT1 && !exss->embedded_6ch)) >>> + av_log(avctx, AV_LOG_WARNING, "%s downmix was requested >>> but no custom coefficients are available, " >>> + "this may result in >>> clipping\n", >>> + layout == >>> AV_CH_LAYOUT_5POINT1 ? "5.1" : "stereo"); >>> + downmix_warned = 1; >>> + } >>> + >> >> What does this mean? Does this happen with FFmpeg's DCA decoder too? >> > > It just means that the DCA stream has no embedded downmix > coefficients. It'll downmix using the default coeffs, which can mean > two things, 1) this was intended, and all is fine, 2) downmixing was > not considered, and it may clip. > Personally, I might like a mode where it would downmix if the coeffs > are available, and not downmix if not (so I can downmix clipping-safe > using av/swresample later).
It can't be currently done, as the behavior of the flags is pretty inconsistent as i described in the patch. We could however open a ticket asking the dcadec developer to actually change the implementation so something like that is possible before the first version is tagged (To avoid ifdeffery). > > The native decoder would have the same problem, but I don't know if it > even supports embedded downmixes properly. > > - Hendrik > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel