[MPlayer-dev-eng] [PATCH] ad_mpg123: runtime format switch and not closing stream during decodeh

Reimar Döffinger Reimar.Doeffinger at gmx.de
Mon Sep 23 21:16:18 CEST 2013



On 23.09.2013, at 14:30, Thomas Orgis <thomas-forum at orgis.org> wrote:
> This fixes the issue raised in bug 2149 by avoiding artificial creation
> of an error situation if the apparent audio format of the stream
> changes. You can play wildly concatenated stream now with the decoder
> adapting. I tested this with MP3 pieces of differing sampling rates and
> even mixing MP2 and MP3 pieces. There, ad_mpg123 is more tolerant than
> ffmp3 or ffmp3float.

I'm quite sure I explained it somewhere... Anyway this isn't more tolerant,
the only issue when using ffmp3 is that ad_ffmpeg prefers the container framerate
over the one in the audio stream.
Unfortunately for raw mp3 that is complete nonsense, however for mp3 in avi for example it can be necessary to play correctly.

> PS: I would like to offer default (16 bit) and floating point output,
> the difference being this line in ad_mpg123:
> 
> mpg123_param(con->handle, MPG123_ADD_FLAGS, MPG123_FORCE_FLOAT, 0.);
> 
> (some more lines would achieve selection of s16, s32, etc.). How would
> one do that with least amount of duplication? Multiple codecs with one
> source? Configuration variables?

Just to be clear, you are asking about how to add this to mpg123, not MPlayer?
FFmpeg might be a good guide. Basically it has the type-dependant stuff in a separate
file and includes it twice with different files.
Kind of the C version of C++ templates.
However how to split into common code, "templated" code and completely separate code doesn't usually have an obvious answer.


More information about the MPlayer-dev-eng mailing list