-static int mp3_reposition_stream(long unsigned new_frame)
-{
- int count = 0, len;
-
- PARA_DEBUG_LOG("jmp to frame %lu/%i\n", new_frame, mp3.frames);
- rewind(mp3.file);
- while (count < new_frame && (len = find_valid_start()) > 0) {
-// PARA_DEBUG_LOG("%s: jmp to frame %d\n", __func__, count);
- if (fseek(mp3.file, len, SEEK_CUR) < 0)
- return -E_FSEEK;
- count++;
- }
- if (count != new_frame) {
- rewind(mp3.file);
- return -E_MP3_REPOS;
- }
- return 1;
-}
-
-static int mp3_read_next_chunk(void)
-{
- int len = find_valid_start();
-
- if (len <= 0) {
- if (len < 0)
- PARA_ERROR_LOG("invalid frame len (%d)\n", len);
- return len;
- }
- chunk_size = para_fread(mp3buf, len, 1, mp3.file);
- if (len != chunk_size)
- PARA_DEBUG_LOG("short read (%d/%d)\n", chunk_size, len);
- return chunk_size;
-}
-
-static char *mp3_read_chunk(__a_unused long unsigned chunk_num, ssize_t *len)
-{
- *len = mp3_read_next_chunk();
- if (*len <= 0)
- return NULL;
- return mp3buf;
-}
-
-static void mp3_close_audio_file(void)
-{
- if (!mp3.file)
- return;
- fclose(mp3.file);
- mp3.file = NULL;
-}
-