/* Fill info structure with data from spx comments */ static void spx_info (const char *file_name, struct file_tags *tags, const int tags_sel) { struct io_stream *s; s = io_open (file_name, 0); if (io_ok(s)) { struct spx_data *data = spx_open_internal (s); if (data->ok) { if (tags_sel & TAGS_COMMENTS) get_comments (data, tags); if (tags_sel & TAGS_TIME) tags->time = count_time (data); } spx_close (data); } }
static void *spx_open (const char *file) { struct io_stream *stream; struct spx_data *data; stream = io_open (file, 1); if (io_ok(stream)) data = spx_open_internal (stream); else { data = (struct spx_data *)xmalloc (sizeof(struct spx_data)); decoder_error_init (&data->error); decoder_error (&data->error, ERROR_STREAM, 0, "Can't open file: %s", io_strerror(data->stream)); data->ok = 0; } return data; }
static void *spx_open_stream (struct io_stream *stream) { return spx_open_internal (stream); }