right, but the key point is 'switch between streams'. That means a more complex/capable implementation that should be advertised as such to applications. This is not the default behavior assumed initially: to allow for minimal implementations in memory-constrained devices, we assumed gapless was supported with a single decoder.
Maybe the right way to do this is extend the snd_compr_caps structure:
/**
ÂÂ* struct snd_compr_caps - caps descriptor
ÂÂ* @codecs: pointer to array of codecs
ÂÂ* @direction: direction supported. Of type snd_compr_direction
ÂÂ* @min_fragment_size: minimum fragment supported by DSP
ÂÂ* @max_fragment_size: maximum fragment supported by DSP
ÂÂ* @min_fragments: min fragments supported by DSP
ÂÂ* @max_fragments: max fragments supported by DSP
ÂÂ* @num_codecs: number of codecs supported
ÂÂ* @reserved: reserved field
ÂÂ*/
struct snd_compr_caps {
ÂÂÂÂÂ__u32 num_codecs;
ÂÂÂÂÂ__u32 direction;
ÂÂÂÂÂ__u32 min_fragment_size;
ÂÂÂÂÂ__u32 max_fragment_size;
ÂÂÂÂÂ__u32 min_fragments;
ÂÂÂÂÂ__u32 max_fragments;
ÂÂÂÂÂ__u32 codecs[MAX_NUM_CODECS];
ÂÂÂÂÂ__u32 reserved[11];
} __attribute__((packed, aligned(4)));
and use a reserved field to provide info on capabilities, and filter the set_codec_params() addition based this capability - i.e. return -ENOTSUP in 'traditional' implementations based on a single 'stream'/decoder instance.
Sounds good!
I will give it a go and see how it ends up!