aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/mp3_plugin.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Add RVA2 tag support to MPDPauli Virtanen2008-12-281-0/+94
| | | | | | | | | | This patch adds RVA2 (relative volume adjustment) tag support to mpd, as a fallback if no replaygain tags are found. The code is almost directly from madplay (GPL). RVA2 tags are generated for example by the "normalize" utility. Updated by: Avuton Olrich <avuton@gmail.com>
* mp3: "tag" argument is unused when libid3tag is disabledMax Kellermann2008-12-241-2/+2
| | | | Add G_GNUC_UNUSED attributes.
* mp3: declare variables as "enum mp3_action"Max Kellermann2008-12-081-2/+2
| | | | | Variables which hold one of the DECODE_* values should be declared as "enum mp3_action" instead of "int".
* mp3: use GLib loggingMax Kellermann2008-11-271-19/+18
| | | | Use GLib's g_warning(), ... instead of MPD's deprecated log.h.
* mp3: fix SEEK command check after mp3_synth_and_send()Max Kellermann2008-11-131-5/+3
| | | | | | mp3 seeking was broken, because the command==SEEK check was never reached. Swap the command check order (==SEEK before !=NONE) to fix that.
* mp3: support stream tagsMax Kellermann2008-11-111-1/+8
| | | | | | | Parse ID3 tags, even when they are in the middle of the stream. Very few streams provide embedded ID3 tags. Most of them send only Shoutcast "icy" tags, which limits the practical usefulness of this patch.
* mp3: eliminated duplicate command checkMax Kellermann2008-11-111-18/+20
| | | | | | | When a command is received, decode_next_frame_header() and decodeNextFrame() return DECODE_BREAK. This is already checked by both callers, which means that we can eliminate lots of decoder_get_command() checks.
* decoder: return void from decode() methodsMax Kellermann2008-11-111-6/+3
| | | | | | | | The stream_decode() and file_decode() methods returned a boolean, indicating whether they were able to decode the song. This is redundant, since we already know that: if decoder_initialized() has been called (and dc.state==DECODE), the plugin succeeded. Change both methods to return void.
* replay_gain: converted struct replay_gain_info elements to an arrayMax Kellermann2008-11-111-6/+6
| | | | | Having an array instead of individual variables allows the use of the replay_gain_mode enum as an array index.
* replay_gain: no CamelCaseMax Kellermann2008-11-111-22/+25
| | | | Renamed functions and variables.
* decoder: removed stream_typesMax Kellermann2008-11-041-1/+0
| | | | | Instead of checking the stream_types bit set, we can simply check whether the methods stream_decode() and file_decode() are implemented.
* decoder_api: automatically send stream tagMax Kellermann2008-11-031-41/+5
| | | | | | | | | | If an input stream provides tags (e.g. from an icecast server), send them in the decoder_data() and decoder_tag() methods. Removed the according code from the mp3 and oggvorbis plugins - decoders shouldn't have to care about stream tags. This patch also adds the missing decoder_tag() invocation to the mp3 plugin.
* decoder_api: pass "seekable" flag to decoder_initialized()Max Kellermann2008-11-021-2/+2
| | | | | | Don't pass the "seekable" flag with every decoder_data() invocation. Since that flag won't change within the file, it is enough to pass it to decoder_initialized() once per file.
* decoder: make the suffixes and mime_types arrays really constMax Kellermann2008-11-011-2/+2
| | | | | The strings were constant, but the pointers weren't. C syntax is somewhat tricky..
* decoder: make all decoder_plugin structs constMax Kellermann2008-11-011-1/+1
| | | | | All decoder_plugin structs are initialized at compile time, and must never change.
* decoder_api: pass constant path pointersMax Kellermann2008-10-311-2/+2
|
* decoder: use bool for return values and flagsMax Kellermann2008-10-301-14/+14
| | | | | Don't return 0/-1 on success/error, but true/false. Instead of int, use bool for storing flags.
* mp3: make mp3_read() return boolMax Kellermann2008-10-301-19/+7
| | | | | | | Its only caller in mp3_decode() just compared its value with DECODE_BREAK. Convert that to bool, and return false if the loop should be ended. Also eliminate some superfluous command checking code, which was already done in the preceding while loop.
* decoder: automatically flush the output buffer after decoder exitsMax Kellermann2008-10-291-2/+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().
* decoder_api: removed decoder_clear()Max Kellermann2008-10-291-5/+1
| | | | | Call ob_clear() in decoder_command_finished() instead of implementing that call in every decoder plugin.
* mp3: seek in backgroundMax Kellermann2008-10-291-5/+7
| | | | | | | | | | Remember the seek_where argument and call decoder_command_finished() immediately. This way, the player thread can continue working, and we can receive more commands. This also fixes several issues which resulted in broken frames, leading to erroneos "elapsed" values: frames weren't parsed properly, since the code was checking for command!=NONE.
* mp3: return from mp3_synth_and_send() on any commandMax Kellermann2008-10-291-2/+2
| | | | | Previously, the function would only return when a STOP was issued. It makes more sense to consider all possible commands.
* mp3: moved code to mp3_synth_and_send()Max Kellermann2008-10-291-60/+74
| | | | Break the large function mp3_read() into smaller pieces.
* mp3: moved code to mp3_send_pcm()Max Kellermann2008-10-291-29/+48
| | | | Break the large function mp3_read() into smaller pieces.
* mp3: moved code to mp3_update_timer_next_frame()Max Kellermann2008-10-291-16/+28
| | | | Break the large function mp3_read() into smaller pieces.
* mp3: moved code to mp3_this_frame_offset()Max Kellermann2008-10-291-10/+10
| | | | Break the large function mp3_read() into smaller pieces.
* mp3: moved code to mp3_time_to_frame()Max Kellermann2008-10-291-11/+21
| | | | Break the large function mp3_read() into smaller pieces.
* mp3: assert that the stream is seekableMax Kellermann2008-10-291-5/+5
| | | | | | dc_seek() won't send a SEEK command to the decoder thread unless the stream is seekable. No need to do another check; convert that to an assertion.
* mp3: moved code to mp3_filesize_to_song_length()Max Kellermann2008-10-281-23/+42
| | | | | The function mp3_decode_first_frame() is too large. Move some code to separate smaller functions.
* mp3: no "goto"Max Kellermann2008-10-281-19/+36
| | | | http://xkcd.com/292/
* mp3: use GLib allocation functionsMax Kellermann2008-10-281-11/+9
| | | | This removes the need for util.h.
* mp3: use boolMax Kellermann2008-10-281-50/+51
| | | | Use the C99 bool data type for boolean values.
* mp3: no CamelCaseMax Kellermann2008-10-281-255/+254
| | | | | Renamed all functions and variables. Also removed the mp3DecodeData typedef.
* mp3: remove obsolete commentsMax Kellermann2008-10-281-4/+0
|
* input_stream: convert offset and size to the off_t data typeMax Kellermann2008-10-281-1/+1
| | | | | | size_t and long aren't 64 bit safe (i.e. files larger than 2 GB on a 32 bit OS). Use off_t instead, which is a 64 bit integer if compiled with large file support.
* utils: use g_str_has_prefix() instead of prefixcmp()Max Kellermann2008-10-281-1/+2
| | | | Remove duplicated code from MPD.
* input_stream: use "bool" instead of "int"Max Kellermann2008-10-261-3/+2
| | | | | For boolean values and success flags, use bool instead of integer (1/0 for true/false, 0/-1 for success/failure).
* input_stream: no CamelCaseMax Kellermann2008-10-261-20/+20
| | | | Renamed all functions and variables.
* input_stream: removed the InputStream typedefMax Kellermann2008-10-261-7/+9
| | | | Everybody should use struct input_stream.
* renamed src/inputPlugins/ to src/decoder/Max Kellermann2008-10-261-0/+1086
These plugins are not input plugins, they are decoder plugins. No CamelCase in the directory name.