[FFmpeg-devel] [PATCH] Add NULL mixer to AVSequencer.

Sebastian Vater cdgs.basty
Sun Aug 15 18:05:12 CEST 2010

Ronald S. Bultje a ?crit :
> Hi Sebastian,
> On Sat, Aug 14, 2010 at 8:06 AM, Sebastian Vater
> <cdgs.basty at googlemail.com> wrote:
>> The NULL mixer does not output any PCM data but internally
>> simulates the whole mixing process (i.e. calculation of
>> sample positions and running the playback handler at
>> correct timing), which is useful for playtime calculation.
> For those of us that know less than you about mod files, can you
> explain in a few sentences what this patch is useful for? Why do we
> want it, why do we need it, why would it be important to commit this
> patch before - say - a demuxer/decoder, and what does the patch in the
> end accomplish, i.e. what is the place of this patch w.r.t. the big
> picture of ffplay playing back a mod file?

Consider it like /dev/null and /dev/zero. Although they don't do
anything "useful" they have their pretty places. ;-)

The purpose of the null mixer is:
a) exact playtime calculation. For TuComposer files you can't anymore
simply parse the pattern data and go through the order list, since it
features a full-featured synth sound assembler which makes it otherwise
impossible to get always correct results (unless you solve the famous
halting problem of a turing machine).

The point here is, that the synth assember can also call the normal
effects (that means also position jump and pattern changing, which
affect playback time). It also can read the current sample position of a
certain channel and do actions based on that, i.e. you can write code
with the synth sound assembler that does a pattern jump if current
sample position is between 7000 and 9000 (yes that's weird, but the
power is there).

b) for transcoding from module to module when translate NNA channels to
non-NNA supporting trackers, the null mixer does it well enough to do
this correctly.

c) it's waaaay faster than even the low quality mixer, on my Amiga the
null mixer is around 10-30 times faster than the low quality mixer.

Imagine you are setting up an FFmpeg server which has PCM output
disabled for modules, then you can disable the low quality mixer and
just get stick with the null quality mixer. This is also useful for size
reduction, since the low quality mixer is around 450k (object file),
while the null mixer is only around 23k.

d) It's good for review, since it's less than 1000 lines but these lines
share 95% with the low quality mixer, i.e. if this passes review, the
low quality mixer will most likely also (it's 23k lines now, but no
panic, most of the rest 22k lines are VERY similar, so just review in
the low quality mixer one or five functions which would follow after the
null mixer, and I'll apply the critics to the remaining functions, too,
saving us all LOTS of time).

> (Same info would be useful for other patches as well.)
> A null mixer, to me, sounds like "something that doesn't do anything".
> I might be misreading that, but that sounds like it wouldn't
> necessarily belong in a release version of FFmpeg that ends up on your
> next-generation cellphone. Can this code do something that the
> not-null mixer cannot? If so, can the not-null mixer be changed to
> support that?

Well, it does actually do something, it calculates all samples positions
to be mixed but just doesn't write any actual data out (which is the
most CPU intense part, so my idea was to do an second mixer).

Hope this helps!


Best regards,
                   :-) Basty/CDGS (-:

More information about the ffmpeg-devel mailing list