int oggz_close (OGGZ * oggz) { if (oggz == NULL) return OGGZ_ERR_BAD_OGGZ; if (OGGZ_CONFIG_WRITE && (oggz->flags & OGGZ_WRITE)) { oggz_write_close (oggz); } else if (OGGZ_CONFIG_READ) { oggz_read_close (oggz); } oggz_vector_foreach (oggz->streams, oggz_stream_clear); oggz_vector_delete (oggz->streams); assert(oggz_dlist_is_empty(oggz->packet_buffer)); oggz_dlist_delete(oggz->packet_buffer); if (oggz->metric_internal) oggz_free (oggz->metric_user_data); if (oggz->file != NULL) { if (fclose (oggz->file) == EOF) { return OGGZ_ERR_SYSTEM; } } if (oggz->io != NULL) { oggz_io_flush (oggz); oggz_free (oggz->io); } oggz_free (oggz); return 0; }
int oggz_comments_free (oggz_stream_t * stream) { oggz_vector_foreach (stream->comments, (OggzFunc)oggz_comment_free); oggz_vector_delete (stream->comments); stream->comments = NULL; if (stream->vendor) oggz_free (stream->vendor); stream->vendor = NULL; return 0; }
int oggz_close (OGGZ * oggz) { if (oggz == NULL) return OGGZ_ERR_BAD_OGGZ; oggz_vector_foreach (oggz->streams, oggz_stream_clear); oggz_vector_delete (oggz->streams); if (OGGZ_CONFIG_WRITE && (oggz->flags & OGGZ_WRITE)) { oggz_write_close (oggz); } else if (OGGZ_CONFIG_READ) { oggz_read_close (oggz); } if (oggz->file != NULL) { if (fclose (oggz->file) == EOF) { return OGGZ_ERR_SYSTEM; } } oggz_free (oggz); return 0; }