[MPlayer-dev-eng] [PATCH] -oac copy with ac3 sound and lavf ts demuxer issues (Was: Re: [MEncoder-users] Video/Audio asynchronous)

Matthias Hopf mat at mshopf.de
Tue Feb 20 17:02:36 CET 2007


On Feb 20, 07 16:07:06 +0100, Nico Sabbi wrote:
> >Note that I'm using -oac copy, so no decoder is involved here at all.
> >And apparently the mpegts demuxer *does* set them.
> >
> no. find a row in demux_ts that sets them ;)

Hm. Didn't look at the code, you're right. But who sets them in that
case? Because they are apparently set correctly. And they have to,
because otherwise -oac copy will never ever work.

Does demux_ts invoke the ac3 decoder? Even if nothing is decoded at all?
In that case, why does demux_lavf *not* invoke the audio decoder, and
rather sets those values itself?

I'd really like to fix this for good, though I can live with my current
patch ATM. The different demuxer codes are not exactly trivial to
understand (especially demux_lavf.c) and pretty much uncorrelated to
each other.

I just greped for dwScale in the codebase. The only files setting
dwScale are ae_*.c (encoders), demux_audio.c (mp3 only), demux_lavf.c
(but not! demux_avi.c), demux_mpc.c, demux_nut.c, and mencoder.c.

I don't understand where the demux_ts codepath actually sets dwScale &
Co, but it apparently *is* set somewhere...

And I definitely don't understand that block from mencoder.c - it looks
like arbitrarily shuffling parameters around:

    if(sh_audio->audio.dwScale){
        mux_a->h.dwSampleSize=sh_audio->audio.dwSampleSize;
        mux_a->h.dwScale=sh_audio->audio.dwScale;
        mux_a->h.dwRate=sh_audio->audio.dwRate;
    } else {
        mux_a->h.dwSampleSize=mux_a->wf->nBlockAlign;
        mux_a->h.dwScale=mux_a->h.dwSampleSize;
        mux_a->h.dwRate=mux_a->wf->nAvgBytesPerSec;
    }


For nBlockAlign, some things to note:
mencoder.c initializes nBlockAlign with 1, but demux_lavf sets it to
codec->block_align, which is zero w/o my patch. Many demuxers in
libavformat/ set codec->block_align, but not all of them, and mpegts.c
didn't at all so far.


CU

Matthias

-- 
Matthias Hopf <mhopf at suse.de>      __        __   __
Maxfeldstr. 5 / 90409 Nuernberg   (_   | |  (_   |__          mat at mshopf.de
Phone +49-911-74053-715           __)  |_|  __)  |__  R & D   www.mshopf.de



More information about the MPlayer-dev-eng mailing list