* Destroy a decoding session. * * All decoder instances and output callbacks are properly released. * * @param sess The session to be destroyed. Must not be NULL. * * @return SRD_OK upon success, a (negative) error code otherwise. * * @since 0.3.0 */
| 342 | * @since 0.3.0 |
| 343 | */ |
| 344 | SRD_API int srd_session_destroy(struct srd_session *sess) |
| 345 | { |
| 346 | int session_id; |
| 347 | |
| 348 | if (!sess) |
| 349 | return SRD_ERR_ARG; |
| 350 | |
| 351 | session_id = sess->session_id; |
| 352 | if (sess->di_list) |
| 353 | srd_inst_free_all(sess); |
| 354 | if (sess->callbacks) |
| 355 | g_slist_free_full(sess->callbacks, g_free); |
| 356 | sessions = g_slist_remove(sessions, sess); |
| 357 | g_free(sess); |
| 358 | |
| 359 | srd_info("Destroyed session %d.", session_id); |
| 360 | |
| 361 | return SRD_OK; |
| 362 | } |
| 363 | |
| 364 | /** |
| 365 | * Register/add a decoder output callback function. |
no test coverage detected