diff options
author | Brandon Low <lostlogic@rockbox.org> | 2007-11-03 06:21:32 +0000 |
---|---|---|
committer | Brandon Low <lostlogic@rockbox.org> | 2007-11-03 06:21:32 +0000 |
commit | 11a3661d73884f627c804fbcc0e5be820511cbfa (patch) | |
tree | 53dfa0de2d5beb78d51981859f67db96a5b0db1d /apps/playback.c | |
parent | fe2f1af0d3374b1a87ba958b67cb92729bf76071 (diff) |
Make atomic type work for even first track. Rework low buffer handling... uses a stateful variable because I'm a bitter old man and it works this way
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15425 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/playback.c')
-rw-r--r-- | apps/playback.c | 57 |
1 files changed, 31 insertions, 26 deletions
diff --git a/apps/playback.c b/apps/playback.c index 0a929e634a..d9e55b762f 100644 --- a/apps/playback.c +++ b/apps/playback.c @@ -2387,7 +2387,6 @@ static bool audio_load_track(int offset, bool start_play) } struct mp3entry *track_id3; - enum data_type type = TYPE_PACKET_AUDIO; if (track_widx == track_ridx) track_id3 = &curtrack_id3; @@ -2399,41 +2398,47 @@ static bool audio_load_track(int offset, bool start_play) set_filebuf_watermark(buffer_margin, 0); track_id3->elapsed = 0; - if (offset > 0) - { - switch (track_id3->codectype) { - case AFMT_MPA_L1: - case AFMT_MPA_L2: - case AFMT_MPA_L3: + enum data_type type = TYPE_PACKET_AUDIO; + + switch (track_id3->codectype) { + case AFMT_MPA_L1: + case AFMT_MPA_L2: + case AFMT_MPA_L3: + if (offset > 0) { file_offset = offset; track_id3->offset = offset; audio_set_elapsed(track_id3); ci.curpos = offset; - break; + } + break; - case AFMT_WAVPACK: + case AFMT_WAVPACK: + if (offset > 0) { file_offset = offset; track_id3->offset = offset; track_id3->elapsed = track_id3->length / 2; ci.curpos = offset; - break; + } + break; - case AFMT_OGG_VORBIS: - case AFMT_SPEEX: - case AFMT_FLAC: - case AFMT_PCM_WAV: - case AFMT_A52: - case AFMT_AAC: - case AFMT_MPC: - case AFMT_APE: + case AFMT_OGG_VORBIS: + case AFMT_SPEEX: + case AFMT_FLAC: + case AFMT_PCM_WAV: + case AFMT_A52: + case AFMT_AAC: + case AFMT_MPC: + case AFMT_APE: + if (offset > 0) track_id3->offset = offset; - break; - case AFMT_NSF: - case AFMT_SPC: - logf("Loading atomic %d",track_id3->codectype); - type = TYPE_ATOMIC_AUDIO; - break; - } + break; + + case AFMT_NSF: + case AFMT_SPC: + case AFMT_SID: + logf("Loading atomic %d",track_id3->codectype); + type = TYPE_ATOMIC_AUDIO; + break; } logf("alt:%s", trackname); @@ -2625,7 +2630,6 @@ static int audio_check_new_track(void) track_ridx &= MAX_TRACK_MASK; buf_set_base_handle(CUR_TI->audio_hid); - register_buffer_low_callback(low_buffer_callback); if (automatic_skip) { @@ -3036,6 +3040,7 @@ static void audio_thread(void) if (!playing || playlist_end || ci.stop_codec) break; audio_fill_file_buffer(false, 0); + register_buffer_low_callback(low_buffer_callback); break; case Q_AUDIO_PLAY: |