On 6/27/18 12:49 AM, Liam Girdwood wrote:
On Tue, 2018-06-26 at 19:05 +0300, Daniel Baluta wrote:
Just wanted to check with you if I'm going in the correct direction.
I'm trying to play an mp3 file using cplay from tinycompres. The question now is when to load the codec library.
It seems that the codec_id can be passed via SNDRV_COMPRESS_SET_PARAMS stored inside snd_codec id field.
Now, I can load the codec library in stream->ops->set_params and since set_params is called in compress_open I can have the codec loaded before playing starts.
My concern is that I also need to unload the library (to free resources) when playing is done.
But, there is no symmetric call to set_params to be called in compress_close.
No sure, Pierre did a lot on work on the compressed APIs so best for him to comment on the intended approach here.
If nothing is obvious, perhaps we need to add an equivalent of hw_free() for compressed streams.
The compressed API dates from maybe 2011 and at the time the firmware contained all the relevant libraries. The SET_PARAMS was just a selector of the right mode (provided with the snd_codec structure), not really something that would allocate resources or download modules on the fly. If we use this API in conjunction with firmware modules then an update may be needed. Clearly that wasn't something we thought about.