[FFmpeg-devel] [PATCH 2/2] avcodev/libdcadec: implement request_channel_layout
wm4
nfxjfg at googlemail.com
Thu Jul 9 19:21:29 CEST 2015
On Thu, 9 Jul 2015 14:10:40 +0200
Hendrik Leppkes <h.leppkes at gmail.com> wrote:
> On Thu, Jul 9, 2015 at 1:32 PM, wm4 <nfxjfg at googlemail.com> wrote:
> > On Tue, 7 Jul 2015 03:06:24 -0300
> > James Almer <jamrial at gmail.com> wrote:
> >
> >> Signed-off-by: James Almer <jamrial at 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).
I'd prefer that too.
> The native decoder would have the same problem, but I don't know if it
> even supports embedded downmixes properly.
Then I guess it doesn't matter, as it won't cause regressions. Thanks
for the explanation.
More information about the ffmpeg-devel
mailing list