tdm_buffer_release_handler func, void *user_data)
{
tdm_buffer_info *buf_info;
- tdm_buffer_func_info *func_info;
+ tdm_buffer_func_info *func_info = NULL;
TDM_RETURN_VAL_IF_FAIL(buffer != NULL, TDM_ERROR_INVALID_PARAMETER);
TDM_RETURN_VAL_IF_FAIL(func != NULL, TDM_ERROR_INVALID_PARAMETER);
buf_info = tdm_buffer_get_info(buffer);
TDM_RETURN_VAL_IF_FAIL(buf_info != NULL, TDM_ERROR_OUT_OF_MEMORY);
+ LIST_FOR_EACH_ENTRY(func_info, &buf_info->release_funcs, link) {
+ if (func_info->release_func == func && func_info->user_data == user_data) {
+ TDM_ERR("can't add twice");
+ return TDM_ERROR_BAD_REQUEST;
+ }
+ }
+
func_info = calloc(1, sizeof(tdm_buffer_func_info));
TDM_RETURN_VAL_IF_FAIL(func_info != NULL, TDM_ERROR_OUT_OF_MEMORY);
buf_info = tdm_buffer_get_info(buffer);
TDM_RETURN_VAL_IF_FAIL(buf_info != NULL, TDM_ERROR_OUT_OF_MEMORY);
+ LIST_FOR_EACH_ENTRY(func_info, &buf_info->destroy_funcs, link) {
+ if (func_info->destroy_func == func && func_info->user_data == user_data) {
+ TDM_ERR("can't add twice");
+ return TDM_ERROR_BAD_REQUEST;
+ }
+ }
+
func_info = calloc(1, sizeof(tdm_buffer_func_info));
TDM_RETURN_VAL_IF_FAIL(func_info != NULL, TDM_ERROR_OUT_OF_MEMORY);