+void Client_codec_add(client_t *client, int codec)
+{
+ codec_t *cd = malloc(sizeof(codec_t));
+ if (cd == NULL)
+ Log_fatal("Out of memory");
+ init_list_entry(&cd->node);
+ cd->codec = codec;
+ list_add_tail(&cd->node, &client->codecs);
+}
+
+void Client_codec_free(client_t *client)
+{
+ struct dlist *itr, *save;
+ list_iterate_safe(itr, save, &client->codecs) {
+ list_del(&list_get_entry(itr, codec_t, node)->node);
+ free(list_get_entry(itr, codec_t, node));
+ }
+}
+
+codec_t *Client_codec_iterate(client_t *client, codec_t **codec_itr)
+{
+ codec_t *cd = *codec_itr;
+
+ if (list_empty(&client->codecs))
+ return NULL;
+
+ if (cd == NULL) {
+ cd = list_get_entry(list_get_first(&client->codecs), codec_t, node);
+ } else {
+ if (list_get_next(&cd->node) == &client->codecs)
+ cd = NULL;
+ else
+ cd = list_get_entry(list_get_next(&cd->node), codec_t, node);
+ }
+ *codec_itr = cd;
+ return cd;
+}
+