Re: [mpg123-users] Trying to understand MPG123_NEW_FORMAT
Brought to you by:
sobukus
From: Thomas O. <tho...@or...> - 2024-07-03 20:17:07
|
Am Wed, 3 Jul 2024 21:01:19 +0200 schrieb Martin Guy <mar...@gm...>: > mpg123_read(16384 bytes) returns MPG123_NEW_FORMAT with 1536 bytes > and mpg123_getformat() says it has 2 channels Looks like some garbage in between leads mpg132 to recognize two frames of MPEG layer 1 data (384 16 bit samples per frame, amounting to 2*384*2=1536 bytes) and then the stereo MPEG layer 3 stream continues, with some hickup. > 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?) Let's see what I wrote back then … http://scm.orgis.org/mpg123/trunk/src/include/mpg123.h * Decoding/seek functions may also return message codes MPG123_DONE, * MPG123_NEW_FORMAT and MPG123_NEED_MORE (all negative, see below on how to * react). Note that calls to those can be nested, so generally watch out * for these codes after initial handle setup. * Especially any function that needs information about the current stream * to work will try to at least parse the beginning if that did not happen * yet. MPG123_NEW_FORMAT=-11, /**< Message: Output format will be different on next call. Note that some libmpg123 versions between 1.4.3 and 1.8.0 insist on you calling mpg123_getformat() after getting this message code. Newer verisons behave like advertised: You have the chance to call mpg123_getformat(), but you can also just continue decoding and get your data. */ Quote: Message: Output format will be different on next call. I hoped to make it clear that the new format applies to the data you get with subsequend read calls. That is why you can get zero bytes returned with that message, where the new data is withheld. Did you miss that bit of information among the other text, drowning out the main point? Alrighty then, Thomas |