Commit graph

596 commits

Author SHA1 Message Date
Nicolas Pennequin
2cf6345a0e bufgetid3 should be used carefully, as it can return NULL.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17143 a1c6a512-1295-4272-9138-f99709370657
2008-04-16 16:41:35 +00:00
Nicolas Pennequin
de026dcede Fix FS#8902 (NSF files get skipped). The cause was too strict metadata checking (the NSF metadata parser doesn't fill the 'length' field). Hopefully there won't be any problems with that anymore.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17142 a1c6a512-1295-4272-9138-f99709370657
2008-04-16 16:18:05 +00:00
Nicolas Pennequin
babd3beee3 audio_current_track: take wps_offset into account when no buffered metadata is available, and avoid using playlist_peek, which hits on the disk when dircache isn't enabled. This should make skipping nicer.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17128 a1c6a512-1295-4272-9138-f99709370657
2008-04-15 20:59:47 +00:00
Nicolas Pennequin
b36d3c0be2 Some bugfixes after r17109:
* Fix FS#8893 by plugging a file descriptor leak in audio_load_track.
* Fix a possible null pointer dereference by not allowing audio_current_track to return NULL.
* Make audio_current_track return prevtrack_id3 only during an automatic track skip. Fixes the wrong metadata being displayed for a short time after a backwards skip.
-Cette ligne, et les suivantes ci-dessous, seront ignorées--

M    apps/playback.c


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17126 a1c6a512-1295-4272-9138-f99709370657
2008-04-15 19:20:57 +00:00
Steve Bavin
e50202c5c4 Remove a global variable which is (hopefully) not needed. Also fixes a very minor bug where restarting playback after a playlist ends would play the final 3 seconds again.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17117 a1c6a512-1295-4272-9138-f99709370657
2008-04-15 12:38:17 +00:00
Nicolas Pennequin
4e2de44b44 A rather big change to how tracks are loaded: there are now two parts to the process and metadata loading is done by the buffering thread (except for the first unbuffered track). The audio thread now calls audio_load_track, and once the metadata is loaded, the buffering thread sends an event which will make the audio thread call audio_finish_load_track. This one then takes care of the rest of the loading.
This method makes skipping noticeably faster for unbuffered tracks, and especially backwards.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17109 a1c6a512-1295-4272-9138-f99709370657
2008-04-14 16:17:47 +00:00
Nicolas Pennequin
a5ad74ffca Revert what was left of r17018 until I find a better way. It had quirks in some cases, and doesn't play well with what I'm about to commit.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17108 a1c6a512-1295-4272-9138-f99709370657
2008-04-14 15:51:40 +00:00
Nicolas Pennequin
3c9625969b FS#8882: Fix the bug where skipping backwards with Ogg files could result in a skip forward (FS#8508). The problem was introduced by a one-line change in r16025, so we revert it. At the time I thought that line had become useless but obviously I was wrong. Thanks to Greg Erwin for finding the fix.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17107 a1c6a512-1295-4272-9138-f99709370657
2008-04-14 10:52:16 +00:00
Michael Giacomelli
9a946f6022 Commit FS#8822 by Magnus Holmgren. Fixes resuming previously playing WMA files after a reboot.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17090 a1c6a512-1295-4272-9138-f99709370657
2008-04-12 19:52:31 +00:00
Nicolas Pennequin
977069a41d Bring the WPS playlist index display into sync with the track being played by using the index field of the ID3 info struct instead of directly asking the playlist code.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17018 a1c6a512-1295-4272-9138-f99709370657
2008-04-07 13:43:09 +00:00
Michael Sevakis
05099149f1 Enable nocache sections using the linker. PP5022/4 must use SW_CORELOCK now with shared variables in DRAM (it seems swp(b) is at least partially broken on all PP or I'm doing something very wrong here :\). For core-shared data use SHAREDBSS/DATA_ATTR. NOCACHEBSS/DATA_ATTR is available whether or not single core is forced for static peripheral-DMA buffer allocation without use of the UNCACHED_ADDR macro in code and is likely useful on a non-PP target with a data cache (although not actually enabled in config.h and the .lds's in this commit).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16981 a1c6a512-1295-4272-9138-f99709370657
2008-04-06 04:34:57 +00:00
Nicolas Pennequin
fe9eb68ec0 Fix FS#8513 (Playback occasionally repeats a track when rebuffering occurs) and hopefully others by essentially reverting r16019, parts of r16425 and most bugfix followups. This means we're back to having a desynchronized playlist index in the WPS. audio_check_new_track() needs a serious rework before we can make improvements in that area without breaking things.
playlist_checkend() isn't used anymore but I'm not removing it for now because it might prove useful later on.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16955 a1c6a512-1295-4272-9138-f99709370657
2008-04-03 21:40:07 +00:00
Nicolas Pennequin
33f522de8b Migrate the buffering code to the new events system.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16950 a1c6a512-1295-4272-9138-f99709370657
2008-04-03 17:51:53 +00:00
Nicolas Pennequin
a3ed95247c Fix an issue introduced by r16930 where rebuffering would happen one track too early because track were counted after moving to the next one instead of before.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16948 a1c6a512-1295-4272-9138-f99709370657
2008-04-03 15:30:42 +00:00
Nicolas Pennequin
73a71a4712 Move audio_set_elapsed to mpa.c, as recommended by the TODO note. Please correct me if affecting ci->id3->elapsed directly (ie without using ci->set_elapsed) is wrong.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16945 a1c6a512-1295-4272-9138-f99709370657
2008-04-03 12:13:03 +00:00
Nicolas Pennequin
bb40e6ed15 Fix a possible (though unlikely) deadlock condition spotted by jhMikeS. It would involve both the buffering and the audio thread sending synchronous messages to one another.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16931 a1c6a512-1295-4272-9138-f99709370657
2008-04-02 17:18:15 +00:00
Nicolas Pennequin
03b54c29d7 Fix for FS#8601 by pondlife: the disk no longer spins up on a track change when dircache is disabled. This issue was introduced by me in r16019 by adding a call to playlist_peek() in audio_check_new_track(). This fix adds a new playlist API call to work around the problem until we find a better solution. There are also a few simplifications and comment corrections.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16930 a1c6a512-1295-4272-9138-f99709370657
2008-04-02 17:04:59 +00:00
Andree Buschmann
63acf3eb16 Fixes FS#8597 (dropouts while crossfading) via keeping CPU boosted while crossfading is active.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16889 a1c6a512-1295-4272-9138-f99709370657
2008-03-30 10:08:08 +00:00
Nicolas Pennequin
12b6c847c5 Fix sim warnings.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16881 a1c6a512-1295-4272-9138-f99709370657
2008-03-29 17:40:04 +00:00
Nicolas Pennequin
732df386af Boost the audio thread while it's filling the buffer. In the audio and the buffering threads, only cancel cpu boost when not filling.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16880 a1c6a512-1295-4272-9138-f99709370657
2008-03-29 17:28:30 +00:00
Nicolas Pennequin
b71cbd599b Use queue_empty instead of queue_peek again now that we don't care about the event type anymore.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16876 a1c6a512-1295-4272-9138-f99709370657
2008-03-29 13:32:37 +00:00
Michael Sevakis
4855e734f3 Move codec_get_file_pos somewhere else like the comment said should be done. Codec API version increment was needed so update all codecs.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16874 a1c6a512-1295-4272-9138-f99709370657
2008-03-29 06:36:53 +00:00
Nicolas Pennequin
f68147e5eb Track playback filling state with a state-machine approach. There shouldn't be any change in behaviour but things are simpler.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16868 a1c6a512-1295-4272-9138-f99709370657
2008-03-28 20:18:53 +00:00
Steve Bavin
135cc757bd Revert my earlier const madness, we'll keep the parameter lists simple.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16863 a1c6a512-1295-4272-9138-f99709370657
2008-03-28 12:51:33 +00:00
Steve Bavin
3d0b7c6901 Oops, another pondlife puddle of red.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16862 a1c6a512-1295-4272-9138-f99709370657
2008-03-28 11:43:08 +00:00
Steve Bavin
c9df8fd87b The const police raid playback.c, should be no change to behaviour.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16860 a1c6a512-1295-4272-9138-f99709370657
2008-03-28 11:24:24 +00:00
Steve Bavin
76691030da Oops, more red. That can't be static yet.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16803 a1c6a512-1295-4272-9138-f99709370657
2008-03-25 19:46:35 +00:00
Steve Bavin
38ed901284 A little more consting/staticing, no functional change.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16801 a1c6a512-1295-4272-9138-f99709370657
2008-03-25 19:26:00 +00:00
Michael Sevakis
27cf677339 Add a complete priority inheritance implementation to the scheduler (all mutex ownership and queue_send calls are inheritable). Priorities are differential so that dispatch depends on the runnable range of priorities. Codec priority can therefore be raised in small steps (pcmbuf updated to enable). Simplify the kernel functions to ease implementation and use the same kernel.c for both sim and target (I'm tired of maintaining two ;_). 1) Not sure if a minor audio break at first buffering issue will exist on large-sector disks (the main mutex speed issue was genuinely resolved earlier). At this point it's best dealt with at the buffering level. It seems a larger filechunk could be used again. 2) Perhaps 64-bit sims will have some minor issues (finicky) but a backroll of the code of concern there is a 5-minute job. All kernel objects become incompatible so a full rebuild and update is needed.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16791 a1c6a512-1295-4272-9138-f99709370657
2008-03-25 02:34:12 +00:00
Jonathan Gordon
a67e5d89ef It makes more sense for the callback registrar to decide if its a "oneshot" then the callback caller.
(Doing it this way means playback could(/should?) registar a disk spinup callback at init which is called every spinup without needing to be reregistered)


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16685 a1c6a512-1295-4272-9138-f99709370657
2008-03-17 05:22:53 +00:00
Miika Pekkarinen
19c6e66c13 Implement the playback event handling as a system-wide multi-purpose event system. Unified mpeg.c and playback.c audio event handling. Converted ata_idle_notify to use the new event handling system also.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16682 a1c6a512-1295-4272-9138-f99709370657
2008-03-16 13:55:16 +00:00
Miika Pekkarinen
6ab1c90513 FS#8707 - Enable "Load to RAM" (HAS_TC_RAMCACHE) compilation without Directory Cache (HAS_DIRCACHE).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16594 a1c6a512-1295-4272-9138-f99709370657
2008-03-09 20:33:19 +00:00
Jens Arnold
8c6920e343 Revert accidental tree commit. Sorry for that.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16574 a1c6a512-1295-4272-9138-f99709370657
2008-03-08 23:50:55 +00:00
Jens Arnold
d1ed7c37b1 No need to have \n here. panicf() won't output it anyway.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16570 a1c6a512-1295-4272-9138-f99709370657
2008-03-08 23:34:43 +00:00
Miika Pekkarinen
d8204fa11e Simplified the playback engine more and removed unnecessary code.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16552 a1c6a512-1295-4272-9138-f99709370657
2008-03-08 08:05:29 +00:00
Miika Pekkarinen
2ccdc48ee9 Rewritten playback event handling. Should fix runtime statistics gathering.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16546 a1c6a512-1295-4272-9138-f99709370657
2008-03-07 22:56:51 +00:00
Nicolas Pennequin
0fd6a04eee Pragmatic fix for FS#8681 (logf breaks scrobbling). The correct fix is a better event mechanism but scrobbling is currently the only track_changed_event consumer so I'll wait til I have more time.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16520 a1c6a512-1295-4272-9138-f99709370657
2008-03-04 22:35:51 +00:00
Magnus Holmgren
c8d2a2458d Fix FS#8675: Last song in playlist ends prematurely.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16518 a1c6a512-1295-4272-9138-f99709370657
2008-03-04 18:56:37 +00:00
Steve Bavin
018de3591c Slightly simpler mechanism to avoid Q_AUDIO_FILL_BUFFER floods.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16497 a1c6a512-1295-4272-9138-f99709370657
2008-03-03 12:01:29 +00:00
Steve Bavin
bda6f573da Fix odd behaviour when rebuffering occurs during playback. This is hopefully the last nail in the coffins of FS#8455 and FS#8513, but I'll let some FLAC and Ogg users be the judge of that.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16459 a1c6a512-1295-4272-9138-f99709370657
2008-02-29 23:27:55 +00:00
Michael Sevakis
f38274f2f9 Use a safe way to get pcm buffer track change notifications to the audio thread.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16450 a1c6a512-1295-4272-9138-f99709370657
2008-02-28 22:37:46 +00:00
Magnus Holmgren
00b722ff22 Fix bookmark resume when a track is playing.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16445 a1c6a512-1295-4272-9138-f99709370657
2008-02-28 17:40:31 +00:00
Nicolas Pennequin
3987166a0a Fix auto dir change happening one track too early (another followup of r16425).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16430 a1c6a512-1295-4272-9138-f99709370657
2008-02-26 20:29:52 +00:00
Nicolas Pennequin
a36dbaa2c4 Fix not being able to skip to the last track in a playlist.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16426 a1c6a512-1295-4272-9138-f99709370657
2008-02-26 17:55:18 +00:00
Nicolas Pennequin
b834e25d71 Attempt to make manual track skips more responsive and more robust
* Immediately update the playlist index on manual track skip
* Try to minimise the number of calls to audio_fill_file_buffer

Hopefully fixes FS#8320.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16425 a1c6a512-1295-4272-9138-f99709370657
2008-02-26 17:15:35 +00:00
Nicolas Pennequin
f730133e04 Factor out duplicate code from audio_prev and audio_next
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16424 a1c6a512-1295-4272-9138-f99709370657
2008-02-26 17:15:33 +00:00
Nicolas Pennequin
ea9e02b442 Make audio_next_track use the wps_offset value.
This removes the delay between the current track title change and the next
track title change in the WPS on a track skip.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16423 a1c6a512-1295-4272-9138-f99709370657
2008-02-26 17:15:30 +00:00
Magnus Holmgren
68f9e6bfee When starting playback, prevent the codec from starting to decode too early, which would cause rebuffering (slowing things down) and incorrect playlist index. Hopefully fixes a bunch of playback-related bugs, such as FS#8520, FS#8525, FS#8555 and possibly FS#8511.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16392 a1c6a512-1295-4272-9138-f99709370657
2008-02-23 17:46:33 +00:00
Nicolas Pennequin
ca243ce494 Fix FS#5797 (Codec failure with directory skip when in file browser, with dircache enabled). Marking the tree context to be reloaded too early would cause the new playlist to contain files that don't exist (correct directory but wrong filenames), in turn causing the codec failures. The fix is to call reload_directory() after the playlist has been created.
I also added a sanity check to avoid loading an unknown codec, which was happening as a consequence of this issue.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16039 a1c6a512-1295-4272-9138-f99709370657
2008-01-09 20:37:36 +00:00
Nicolas Pennequin
659fe5a35b Fix FS#6215 (player crashes after trying to resume deleted music file). As mentioned in the lastest comment, the problem was in trying to resume at an offset larger than the size of the file following the one that was deleted. This revealed a crash in the buffering code, which gets a fix, but we also need to intervene earlier in the track loading so that the track that gets played will be from its start.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16028 a1c6a512-1295-4272-9138-f99709370657
2008-01-08 23:48:51 +00:00