[mpg123-users] Trying to understand MPG123_NEW_FORMAT
Brought to you by:
sobukus
|
From: Martin G. <mar...@gm...> - 2024-07-03 19:01:35
|
Greetings
I am trying to do the best I can when reading of a half-broken MP3 file
where mpg123_read() returns MPG123_NEW_FORMAT three times, and each
time, I ask mpg123_getformat() what the new format is.
The first time it says the stream now has one channel, then it happens
again and getformat() says it has 2 channels again.
Specifically, I'm asking for 10240 frames of pairs of shorts and on
shorter reads the code retries until it has the required block of data:
mpg123_read(40960 bytes) returns MPG123_OK with 40960 bytes written
mpg123_read(40960 bytes) returns MPG123_NEW_FORMAT with 24576 bytes
and mpg123_getformat() says it has 1 channel
mpg123_read(16384 bytes) returns MPG123_NEW_FORMAT with 1536 bytes
and mpg123_getformat() says it has 2 channels
mpg123_read(14848 bytes) returns MPG123_OK with 14848 bytes
mpg123_read(40960 bytes) returns MPG123_NEW_FORMAT with 0 bytes,
still saying it has 2 channels
mpg123_read(40960 bytes) returns MPG123_OK with 40960 bytes
and from there it carries on working normally
My question is whether the new format applies to the data returned by
the call that returned NEW_FORMAT, or whether the new format applies to
data returned by the successive calls to mpg123_read (i.e. are the 24576
bytes mono data, or the 1536 bytes?)
I've read the documentation many times, but can't figure out whether
MPG123_NEW_FORMAT's format is retrospective or futuristic.
Any clues would be welcome.
M
|