teknopaul
teknopaul

Reputation: 6770

how and when to use LAME's id3tag_set_albumart()

liblame has a function which accepts a rather small LAME_MAXALBUMART sized image

id3tag_set_albumart(m_lame, imageData, imageSize) )

calling this before lame_init_params(m_lame) causes something to go screwy and we just write zero byte files.

Any idea how this is meant to work?

Upvotes: 0

Views: 48

Answers (1)

teknopaul
teknopaul

Reputation: 6770

If you a call to id3tag_set_albumart() when setting up the lame encoder instance it has a copy of all these image bytes, that can be a lot of memory.

So the very first call to one of the lame_encode_buffer_* methods, which sends audio data, is also going to write all the image data to the stream. Thus, the buffer need to be much bigger than usual, up to LAME_MAXALBUMART + some other space for id3v2 header data. Can be bigger than 128K for that one call.

Subsequent calls to encode methods can be given a buffer that is just big enough for the samples being encoded.

Upvotes: 1

Related Questions