aboutsummaryrefslogtreecommitdiffstats
path: root/src (follow)
Commit message (Collapse)AuthorAgeFilesLines
* mp3: unsigned integersMax Kellermann2008-08-301-11/+11
|
* mp3: moved code to dither_buffer()Max Kellermann2008-08-301-14/+30
| | | | | | | | Preparing for simplifying and thus speeding up the dithering code: moved dithering to a separate function which contains a trivial loop. With this patch, only one sample is dithered at a time, but the following patches will allow us to dither a whole block at a time, without complicated buffer length checks.
* mp3: don't check dropSamplesAtStart in the loopMax Kellermann2008-08-301-7/+14
| | | | | Performance improvement by moving stuff out of a loop: skip part of the first frame before entering the loop.
* assert song->url != NULLMax Kellermann2008-08-301-0/+3
|
* aac: support decoding AAC streamsMax Kellermann2008-08-301-2/+128
| | | | | | Copy some code from aac_decode() to aac_stream_decode() and apply necessary changes to allow streaming audio data. Both functions might be merged later.
* aac: splitted aac_parse_header() from initAacBuffer()Max Kellermann2008-08-301-11/+16
| | | | | | | initAacBuffer() should really only initialize the buffer; currently, it also reads data from the input stream and parses the header. All of the AAC buffer code should probably be moved to a separate library anyway.
* aac: check buffer lengthsMax Kellermann2008-08-301-2/+3
| | | | | The AAC plugin sometimes does not check the length of available data when checking for magic prefixes. Add length checks.
* aac: use fillAacBuffer() instead of manual readingMax Kellermann2008-08-301-16/+4
| | | | Eliminate some duplicated code by using fillAacBuffer().
* find AAC framesMax Kellermann2008-08-301-1/+35
| | | | | Find AAC frames in the input and skip invalid data. This prepares AAC streaming.
* aac: moved code to adts_check_frame()Max Kellermann2008-08-301-11/+20
| | | | | adts_check_frame() checks whether the buffer head is an AAC frame, and returns the frame length.
* aac: moved code to aac_buffer_shift()Max Kellermann2008-08-301-7/+14
| | | | | | Shifting from the buffer queue is a common operation, and should be provided as a separate function. Move code to aac_buffer_shift() and add a bunch of assertions.
* aac: use inputStreamAtEOF()Max Kellermann2008-08-301-5/+4
| | | | | | | | | When checking for EOF, we should not check whether the read request has been fully satisified. The InputStream API does not guarantee that readFromInputStream() always fills the whole buffer, if EOF is not reached. Since there is the function inputStreamAtEOF() dedicated for this purpose, we should use it for EOF checking after readFromInputStream()==0.
* aac: don't depend on consumed data in fillAacBuffer()Max Kellermann2008-08-301-6/+10
| | | | | | Fill the AacBuffer even when nothing has been consumed yet. The function should not check for consumed data, but for free space at the end of the buffer.
* aac: simplified fillAacBuffer()Max Kellermann2008-08-301-33/+25
| | | | | Return instead of putting all the code into a if-closure. That saves one level of indentation.
* aac: make adtsParse() voidMax Kellermann2008-08-301-3/+1
| | | | | adtsParse() always returns 1, and its caller does not use the return value.
* aac: use size_tMax Kellermann2008-08-301-6/+6
|
* aac: removed unused initAacBuffer() parametersMax Kellermann2008-08-301-9/+3
| | | | | Since we eliminated the parameters retFileread and retTagsize in all callers, we can now safely remove it from the function prototype.
* eliminate unused variables in the AAC decoderMax Kellermann2008-08-301-10/+2
|
* added inline function audio_format_time_to_size()Max Kellermann2008-08-302-1/+6
| | | | | Make the code more readable by hiding big formulas in an inline function with a nice name.
* converted MpdTagItem.type to an enumMax Kellermann2008-08-305-22/+28
| | | | | Don't use CPP macros when you can use C enum... this also allows better type checking.
* moved struct AudioFormat to audio_format.hMax Kellermann2008-08-3010-19/+45
| | | | | We want to expose the AudioFormat structure to plugins; remove some clutter by moving its declaration to a separate header file.
* audiofile: remove one indent level from audiofile pluginMax Kellermann2008-08-301-27/+24
| | | | | Anonymous code blocks just to declare variables look ugly. Move the variable declarations up and disband the code block.
* audiofile: use break instead of local variable "eof"Max Kellermann2008-08-301-3/+3
| | | | | | | Similar to previous patch: eliminate one variable by using "break". This also simplifies the code since we can remove one level of indent. [ew: rewritten to match current API]
* aac/mp4: removed local variable "eof" because it is unusedMax Kellermann2008-08-302-17/+10
| | | | | "break" is so much easier than "eof=1; continue;", when "!eof" is the loop condition.
* clean up CPP includesMax Kellermann2008-08-3017-63/+2
| | | | | | | Include only headers which are really required. This speeds up compilation and helps detect cross-layer accesses. [ew: minor fixups to not break on new core]
* enable -Wpointer-arith, -Wstrict-prototypesMax Kellermann2008-08-3019-116/+182
| | | | | | Also enable -Wunused-parameter - this forces us to add the gcc "unused" attribute to a lot of parameters (mostly library callback functions), but it's worth it during code refactorizations.
* fix warnings in the HTTP clientMax Kellermann2008-08-301-3/+4
| | | | | Fix a "unused argument" warning, and several warnings regarding void pointer calculation.
* ringbuf: create a new struct rbvec instead of reusing struct iovecEric Wong2008-08-306-44/+50
| | | | | | | Using struct iovec means having to cast iov_base everywhere we want to do pointer arithmetic. Instead, just use rbvec which can be safely casted to iovec whenever we use the readv/writev functions.
* fixed ringbuf.c warningsMax Kellermann2008-08-302-5/+5
| | | | | Fix a "signed/unsigned comparison warning", and several void pointer math warnings.
* metadata_pipe: free current_tag in metadata_pipe_clearEric Wong2008-08-271-0/+5
| | | | | This avoids writing the metadata of a static song into the URL of song; leading to confusing looking playlists.
* metadata_pipe: inline clear_pipe_unlocked() functionEric Wong2008-08-271-12/+9
| | | | | | I considered calling it from metadata_pipe_recv() in the past, but it's not necessary, so just inline it again to simplify things.
* playlist: fix deleting the last song in a playlistEric Wong2008-08-271-1/+2
| | | | | | | | | unK reported a bug in which explicitly calling "delete" on each song would cause mpd to lock up. This is actually triggered when the only song on the mpd playlist is deleted. Additionally, add an extra assertion to ensure we play a valid, non-NULL song in play_order_num().
* decode: clear dc.seek_where if we're not seekingEric Wong2008-08-271-2/+1
| | | | | | This way if we previously had a seek error, starting to play a new song will immediately update the status metadata.
* tagTracker: locks around {get,remove}TagItemStringEric Wong2008-08-271-2/+13
| | | | | | | | | Hopefully this fixes a segfault I experienced inside freeMpdTag earlier with the metadata_pipe. I could not reproduce the segfault again, however. Regardless, if multiple threads rely on this, we need to atomically increment/decrement these counters.
* metadata_pipe: remove highly unlikely memory leakEric Wong2008-08-271-0/+1
| | | | | | | When we send metadata, there's a remote chance that our pipe is full and our tag will be silently discarded. If that happens, the readers will never have a chance to free the tag, so ensure we free it before returning to the caller.
* Fix software mixerEric Wong2008-08-272-1/+2
| | | | I just forgot to reenable/reinitialize it after the core rewrite.
* Reimplement dynamic metadata handlingEric Wong2008-08-2612-35/+287
| | | | | | | | | | | | This has been tested for both playback of streams and outputting to streams, and seems to work fine with minimal locking. This reuses the sequence number infrastructure in OutputBuffer for synchronizing metadata payloads; so (IMNSHO) should be much more understandable than various flags being set here and there.. It could still use some cleanup and much testing, but synchronization issues should be minimal.
* playlist: fix "currentsong" after song deletionEric Wong2008-08-251-0/+2
| | | | | | | | | | When deleting previous songs, we forgot to update the playlist.queue value, causing syncPlaylistWithQueue to trigger a false sync and screw with the playlist.current pointer; causing the currentsong command to return an incorrect song. Thanks to unK to reporting this bug!
* playlist: fix "currentsong" after song movementEric Wong2008-08-251-1/+4
| | | | | | | | When moving songs around, we forgot to update the playlist.queue value, causing syncPlaylistWithQueue to trigger a false sync and screw with the playlist.current pointer; causing the currentsong command to return an incorrect song.
* xfade: gracefully fail on very short xfade timesEric Wong2008-08-231-1/+2
| | | | | | It's possible to calculate an impossibly small value that we don't have a chance to xfade. Don't die if we can't find the boundary to start crossfading on
* xfade: copy xfade_time locally to avoid race conditionsEric Wong2008-08-231-2/+5
| | | | | | | ob.xfade_time can be changed by the main process without locking, so copy the float value into a local variable and recheck the local variable for zero before continuing.
* outputBuffer: never calculate xfade time if xfade is offEric Wong2008-08-231-3/+5
| | | | | We don't assert on xfade_time > 0 inside any of the xfade calculations since we have no lock around xfade_time.
* don't crossfade different audio formatsEric Wong2008-08-231-2/+4
| | | | It sounds nasty and we didn't do it before the core-rewrite
* outputBuffer: close audio device on stopEric Wong2008-08-232-15/+9
|
* outputBuffer_audio: eliminate the hacky audio_opened variableEric Wong2008-08-231-10/+3
| | | | It's redundant, we already track that stuff elsewhere.
* playlist: queue songs after adding themEric Wong2008-08-231-0/+6
| | | | | | | This fixes the case where we wouldn't start playing a newly added song if we're near the end of the playlist and done decoding the last song (but still playing from the buffer).
* outputBuffer: fix buffer_before_play handlingEric Wong2008-08-233-38/+55
| | | | | | | | | | | | | | | | | | buffer_before_play is a prebuffer; always respecting it is almost as good as having no buffer at all. So we only respect it when we haven't played anything. Bugs that were a side effect of this also got fixed: The player would not stop when we got to the end of the last song on non-repeating playlists. The playlist would continuously show the song in the last few seconds of playback, and never move. Having crossfade enabled would also amplify the above effect. So, as a side effect, crossfade now correctly handles end-of-playlist conditions, as well. It will fade out to silence when we're at the end of a playlist.
* change queueNextSongInPlaylist assertion to checkEric Wong2008-08-231-1/+2
| | | | | | | There are still some places where we try to call this function without the playlist being stopped. It's really harmless, to call it and just break out immediately, so change the assertion.
* mp3_plugin: fix assertion during seekingEric Wong2008-08-201-3/+3
| | | | | | data->muteFrame won't necessarily get cleared when it enters that block of code, so we don't signal the action as complete until it is actually cleared.
* outputBuffer: drop buffered audio on new songsEric Wong2008-08-201-0/+1
| | | | Hopefully this fixes the skipping problem Qball reports