aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/aac_plugin.c (unfollow)
Commit message (Collapse)AuthorFilesLines
2008-10-30decoder: use bool for return values and flagsMax Kellermann1-19/+20
Don't return 0/-1 on success/error, but true/false. Instead of int, use bool for storing flags.
2008-10-29decoder: automatically flush the output buffer after decoder exitsMax Kellermann1-4/+0
A decoder_flush() invocation was missing in the FLAC plugin, resulting in casual assertion failures due to a wrong assumption about the last chunk's audio format. It's much easier to remove that decoder_flush() function and make the decoder thread call ob_flush().
2008-10-26input_stream: use "bool" instead of "int"Max Kellermann1-2/+2
For boolean values and success flags, use bool instead of integer (1/0 for true/false, 0/-1 for success/failure).
2008-10-26input_stream: no CamelCaseMax Kellermann1-5/+5
Renamed all functions and variables.
2008-10-26input_stream: removed the InputStream typedefMax Kellermann1-6/+7
Everybody should use struct input_stream.
2008-10-26renamed src/inputPlugins/ to src/decoder/Max Kellermann1-0/+0
These plugins are not input plugins, they are decoder plugins. No CamelCase in the directory name.
2008-10-17Makefile.am: don't compile disabled decoder pluginsMax Kellermann1-8/+0
Don't compile the sources of disabled decoder plugins at all, and don't attempt to register these.
2008-10-10audio_format: renamed sampleRate to sample_rateMax Kellermann1-23/+23
The last bit of CamelCase in audio_format.h. Additionally, rename a bunch of local variables.
2008-10-08don't include os_compat.hMax Kellermann1-0/+1
When there are standardized headers, use these instead of the bloated os_compat.h.
2008-09-29use C99 struct initializersMax Kellermann1-10/+7
The old struct initializers are error prone and don't allow moving elements around. Since we are going to overhaul some of the APIs soon, it's easier to have all implementations use C99 initializers.
2008-09-29Switch to C99 types (retaining compat with old compilers)Eric Wong1-2/+2
Seeing the "mpd_" prefix _everywhere_ is mind-numbing as the mind needs to retrain itself to skip over the first 4 tokens of a type to get to its meaning. So avoid having extra characters on my terminal to make it easier to follow code at 2:30 am in the morning. Please report any new issues you may come across on Free toolchains. I realize how difficult it can be to build/maintain cross-compiling toolchains and I have no intention of forcing people to upgrade their toolchains to build mpd. Tested with gcc 2.95.4 and and gcc 4.3.1 on x86-32.
2008-09-07audio_format: converted typedef AudioFormat to struct audio_formatMax Kellermann1-2/+2
Get rid of CamelCase, and don't use a typedef, so we can forward-declare it, and unclutter the include dependencies.
2008-08-29tag: renamed functions, no CamelCaseMax Kellermann1-2/+2
2008-08-29tag: renamed MpdTag and MpdTagItem to struct tag, struct mpd_tag_itemMax Kellermann1-2/+2
Getting rid of CamelCase; not having typedefs also allows us to forward-declare the structures.
2008-08-26added decoder_read()Max Kellermann1-5/+3
On our way to stabilize the decoder API, we will one day remove the input stream functions. The most basic function, read() will be provided by decoder_api.h with this patch. It already contains a loop (still with manual polling), error/eof handling and decoder command checks. This kind of code used to be duplicated in all decoder plugins.
2008-08-26added AacBuffer.decoderMax Kellermann1-4/+7
We need the decoder object at several places in the AAC plugin. Add it to mp3DecodeData, so we don't have to pass it around in every function.
2008-08-26aac: support decoding AAC streamsMax Kellermann1-2/+137
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.
2008-08-26aac: splitted aac_parse_header() from initAacBuffer()Max Kellermann1-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.
2008-08-26aac: check buffer lengthsMax Kellermann1-2/+3
The AAC plugin sometimes does not check the length of available data when checking for magic prefixes. Add length checks.
2008-08-26aac: use fillAacBuffer() instead of manual readingMax Kellermann1-16/+4
Eliminate some duplicated code by using fillAacBuffer().
2008-08-26find AAC framesMax Kellermann1-1/+35
Find AAC frames in the input and skip invalid data. This prepares AAC streaming.
2008-08-26aac: moved code to adts_check_frame()Max Kellermann1-11/+20
adts_check_frame() checks whether the buffer head is an AAC frame, and returns the frame length.
2008-08-26aac: moved code to aac_buffer_shift()Max Kellermann1-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.
2008-08-26aac: use inputStreamAtEOF()Max Kellermann1-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.
2008-08-26aac: don't depend on consumed data in fillAacBuffer()Max Kellermann1-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.
2008-08-26aac: simplified fillAacBuffer()Max Kellermann1-33/+25
Return instead of putting all the code into a if-closure. That saves one level of indentation.
2008-08-26aac: make adtsParse() voidMax Kellermann1-3/+1
adtsParse() always returns 1, and its caller does not use the return value.
2008-08-26aac: use size_tMax Kellermann1-6/+6
2008-08-26aac: removed unused initAacBuffer() parametersMax Kellermann1-9/+3
Since we eliminated the parameters retFileread and retTagsize in all callers, we can now safely remove it from the function prototype.
2008-08-26eliminate unused variables in the AAC decoderMax Kellermann1-10/+2
2008-08-26renamed InputPlugin to struct decoder_pluginMax Kellermann1-2/+2
"decoder plugin" is a better name than "input plugin", since the plugin does not actually do the input - InputStream does. Also don't use typedef, so we can forward-declare it if required.
2008-08-26use a local "initialized" flag instead of dc->stateMax Kellermann1-2/+4
Since we want to hide mpd internals from the decoder plugins, the plugins should not check dc->state whether they have already called decoder_initialized(). Use a local variable to track that.
2008-08-26added decoder_seek_where() and decoder_seek_error()Max Kellermann1-7/+5
Provide access to seeking for the decoder plugins; they have to know where to seek, and they need a way to tell us that seeking has failed.
2008-08-26added decoder_command_finished() to decoder_api.hMax Kellermann1-2/+2
Some decoder commands are implemented in the decoder plugins, thus they need to have an API call to signal that their current command has been finished. Let them use the new decoder_command_finished() instead of the internal dc_command_finished().
2008-08-26added decoder_get_command()Max Kellermann1-3/+3
Another big patch which hides internal mpd APIs from decoder plugins: decoder plugins regularly poll dc->command; expose it with a decoder_api.h function.
2008-08-26removed local variable "eof" because it is unusedMax Kellermann1-9/+4
"break" is so much easier than "eof=1; continue;", when "!eof" is the loop condition.
2008-08-26added parameter total_time to decoder_initialized()Max Kellermann1-3/+2
Similar to the previous patch: pass total_time instead of manipulating dc->totalTime directly.
2008-08-26added audio_format parameter to decoder_initialized()Max Kellermann1-6/+5
dc->audioFormat is set once by the decoder plugins before invoking decoder_initialized(); hide dc->audioFormat and let the decoder pass an AudioFormat pointer to decoder_initialized().
2008-08-26added decoder_clear() and decoder_flush()Max Kellermann1-1/+1
We are now beginning to remove direct structure accesses from the decoder plugins. decoder_clear() and decoder_flush() mask two very common buffer functions.
2008-08-26added decoder_data()Max Kellermann1-3/+3
Moved all of the player-waiting code to decoder_data(), to make OutputBuffer more generic.
2008-08-26added decoder_initialized()Max Kellermann1-3/+3
decoder_initialized() sets the state to DECODE_STATE_DECODE and wakes up the player thread. It is called by the decoder plugin after its internal initialization is finished. More arguments will be added later to prevent direct accesses to the DecoderControl struct.
2008-08-26added struct decoderMax Kellermann1-1/+1
The decoder struct should later be made opaque to the decoder plugin, because maintaining a stable struct ABI is quite difficult. The ABI should only consist of a small number of stable functions.
2008-08-26added dc_command_finished()Max Kellermann1-4/+2
dc_command_finished() is invoked by the decoder thread when it has finished a command (sent by the player thread). It resets dc.command and wakes up the player thread. This combination was used at a lot of places, and by introducing this function, the code will be more readable.
2008-08-26merged start, stop, seek into DecoderControl.commandMax Kellermann1-7/+7
Much of the existing code queries all three variables sequentially. Since only one of them can be set at a time, this can be optimized and unified by merging all of them into one enum variable. Later, the "command" checks can be expressed in a "switch" statement.
2008-08-26clean up CPP includesMax Kellermann1-4/+0
Include only headers which are really required. This speeds up compilation and helps detect cross-layer accesses.
2008-04-13Make the OutputBuffer API more consistentEric Wong1-3/+3
We had functions names varied between outputBufferFoo, fooOutputBuffer, and output_buffer_foo That was too confusing for my little brain to handle. And the global variable was somehow named 'cb' instead of the more obvious 'ob'... git-svn-id: https://svn.musicpd.org/mpd/trunk@7355 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-04-13Stop passing our single OutputBuffer object everywhereEric Wong1-4/+4
All of our main singleton data structures are implicitly shared, so there's no reason to keep passing them around and around in the stack and making our internal API harder to deal with. git-svn-id: https://svn.musicpd.org/mpd/trunk@7354 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-04-13Stop passing our single DecoderControl object everywhereEric Wong1-17/+17
This at least makes the argument list to a lot of our plugin functions shorter and removes a good amount of line nois^W^Wcode, hopefully making things easier to read and follow. git-svn-id: https://svn.musicpd.org/mpd/trunk@7353 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-04-12Fix a few more warnings from -WshadowEric Wong1-12/+11
git-svn-id: https://svn.musicpd.org/mpd/trunk@7300 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-04-12constant pointersMax Kellermann1-2/+2
There were some const pointers missing in the previous const-cleanup patch. git-svn-id: https://svn.musicpd.org/mpd/trunk@7290 09075e82-0dd4-0310-85a5-a0d7c8717e4f