Commit Graph

1107 Commits

Author SHA1 Message Date
Max Kellermann
4c9782ee28 decoder/pcm: support reverse byte order 2011-10-10 10:13:43 +02:00
Max Kellermann
f3ea834322 decoder/{pcm,dsdiff}: add missing stdio.h include 2011-10-09 17:40:37 +02:00
Max Kellermann
b9e99575ce Merge commit 'release-0.16.5'
Conflicts:
	NEWS
	configure.ac
2011-10-09 16:32:36 +02:00
Max Kellermann
71536eb412 decoder/wavpack: don't call WavpackGetMode() twice
Use local variable "is_float".
2011-10-08 15:37:47 +02:00
Max Kellermann
894b9cfdb9 decoder/dsdiff: add option "lsbitfirst"
Defaults to "no", which fixes the noise problems.
2011-10-07 10:10:43 +02:00
Max Kellermann
7ecbb0454f decoder/dsdiff: add documentation 2011-10-07 06:38:23 +02:00
Max Kellermann
4e909f9411 decoder/dsdiff: new decoder plugin
Doesn't seem to work yet, getting just noise from a test file.
Seeking isn't implemented yet.
2011-10-04 21:41:03 +02:00
Max Kellermann
47774ce882 Merge branch 'v0.16.x' 2011-09-17 19:59:52 +02:00
Tim Harder
79435dbdec decoder/audiofile: include stdio header for SEEK_* defines
The stdio header is no longer pulled in by af_vfs.h in audiofile-0.3.0.
2011-09-17 07:33:42 +02:00
Max Kellermann
754f26a97c input_stream: non-blocking I/O
Add GMutex, GCond attributes which will be used by callers to
conditionally wait on the stream.

Remove the (now-useless) plugin method buffer(), wait on GCond
instead.  Lock the input_stream before each method call.  Do the same
with the playlist plugins.
2011-09-16 21:22:13 +02:00
Max Kellermann
f804a739b1 Merge branch 'v0.16.x'
Conflicts:
	NEWS
	configure.ac
2011-09-15 21:48:33 +02:00
Max Kellermann
2ed870c854 decoder/ffmpeg: flush the codec after seeking
Let the codec start with fresh buffers.  This should fix the remaining
seeking issues.
2011-09-15 21:41:25 +02:00
Max Kellermann
ce35ba9ac9 decoder/ffmpeg: explicitly specify the current stream for seeking
Use AVStream.time_base to convert the decoder_seek_where() value, and
pass the current stream number to av_seek_frame().
2011-09-15 21:35:29 +02:00
Max Kellermann
724a59aaf7 decoder/ffmpeg: don't require key frame for seeking
Use flag AV_TIME_BASE.
2011-09-15 21:32:29 +02:00
Max Kellermann
42d8c2981f decoder/ffmpeg: higher precision timestamps 2011-09-15 21:30:27 +02:00
Max Kellermann
9aa91e0f17 decoder/ffmpeg: move formula to time_from_ffmpeg() 2011-09-15 21:23:48 +02:00
Max Kellermann
5aabee8996 decoder/ffmpeg: add local variable "av_stream"
Code simplification.
2011-09-15 21:14:53 +02:00
Max Kellermann
3d3bca5338 decoder/oggflac: delete this obsolete plugin
libOggFLAC has been deprecated for 5 years now, and we havn't been
testing it for a long time.  Let's delete it.
2011-09-01 19:29:04 +02:00
Jonathan Neuschäfer
310895f060 rename 'Timer' to 'struct timer' 2011-08-27 11:30:34 +02:00
Max Kellermann
5ecb6fecc4 Merge branch 'v0.16.x' 2011-08-24 01:47:10 +02:00
Max Kellermann
d3b15f8fda decoder/mpcdec: fix gcc warning
Move the variable "vbr_update_acc" into the #ifdef block.
2011-08-23 17:58:56 +02:00
Max Kellermann
0ea4c970d7 Merge branch 'v0.16.x'
Conflicts:
	src/player_thread.c
	src/playlist_control.c
2011-07-20 21:46:05 +02:00
Max Kellermann
2e28ed8f81 wavpack: obey all decoder commands, stop at CUE track border
It used to ignore the decoder_data() return value.
2011-07-20 12:54:30 +02:00
Max Kellermann
4c4f8bf02a decoder/wavpack: use the correct integer types
libwavpack provides int32_t samples, and wants uin32_t for sample
counts.
2011-07-20 12:54:22 +02:00
Max Kellermann
e464be5f39 decoder/wavpack: simplify the WavpackUnpackSamples()==0 check
.. and remove one indent level.
2011-07-20 12:32:48 +02:00
Max Kellermann
eb2f413cf0 Merge branch 'v0.16.x'
Conflicts:
	NEWS
	configure.ac
2011-07-19 00:24:20 +02:00
Max Kellermann
736fd0e293 decoder/ffmpeg: use avformat_open_input() if available
av_open_input_stream() has been deprecated.
2011-07-18 23:31:47 +02:00
Max Kellermann
6592ca9f88 decoder: use AVDictionary instead of AVMetadata
AVMetadata has been deprecated.
2011-07-18 23:31:31 +02:00
Max Kellermann
6aa6a9c272 decoder/flac: validate the sample rate when scanning the tag
Don't calculate the song duration when the sample rate is 0 (division
by zero crash).
2011-07-03 14:57:56 +02:00
oblique
8d1c7ca206 ffmpeg: workaround for semantic API change in recent ffmpeg versions 2011-07-03 14:54:56 +02:00
Max Kellermann
e228caaca6 Merge branch 'v0.16.x'
Conflicts:
	src/decoder/ffmpeg_decoder_plugin.c
2011-06-03 16:58:09 +02:00
Max Kellermann
c6a72a14ac decoder/ffpmeg: don't use av_metadata_conv() in ffmpeg 0.7
It's a no-op and deprecated.
2011-05-09 21:24:18 +02:00
Max Kellermann
c74edd0e33 decoder/ffmpeg: use AVIOContext instead of ByteIOContext 2011-05-09 21:23:58 +02:00
Max Kellermann
246db3d565 decoder/ffmpeg: use avcodec_decode_audio3() if available
avcodec_decode_audio3() has been added in libavformat 52.25.0, and the
predecessor avcodec_decode_audio2() has been deprecated.
2011-05-09 09:24:17 +02:00
Max Kellermann
eaf414cbc8 decoder/ffmpeg: make variables more local 2011-05-09 09:24:15 +02:00
Anton Khirnov
327d41c00f decoder/ffmpeg: don't use deprecated CODEC_TYPE_AUDIO with new lavc
fixes build with lavc 53.
2011-05-09 08:00:45 +02:00
Max Kellermann
05d8ce3bcd decoder/ffmpeg: define fallback macro AV_VERSION_INT()
For ffmpeg < 0.5.  Copied from libavutil 0.5.
2011-05-09 08:00:45 +02:00
Max Kellermann
fe30db935b decoder/ffmpeg: use avcodec_decode_audio3() if available
avcodec_decode_audio3() has been added in libavformat 52.25.0, and the
predecessor avcodec_decode_audio2() has been deprecated.
2011-04-12 08:20:35 +02:00
Max Kellermann
6303d54cbb decoder/ffmpeg: make variables more local 2011-04-12 08:17:30 +02:00
Anton Khirnov
9d91aa23e6 decoder/ffmpeg: drop support for pre-0.5 ffmpeg
All modern distros ship 0.5, so there's no need to support old and buggy
ffmpeg versions.
2011-04-12 08:14:14 +02:00
Max Kellermann
c2ada39fd3 Merge branch 'v0.16.x'
Conflicts:
	NEWS
	configure.ac
2011-04-12 08:11:33 +02:00
Max Kellermann
f680b0a431 decoder/flac: fix enum mismatch in flac_tell_cb()
Fix clang warning.
2011-03-23 22:31:40 +01:00
Simon Kagstrom
640bac1aa4 decoder: PCM decoder: Inherit seekable from the input stream
E.g., spotify isn't seekable.
2011-03-23 22:13:11 +01:00
Simon Kagstrom
0b12fae84d decoder: PCM decoder: Break loop if EOF is encountered
Otherwise the song playing might go on forever.
2011-03-23 22:13:08 +01:00
Max Kellermann
0c9fc2f809 Merge commit 'release-0.16.2'
Conflicts:
	Makefile.am
	NEWS
	configure.ac
2011-03-19 09:58:07 +01:00
Thomas Jansen
948b8f35e6 general: whitespace cleanup
Remove trailing whitespace found by this command:
find -name '*.[ch]' | xargs grep "[[:space:]]$"
2011-02-09 22:42:31 +01:00
Tony Miller
8b2f4fc823 Set fadeout in gme_decoder_plugin. Due to the nature of the gme library,
this needs to be done for the end of songs to be detected.
2011-02-03 00:25:35 +01:00
Max Kellermann
c6cbcc2c25 copyright year 2011 2011-01-29 10:13:54 +01:00
Yuriy Kaminskiy
9ae3acf2e7 mpg123 decoder: implement seeking 2011-01-21 15:37:08 +01:00
Yuriy Kaminskiy
731ea9b489 mpg123 decoder: report bitrate 2011-01-21 15:37:08 +01:00
Max Kellermann
1a2ea4c06c Merge branch 'v0.16.x'
Conflicts:
	NEWS
	configure.ac
2011-01-07 23:52:23 +01:00
Max Kellermann
e3cba18532 decoder: new "pcm" decoder plugin
Just there to support the "cdio_paranoia" input plugin.
2010-12-22 09:48:48 +01:00
Alex Viskovatoff
41fdcf328c decoder/mad: work around build failure on Solaris
Rename the "version" struct, because it seems to be a reserved name on
Solaris:

 "src/decoder/mad_decoder_plugin.c", line 550: (enum) tag redeclared: version
 cc: acomp failed for src/decoder/mad_decoder_plugin.c
2010-12-21 07:57:07 +01:00
Max Kellermann
4478b3ef74 Merge release 0.15.14 from branch 'v0.15.x'
Conflicts:
	NEWS
	configure.ac
	src/decoder_control.c
	src/decoder_control.h
	src/input/rewind_input_plugin.c
	src/output_control.c
	src/output_thread.c
	src/player_thread.c
2010-11-07 15:30:18 +01:00
Max Kellermann
e8d8bd4c0d decoder/{mp4ff,ffmpeg}: add extension ".m4b" (audio book)
Same as ".m4a".
2010-11-05 02:01:35 +01:00
Max Kellermann
3f89f77429 decoder/ffmpeg: check AVCodecContext.sample_fmt value
.. instead of av_get_bits_per_sample_format().  The SampleFormat enum
value is authoritative.
2010-11-04 20:04:15 +01:00
Alder Hornbridge
fe1b626f76 decoder/sidplay: play mus, str, prg, x00 files 2010-10-27 21:18:43 +02:00
Alder Hornbridge
4e94516912 decoder/sidplay: play monaural SID tunes in mono 2010-10-27 21:16:24 +02:00
Tony Miller
dadb6747ad Container support for gme decoder. 2010-10-14 17:11:59 +02:00
Thomas Jansen
28bcb8bdf5 eliminate g_error() usage
Replaced all occurrences of g_error() with MPD_ERROR() located in a new header
file 'mpd_error.h'. This macro uses g_critical() to print the error message
and then exits gracefully in contrast to g_error() which would internally call
abort() to produce a core dump.

The macro name is distinctive and allows to find all places with dubious error
handling. The long-term goal is to get rid of MPD_ERROR() altogether. To
facilitate the eventual removal of this macro it was added in a new header
file rather than to an existing header file.

This fixes #2995 and #3007.
2010-09-25 15:00:43 +02:00
Max Kellermann
0955f33a86 decoder/mp4ff: support more variations of "album artist"
According to the mantis bug report 2847, there are several possible
variations of the "album artist" tag:

- "album artist"
- "album_artist"
- "albumartist"

This patch adds support for the latter two.
2010-09-23 21:19:41 +02:00
Max Kellermann
635cfbae13 decoder_control: use g_free() to manage mixramp allocations
Be consistent with the rest of MPD, and don't use the non-portable
header "malloc.h".
2010-09-23 08:49:21 +02:00
Rasi
31ab0b3df1 Added album tag support for libgme decoder 2010-07-23 23:13:03 +02:00
Max Kellermann
4364b30c42 decoder/mad: move RVA2 code to tag_rva2.c 2010-07-20 23:03:54 +02:00
Max Kellermann
c0da938d4f Merge release 0.15.12 from branch 'v0.15.x'
Conflicts:
	NEWS
	configure.ac
2010-07-20 23:03:06 +02:00
Max Kellermann
8b055c3127 tag_rva2: set "gain", not "peak"
RVA2 tags only store the "gain" value, there is no "peak" attribute.
2010-07-20 22:32:55 +02:00
Max Kellermann
172182b18f decoder/mad: parse_rva2() returns bool 2010-07-20 18:27:11 +02:00
Max Kellermann
898a13f196 decoder/wildmidi: support version 0.2.3
In libwildmidi 0.2.3, the function WildMidi_SampledSeek() was removed,
without changing the SO name.  This patch adds an autoconf check for
that function.  Fall back to WildMidi_FastSeek() if
WildMidi_SampledSeek() is not available anymore.
2010-07-20 18:23:56 +02:00
Max Kellermann
e2e8d0d2f3 decoder/ffmpeg: fix libavformat 0.6 by using av_open_input_stream()
libavformat 0.6 does not pass the original URI pointer to the "open"
method, which leads to a crash because MPD was using a dirty hack to
pass a pointer to that method.

This patch switches to av_open_input_stream() with a custom
ByteIOContext class, instead of doing the URI string hack with
av_open_input_file().

Loosely based on a patch from Jasper St. Pierre.
2010-07-19 23:03:06 +02:00
Max Kellermann
b2e3c0757b decoder/ffmpeg: manual format probing
Use the libavformat function av_probe_input_format() to probe the
AVInputFormat, instead of letting av_open_input_file() do it
implicitly.  We will switch to av_open_input_stream() very soon, which
does not have the probing code.

Loosely based on a patch from Jasper St. Pierre.
2010-07-19 22:59:59 +02:00
Anton Khirnov
0fc0196dba ffmpeg: read the audio stream metadata in addition to global
in some formats, e.g. vorbis, the metadata is stored per-stream.
2010-07-12 11:36:55 +02:00
Anton Khirnov
1492324c76 ffmpeg: factor tag_type <-> ffmpeg tag name maps into a table. 2010-07-12 11:36:55 +02:00
Max Kellermann
49bc317fb8 decoder/ffmpeg: fix libavformat 0.6 by using av_open_input_stream()
libavformat 0.6 does not pass the original URI pointer to the "open"
method, which leads to a crash because MPD was using a dirty hack to
pass a pointer to that method.

This patch switches to av_open_input_stream() with a custom
ByteIOContext class, instead of doing the URI string hack with
av_open_input_file().

Loosely based on a patch from Jasper St. Pierre.
2010-06-30 23:41:32 +02:00
Max Kellermann
375a09d6f6 decoder/ffmpeg: manual format probing
Use the libavformat function av_probe_input_format() to probe the
AVInputFormat, instead of letting av_open_input_file() do it
implicitly.  We will switch to av_open_input_stream() very soon, which
does not have the probing code.

Loosely based on a patch from Jasper St. Pierre.
2010-06-30 23:40:31 +02:00
Max Kellermann
0265c34bed decoder/ffmpeg: free URI, fix memory leak
Free the string allocated by decoder_get_uri().
2010-06-30 23:40:04 +02:00
Max Kellermann
a1882f48be decoder/vorbis: handle uri==NULL
This fixes a theoretical crash, which has never occurred in practice.
2010-06-30 23:38:49 +02:00
Anton Khirnov
c3569814bd ffmpeg: read more metadata. 2010-06-30 23:18:45 +02:00
Max Kellermann
814daac5ba decoder/ffmpeg: free AVFormatContext on error
Fix a memory leak in some code paths.
2010-06-30 23:14:43 +02:00
Max Kellermann
ec89ce5a8a decoder/mp4ff: support tag "album artist"
We already supported "albumartist", but it seems some folks also use
"album artist" (with a space).
2010-06-30 21:55:03 +02:00
Max Kellermann
77e6810c14 decoder/mikmod: fix memory leak
The return value of Player_LoadTitle() is allocated with malloc(), and
must be freed by the caller.
2010-06-30 19:37:36 +00:00
Max Kellermann
5ebe33653c decoder/mp4ff: remove duplicate entries in the tag name table
Reuse the function tag_name_parse_i().
2010-06-30 21:36:15 +02:00
Max Kellermann
8e3eace289 decoder/mp4ff: moved code to mp4ff_tag_name_parse() 2010-06-30 21:36:00 +02:00
Max Kellermann
4d6d372a5b decoder/vorbis: use single global ov_callbacks constant
Initialize the ov_callbacks struct at compile time.
2010-06-30 19:24:41 +00:00
Max Kellermann
0aeec90590 decoder/mp4ff: support tags "albumartist", "band"
I'm not sure if mapping "band" to TAG_PERFORMER is correct, but it
might be better than nothing.
2010-06-30 21:22:13 +02:00
Max Kellermann
cfcd84655c decoder/mp4ff: use tag_table.h to parse tag names
Convert if/else/else/... to a loop.
2010-06-30 21:19:30 +02:00
Max Kellermann
9eb292c1e5 decoder/mp4ff: support tag "album artist"
We already supported "albumartist", but it seems some folks also use
"album artist" (with a space).
2010-06-25 22:54:18 +02:00
Romain Bignon
b571ba27a4 fix crash when decoder is NULL 2010-05-31 22:11:59 +02:00
Max Kellermann
de8f2739c2 decoder/mikmod: fix memory leak
The return value of Player_LoadTitle() is allocated with malloc(), and
must be freed by the caller.
2010-05-31 10:24:08 +02:00
Max Kellermann
2c1c588868 decoder/mikmod: duplicate the path only once 2010-05-31 10:22:08 +02:00
Max Kellermann
e271f69a34 decoder/mikdmod: moved local variable declarations in tag_dup() 2010-05-31 10:16:09 +02:00
Max Kellermann
39105f2119 decoder/wildmidi: moved local variable declarations in tag_dup() 2010-05-31 10:14:48 +02:00
Max Kellermann
4e080a9b06 decoder/gme: replace macro GME_BUF_SIZE
Added macros with better names: GME_BUFFER_FRAMES, GME_BUFFER_SAMPLES
(the former only used to calculate the latter).
2010-05-31 10:03:43 +02:00
Max Kellermann
d55740808d decoder/gme: added constants for sample rate and channels
Move into enums.
2010-05-31 10:02:43 +02:00
Max Kellermann
6566038df9 decoder/gme: pass the whole buffer to decoder_data()
Pass sizeof(buf) to decoder_data(), not the number of samples (which
is half the size).  At the same time, pass GME_BUF_SIZE to gme_play()
- libgme really wants to get the number of samples, not the number of
stereo frames.  Previously, this plugin had been using only the first
half of the buffer.
2010-05-31 09:57:15 +02:00
Max Kellermann
f0faf00320 decoder/gme: allocate tag later, fixes memory leak
Allocate the "tag" object after the file has been opened successfully.
2010-05-31 09:43:25 +02:00
Max Kellermann
51c7577c8f decoder/mp4ff: rename and move local variable
Allocate the "tag" object after the file has been checked.  That
removes one tag_free() call in an error handler.
2010-05-31 09:35:49 +02:00
Max Kellermann
be308c6657 decoder/mp4ff: merge code into mp4ff_input_stream_open() 2010-05-31 09:29:45 +02:00
Max Kellermann
1729a0b437 decoder/mp4ff: move mp4ff_callback_t into mp4ff_input_stream
Allocate only one item on the stack.
2010-05-31 09:23:27 +02:00
Max Kellermann
1b2fc2ae19 decoder/mp4ff: rename mp4_context to mp4ff_input_stream 2010-05-31 09:22:42 +02:00
Max Kellermann
58a75f0b78 decoder/mp4ff: remove duplicate entries in the tag name table
Reuse the function tag_name_parse_i().
2010-05-31 08:48:41 +02:00
Max Kellermann
daf6e2b5da decoder/mp4ff: moved code to mp4ff_tag_name_parse() 2010-05-31 08:47:59 +02:00
Max Kellermann
ca08c4dbf4 decoder/vorbis: rename local variable "ret" 2010-05-31 00:06:37 +02:00
Max Kellermann
8af52fa205 decoder/vorbis: implement method stream_tag()
This allows tags in archive files.
2010-05-31 00:02:57 +02:00
Max Kellermann
3b0bf856c4 decoder/vorbis: move code to vorbis_open_stream() 2010-05-31 00:00:04 +02:00
Max Kellermann
28f5803d34 decoder/vorbis: use single global ov_callbacks constant
Initialize the ov_callbacks struct at compile time.
2010-05-30 23:59:36 +02:00
Max Kellermann
0b72299857 decoder/vorbis: rename struct vorbis_decoder_data to vorbis_is 2010-05-30 23:57:58 +02:00
Max Kellermann
017d61a1aa decoder/mp4ff: support tags "albumartist", "band"
I'm not sure if mapping "band" to TAG_PERFORMER is correct, but it
might be better than nothing.
2010-05-30 22:55:02 +02:00
Max Kellermann
4028d03a6e decoder/mp4ff: use tag_table.h to parse tag names
Convert if/else/else/... to a loop.
2010-05-30 22:52:45 +02:00
Max Kellermann
44b771aca1 decoder/mp4ff: rename plugin "mp4" to "mp4ff"
The underlying library is named "libmp4ff".  To reduce confusion,
rename the plugin to a more specific name.
2010-05-30 22:52:44 +02:00
Max Kellermann
9dda53e1d2 Merge release 0.15.10 from branch 'v0.15.x'
Conflicts:
	NEWS
	configure.ac
	src/input/mms_input_plugin.c
2010-05-30 18:26:33 +02:00
Max Kellermann
442d2e74e3 decoder/mad: fix buffer variable name on !HAVE_ID3TAG 2010-05-30 17:27:03 +02:00
Max Kellermann
fa2ff849c5 input/ffmpeg: new input plugin using libavformat's "avio" library 2010-05-18 21:20:31 +02:00
Tim Phipps
0ac5b6e613 mixramp: Adjust MixRamp threshold to account for ReplayGain. 2010-05-08 00:19:44 -07:00
Max Kellermann
cf3ada3d04 Merge branch 'master' of git://github.com/mcfiredrill/mpd 2010-04-20 21:16:39 +02:00
Max Kellermann
a1a03deed2 decoder/mad: properly calculate ID3 size without libid3tag
Without libid3tag, we were trying to skip the ID3 frame (since
0.15.2).  Its length however was not calculated at all, we were just
dropping everything from the current input buffer.  This lead to the
first few seconds of the file being skipped.  This patch attempts to
calculate the ID3v2 frame size with the formula from:

 http://www.id3.org/id3v2.4.0-structure 3.1 and 6.2
2010-04-13 08:51:29 +02:00
Charles Kerr
6a95898038 decoder/ffmpeg: fix crash on startup in mpd_ffmpeg_log_callback()
What's happening is the `ptr' argument to that function is NULL for me
every time. `ptr' is unconditionally dereferenced to generate a log
message, and this is where mpd crashes.

Attached is a simple patch that tests for NULL and omits the log. With
this patch the crash disappeared and mpd went back to working well.
2010-04-11 19:18:30 +02:00
Tony Miller
9d55b16998 Decoder for game music emulation library.
Supports a number of videogame music formats, more info here:
http://www.fly.net/~ant/libs/audio.html

I wrote this plugin for the latest svn, get it here:
http://code.google.com/p/game-music-emu/source/checkout
2010-04-10 01:05:16 -07:00
Max Kellermann
8446b70ddc decoder/ffmpeg: print item name in log callback 2010-03-28 19:48:57 +02:00
Max Kellermann
e9beea072d Merge release 0.15.9 from branch 'v0.15.x'
Conflicts:
	NEWS
	configure.ac
	src/cue/cue_tag.c
	src/decoder/mpcdec_decoder_plugin.c
	src/player_thread.c
2010-03-28 19:31:47 +02:00
Tim Phipps
e7a515c8b1 Add support for MixRamp tags
Adds mixrampdb and mixrampdelay commands.  Reads MIXRAP_START and
MIXRAMP_END tags from FLAC files and overlaps instead of crossfading.
2010-03-21 18:21:47 +01:00
Aleksei Kaveshnikov
73ba4ea3da decoder/mpcdec: fix replay gain formula with v8
"When playing musepack files with mpd v0.15.8, rg seems to have no effect.

Using sample file below, mpd says 'computing ReplayGain album scale with gain 122.879997, peak 0.549150'.

One thing though, if I build mpd against old libmpcdec-1.2.6, rg works
as expected: 'computing ReplayGain album scale with gain 16.820000,
peak 0.099765'"
2010-03-19 10:26:08 +01:00
Piotr Gozdur
96033e4b4e decoder/mpcdec: fix negative shift on fixed-point samples
"There is a bug in fixed-point musepack (musepack_src_r435) playback.
In floating-point audio is OK but in fixed audio is distorted.  I have
made a patch for this"
2010-03-17 17:54:21 +01:00
Max Kellermann
5842015b90 decoder/ffmpeg: fix indentation 2010-03-07 19:20:34 +01:00
Max Kellermann
ae56901863 decoder/ffmpeg: implement the libavutil log callback
Pass everything to the GLib logging library.  No direct stderr access.
2010-02-27 19:32:59 +01:00
Max Kellermann
4e364854ab decoder/ffmpeg: don't close the AVFormatContext after open failure
The pointer is invalid if av_open_input_file() fails.
2010-02-27 19:25:56 +01:00
Max Kellermann
35c5a371ea decoder/mad: fix crash when seeking at end of song
Removed the decoder_command_finished() call at the end of
mp3_decode().  This is invalid, because decoder_command_finished() has
already been called in mp3_read().
2010-02-27 18:35:31 +01:00
Max Kellermann
5e0117b444 replay_gain_info: allocate the struct statically
Don't allocate each replay_gain_info object on the heap.  Those
objects who held a pointer now store a full replay_gain_info object.
This reduces the number of allocations and heap fragmentation.
2010-02-17 07:22:44 +01:00
Anton Khirnov
766b9fd453 ffmpeg: read more metadata. 2010-02-02 17:55:58 +01:00
Tim Phipps
891dab7b91 decoder/flac: fix replay gain (short-circuiting "or") 2010-01-28 20:54:04 +01:00
Max Kellermann
acb0ff1ea8 decoder/wavpack: fixed WVC URI
Pass the current URI to wavpack_open_wvc().
2010-01-20 12:08:44 +01:00
Max Kellermann
2acad9fe1e decoder/ffmpeg: call decoder_timestamp() once per packet 2010-01-18 13:11:04 +01:00
Max Kellermann
8914ebc964 decoder/ffmpeg: merged ffmpeg_helper() into ffmpeg_decode() 2010-01-18 11:06:09 +01:00
Max Kellermann
5477c31160 decoder/ffmpeg: optimized the stream_tag() method
Don't use the function ffmpeg_helper(), don't initialize the codec.
2010-01-18 11:06:04 +01:00
Max Kellermann
acd3f8cd91 decoder/ffmpeg: free AVFormatContext on error
Fix a memory leak in some code paths.
2010-01-18 11:05:15 +01:00
Max Kellermann
ca1fc13116 decoder_api: removed function decoder_get_uri()
Use input_stream.uri.
2010-01-18 10:21:57 +01:00
Max Kellermann
a0a26d3341 Merge release 0.15.8 from branch 'v0.15.x
Conflicts:
	Makefile.am
	NEWS
	configure.ac
	src/decoder/ffmpeg_decoder_plugin.c
	src/decoder_thread.c
2010-01-18 07:52:58 +01:00
Max Kellermann
2579a2f924 decoder/ffmpeg: added more MIME types
Taken from the ffmpeg sources.
2010-01-17 16:00:14 +01:00
Max Kellermann
1b441837f1 decoder/ffmpeg: append file name suffix to virtual stream URL
To allow libavformat to detect the format of the input file, append
the suffix of the input file to the URL of the virtual stream.  This
specifically enables the "shorten" codec, which is supported by
libavformat/raw.c, detected only by the suffix.
2010-01-17 02:36:07 +01:00
Max Kellermann
1abfcc56af audio_format: support packed 24 bit samples 2010-01-16 23:44:54 +01:00
Max Kellermann
a942384fbf decoder/flac: support streams without STREAMINFO block 2010-01-06 10:17:16 +01:00
Max Kellermann
de0cdee4aa decoder/flac: pass bits_per_sample to flac_sample_format()
Easier to reuse the function.
2010-01-06 09:55:20 +01:00
Max Kellermann
550c9319e9 decoder/flac: moved decoder initialization to _flac_common.c
Invoke decoder_initialized() in the libFLAC metadata callback.  This
merges code from the FLAC and the OggFLAC decoder plugin into the
common library.
2010-01-06 09:50:34 +01:00
Max Kellermann
ae9c02b3a8 decoder/flac: remember audio_format, not stream_info 2010-01-06 09:00:32 +01:00
Max Kellermann
6f6d47dd20 decoder/flac: removed CUE sheet support
This feature has been moved to the "flac" playlist plugin.
2010-01-06 08:52:35 +01:00
Max Kellermann
d6d5caae23 decoder/flac: moved flac_tag_load() to flac_metadata.c
Make this code is reusable.
2010-01-06 08:50:35 +01:00
Max Kellermann
9b9abff972 renamed decoder plugin sources
Make it X_decoder_plugin.c.
2010-01-04 21:45:32 +01:00
Max Kellermann
c69cc31de0 decoder/mad: fix build error without libid3tag 2010-01-04 21:45:32 +01:00
Max Kellermann
1330274ffc replay_gain: moved code to replay_gain_info.c 2010-01-04 21:02:36 +01:00
Max Kellermann
cd8f92c928 decoder_api: added function decoder_replay_gain()
This function replaces the replay_gain_info parameter for
decoder_data().  This allows the decoder to announce replay gain
changes, instead of having to pass the same object over and over.
2010-01-04 20:42:49 +01:00
Max Kellermann
d3b763a48c input_stream: return allocated input_stream objects
Major API redesign: don't let the caller allocate the input_stream
object.  Let each input plugin allocate its own (derived/extended)
input_stream pointer.  The "data" attribute can now be removed, and
all input plugins simply cast the input_stream pointer to their own
structure (with an "struct input_stream base" as the first attribute).
2010-01-01 17:25:07 +01:00
Avuton Olrich
9d3865cb95 Update copyright notices. 2009-12-31 20:58:43 -08:00
Max Kellermann
05cde5810a decoder: switch a bunch of plugins to stream_tag()
This patch changes the following decoder plugins to implement
stream_tag() instead of tag_dup():

 faad, ffmpeg, mad, modplug, mp4ff, mpcdec, oggflac

This simplifies their code, because they do not need to take care of
opening/closing the stream.
2009-12-31 18:32:09 +01:00
Max Kellermann
6b96f5d566 decoder_plugin: added method stream_tag()
This is like tag_dup(), but works with an input_stream object instead
of a file path.
2009-12-31 18:27:48 +01:00
Max Kellermann
efc885a9dc Merge vorbis+icy fixes from branch 'v0.15.x'
Conflicts:
	Makefile.am
	NEWS
	configure.ac
	src/input/curl_input_plugin.c
	src/input_stream.c
2009-12-30 23:24:11 +01:00
Max Kellermann
c7d099c757 decoder/{ffmpeg,flac,vorbis}: added more flac/vorbis MIME types
Support deprecated MIME types such as "audio/x-ogg".  Support new
types such as "audio/flac".
2009-12-29 22:33:46 +01:00
Max Kellermann
333e11d0eb Merged release 0.15.7 from branch 'v0.15.x'
Conflicts:
	NEWS
	configure.ac
	src/decoder_api.c
2009-12-27 20:10:45 +01:00
Max Kellermann
bad350bc18 decoder_api: added function decoder_timestamp()
Remove the data_time parameter from decoder_data().  This patch
eliminates the timestamp counting in most decoder plugins, because the
MPD core will do it automatically by default.
2009-12-26 03:01:43 +01:00
Max Kellermann
8a6d448aaf decoder/wavpack: allow fine-grained seeking
First multiply the floating point return value of
decoder_seek_where(), then cast to integer.
2009-12-26 02:58:30 +01:00
Alam Arias
b05ba0286e updated mp4ff decoder about input_stream_seek 2009-12-16 06:47:15 +01:00
Max Kellermann
228b03edf8 input_stream: return errors with GError 2009-12-15 23:12:11 +01:00
Max Kellermann
849d7895dc decoder/mikmod: fixed gcc uninitialized warning
Removed local variable "sample_rate".
2009-12-14 23:20:14 +01:00
Max Kellermann
c3085d7b61 Merge branch 'v0.15.x'
Conflicts:
	src/decoder/ffmpeg_plugin.c
2009-12-14 17:40:50 +01:00
Max Kellermann
8f7bc70bf5 decoder/wavpack: don't use the nonstandard "uchar" type
Use the signed C99 type int8_t instead.
2009-12-11 12:45:57 +01:00
Max Kellermann
c412d6251e audio_format: changed "bits" to "enum sample_format"
This patch prepares support for floating point samples (and probably
other formats).  It changes the meaning of the "bits" attribute from a
bit count to a symbolic value.
2009-12-02 22:29:50 +01:00
Max Kellermann
16123f1b8e ffmpeg: don't try to force stereo
The plugin code tried to force libavcodec to supply stereo samples.
That however has never actually worked.  By removing this code, we are
able to play surround files for the first time.
2009-11-30 09:59:05 +01:00
Max Kellermann
3857bb9990 decoder/mpcdec: set 24 bit sample format
This fixes a regression due to a typo caused by "decoder: use
audio_format_init_checked()".
2009-11-25 08:59:13 +01:00
Max Kellermann
c33bbd947b Merged release 0.15.6 from branch 'v0.15.x'
Conflicts:

	NEWS
	configure.ac
2009-11-19 19:59:34 +01:00
Max Kellermann
21fdf47b56 decoder/flac: fixed compiler warning
Removed the "vtrack" local variable (which triggered a gcc warning
because it was after the newly introduced NULL check), and run
strtol() on the original parameter.
2009-11-19 19:49:44 +01:00
Max Kellermann
97f8e017c4 decoder/flac: fixed NULL pointer dereference in CUE code
The function flac_vtrack_tnum() was missing a strrchr()==NULL check.
2009-11-18 19:55:38 +01:00
Max Kellermann
77b95d08a5 decoder/ffmpeg: align the output buffer
On some platforms, libavcodec wants the output buffer aligned to 16
bytes (because it uses SSE/Altivec internally).  It will segfault when
you don't obey this rule.
2009-11-15 17:39:09 +01:00
Max Kellermann
141cbc60b9 decoder/audio: eliminate the "bits" variable
Pass the audiofile_setup_sample_format() result to
audio_format_init_checked().
2009-11-14 23:35:37 +01:00
Max Kellermann
2c1fb48318 decoder/audiofile: moved code to audiofile_setup_sample_format() 2009-11-14 23:22:14 +01:00
Max Kellermann
1dfadf4815 decoder/modplug: count frame position
Don't maintain the current time stamp in a floating point variable,
because this is subject to rounding errors.
2009-11-14 22:30:57 +01:00
Max Kellermann
f5b9e3c064 decoder/modplug: floating point division for song duration
More exact total time.
2009-11-14 22:27:27 +01:00
Max Kellermann
ff70dbd316 decoder/modplug: check ModPlug_Read() < 0
Negative return values are not documented here, but since the function
prototype is signed, let's be sure.
2009-11-14 22:27:04 +01:00
Max Kellermann
dd4625ce13 decoder/mikmod: count frame position
Don't maintain the current time stamp in a floating point variable,
because this is subject to rounding errors.
2009-11-14 02:24:42 +01:00
Max Kellermann
1648c7aa5b decoder/mikmod: sample rate is configurable
The new option "sample_rate" sets the sample rate for libmikmod.
2009-11-14 02:24:42 +01:00
Max Kellermann
edaf017908 decoder/mikmod: set drv_name and drv_version from PACKAGE/VERSION 2009-11-14 02:24:42 +01:00
Max Kellermann
2c7bf61e68 decoder/mikmod: no CamelCase 2009-11-14 02:07:41 +01:00
Max Kellermann
7efb548921 decoder/mikmod: removed the struct mod_Data 2009-11-14 02:07:41 +01:00
Max Kellermann
0c5329aedc decoder/mikmod: merged open()/close() into decode()
These functions are trivial, we don't need them separate.
2009-11-14 02:07:41 +01:00
Max Kellermann
2d236e281f decoder/mikmod: static mod_Data object
Don't allocate this object, put it on the stack.
2009-11-14 02:07:41 +01:00
Max Kellermann
719990b1c5 decoder: use audio_format_init_checked()
Let the audio_check library verify the audio format in all (relevant,
i.e. non-hardcoded) plugins.
2009-11-14 00:47:22 +01:00
Max Kellermann
873025a495 decoder/sidplay: correctly calculate floating point time
Internally, use only the integer time.  When needed, convert it to a
floating point seconds value.
2009-11-14 00:46:30 +01:00
Max Kellermann
9947b82cad added .#* to .gitignore
Temporary editor files.
2009-11-12 18:39:40 +01:00
Max Kellermann
5b82ffc291 include config.h in all sources
After we've been hit by Large File Support problems several times in
the past week (which only occur on 32 bit platforms, which I don't
have), this is yet another attempt to fix the issue.
2009-11-12 09:17:03 +01:00
Max Kellermann
8068fd5228 decoder/vorbis: fixed gcc "signed" warning 2009-11-12 09:16:34 +01:00
Max Kellermann
59189160e3 decoder/wavpack: allow more than 2 channels
Remove the OPEN_2CH_MAX option.  MPD's support for surround sound is
still clunky, but we're working on it.
2009-11-11 23:03:20 +01:00
Max Kellermann
ee5d3337a7 decoder/wavpack: activate 32 bit support
MPD has been supporting 32 bit samples since version 0.15.  This patch
changes one check, and removes the 32->24 conversion code.

Note that WavPack floating point samples have 32 bits, and MPD doesn't
have a special check for floating point - therefore, this WavPack
plugin still returns 24 bit integer samples as before (until we have
float support in the MPD core).
2009-11-11 21:49:00 +01:00
Max Kellermann
4c6a8e3ca5 decoder/vorbis: initialize before entering the loop
Call decoder_initialize() before entering the loop.  We don't need to
call ov_read() before ov_info().  When the stream number changes,
check if the audio format is still the same.
2009-11-11 21:34:55 +01:00
Max Kellermann
4f38cc9cae decoder/vorbis: moved error strings to vorbis_strerror() 2009-11-11 21:12:10 +01:00
Max Kellermann
dfc09a37c9 decoder/vorbis: removed the OggCallbackData typedef
Use the struct name instead.
2009-11-11 21:09:08 +01:00
Max Kellermann
8588c21689 decoder/vorbis: fix typo in comment 2009-11-11 21:09:08 +01:00
Max Kellermann
2decc65b45 decoder/vorbis: removed redundant "bits" initialization
This is done by audio_format_init().
2009-11-11 21:03:04 +01:00
Max Kellermann
0fb877740b decoder/flac: check "seekable" in libFLAC callbacks
Return FLAC__STREAM_DECODER_SEEK_STATUS_UNSUPPORTED if this input
stream does not support seeking.
2009-11-11 21:02:52 +01:00
Max Kellermann
37181c9181 decoder/flac: moved code to flac_data_get_audio_format()
Remove the audio_format attribute, add "frame_size" instead.  The
audio_format initialization and check is moved both to
flac_data_get_audio_format().
2009-11-11 20:44:21 +01:00
Max Kellermann
08b139f37c decoder/flac: use stream_info instead of audio_format
Use the sample rate stored in the stream_info struct instead of the
audio_format struct.
2009-11-11 20:36:53 +01:00
Max Kellermann
3973aeecd2 decoder/flac: use frame header instead of audio_format
When calculating the properties of the frame, use sample_rate and
other information from the frame header instead of the stored
audio_format object.
2009-11-11 20:36:46 +01:00
Max Kellermann
5b2d32b499 decoder/oggflac: moved stream_info check to oggflac_decode() 2009-11-11 20:36:21 +01:00
Max Kellermann
e0d5ee0045 decoder/flac: calculate time stamp from current frame
Don't update a float timestamp, this will make imprecisions add up
after a while.  We already have the number of the current frame, let's
just calculate the float timestamp from that for every decoder_data()
command.  For this, we need to add the attribute "first_frame", for
CUE sheet songs.
2009-11-11 20:18:39 +01:00
Max Kellermann
d35efddd65 decoder/flac: calculate bit rate in flac_common_write()
Removed the "bit_rate" attribute from the flac_data struct.  Pass the
number of bytes since the last call to flac_common_write(), and let
it calculate the bit rate.
2009-11-11 19:52:14 +01:00
Max Kellermann
7b13776f2d decoder/flac: store the whole stream info object, not duration
We don't want to work with floating point values if possible.  Get the
integer number of frames from the FLAC__StreamMetadata_StreamInfo
object, and convert it into a float duration on demand.  This patch
adds a check if the STREAMINFO packet has been received yet.
2009-11-11 19:25:15 +01:00
Max Kellermann
f937ec9a7c decoder/flac: merge code into flac_decoder_initialize()
Wrapper for FLAC__stream_decoder_process_until_end_of_metadata(),
decoder_initialized().
2009-11-11 19:08:10 +01:00
Max Kellermann
a3f5284dc6 decoder/flac: merged code into flac_decoder_new()
Convenience wrapper for FLAC__stream_decoder_new() and
FLAC__stream_decoder_set_metadata_respond().
2009-11-11 19:07:30 +01:00
Max Kellermann
4a8cc87b4d decoder/flac: free the "pathname" variable earlier
Free the pointer right after its last use, i.e. after the
FLAC__stream_decoder_init_file() call.
2009-11-11 19:05:24 +01:00
Max Kellermann
183725733a decoder/flac: emulate FLAC__stream_decoder_init_stream()
Remove the wrapper flac_init().
2009-11-11 18:08:22 +01:00
Max Kellermann
3c1bacbdbc decoder/flac: use the new API functions
Use the type and function names of the libFLAC 1.1.3 API.  Map the new
API to the old one with macros.
2009-11-11 17:59:46 +01:00
Max Kellermann
d5ed23438a decoder/flac: removed the fake flac_ogg_init() fallback
Don't even try to call it with an old libFLAC API.
2009-11-11 17:01:14 +01:00
Max Kellermann
5bbaf0c9f1 decoder/flac: moved code to flac_compat.h 2009-11-11 16:43:34 +01:00
Max Kellermann
f2f8290242 decoder/{flac,vorbis}: include config.h for LFS
Allow those plugins to open large files on 32 bit platforms.
2009-11-11 16:37:42 +01:00
Max Kellermann
c1186693b5 decoder/flac: merged code into flac_decoder_loop()
The decoder loop of flac_decode_internal(), flac_container_decode()
and flac_filedecode_internal() is merged into this one function.  This
unifies the code, and uses the frame number to identify the end of a
CUE sub song.
2009-11-11 16:28:44 +01:00
Max Kellermann
80b220a3a6 decoder/flac: keep track of current frame number
We need this for more exact end-of-subsong detection for CUE files.
2009-11-11 15:31:17 +01:00
Max Kellermann
5cc3c4f503 Merge remote branch 'origin/v0.15.x' 2009-11-11 15:14:20 +01:00
Max Kellermann
dca4d9cf83 decoder/flac: fixed CUE seeking range check
If flac_container_decode() gets a seek destination which is out of
range, it ignores the SEEK command (never finishes it).  This leads to
MPD lockup, because the player thread waits for completion.
2009-11-11 08:55:55 +01:00
Max Kellermann
707b9fea17 decoder/flac: removed redundant NULL checks
After the decoder loop, "flac_dec" is always set.
2009-11-11 08:37:21 +01:00
Max Kellermann
68f77e4163 oggflac: rewind stream after FLAC detection
The oggflac plugin has been completely broken for quite a while and
nobody has noticed - maybe we should remove it?
2009-11-11 08:14:37 +01:00
Max Kellermann
d605329f83 decoder/flac: moved code to flac_pcm.c 2009-11-11 07:59:22 +01:00
Max Kellermann
f6e7dffada decoder/flac: moved code to flac_metadata.c 2009-11-11 07:50:40 +01:00
Max Kellermann
43549db718 decoder/flac: return replay_gain_info object from helper function
Make the function more generic by not passing "struct flac_data" to
it.
2009-11-11 07:35:16 +01:00
Max Kellermann
884be8e2b3 decoder/flac: merged some code into flac_tag_apply_metadata() 2009-11-11 00:05:14 +01:00
Max Kellermann
305de100a7 decoder/oggflac: initialize the "tag" variable 2009-11-10 23:56:59 +01:00
Max Kellermann
c1a999c492 decoder/flac: don't use float to calculate song duration
Simple (up-rounding) integer division is good enough.  We're casting
the result back to an integer anyway.
2009-11-10 22:03:58 +01:00
Max Kellermann
e51d9fc6a9 decoder/flac: pass VorbisComment to comments_to_tag() 2009-11-10 21:58:19 +01:00
Max Kellermann
2f69831fb8 decoder/flac: use pcm_buffer instead of fixed buffer
This is a great simplification for flac_common_write(), because we can
convert and submit all of the buffer in one turn.  No more partial
buffers with complicated formulas.
2009-11-10 21:46:10 +01:00
Max Kellermann
b6a2ffd3d7 decoder/flac: added function flac_data_deinit()
Clean up tag and replay_gain_info there.
2009-11-10 21:42:15 +01:00
Max Kellermann
118495d372 decoder/flac: pass void pointer to flac_convert()
That function diverts into various bit formats; it doesn't need a
typed pointer.
2009-11-10 19:57:58 +01:00
Max Kellermann
a6bee71f1a decoder/flac: pass audio_format.bits to flac_convert()
Don't use audio_format_sample_size() for identifying the sample
format.
2009-11-10 19:57:28 +01:00
Max Kellermann
9fed97b1f1 decoder/ffmpeg: removed the "author" vs "artist" workaround
libavformat gives us the song artist in the "author" field.  Since we
use av_metadata_conv(), we don't need to check for "artist".
2009-10-28 22:17:10 +01:00
Max Kellermann
04816a6369 decoder/ffmpeg: convert metadata
Convert the metadata with the libavformat function av_metadata_conv().
This ensures that canonical tag names are provided by libavformat, and
we can remove the "artist" vs "author" workaround.
2009-10-28 22:12:22 +01:00
Max Kellermann
447e4d3583 Merged release 0.15.5 from branch 'v0.15.x'
Conflicts:
	NEWS
	configure.ac
	src/decoder/flac_plugin.c
	src/update.c
2009-10-18 19:02:43 +02:00
Serge Ziryukin
33bf6c0978 decoder/vorbis: avoid unused symbol warnings from vorbisfile.h
svn r13289 of libvorbis introduced static callbacks (like OV_CALLBACKS_DEFAULT)
defined in "vorbisfile.h" header. First released version with this change is libvorbis-1.2.2.
In libversion-1.2.3 OV_EXCLUDE_STATIC_CALLBACKS define was added to avoid
warnings about unused static callbacks. Information on the OV_EXCLUDE_STATIC_CALLBACKS
can be found in http://svn.xiph.org/trunk/vorbis/CHANGES.
2009-10-18 18:35:02 +02:00
Max Kellermann
d09e19c3dc decoder/flac: fixed two memory leaks in the CUE tag loader
Don't initialize "vc" and "cs" with FLAC__metadata_object_new(); that
value is overwritten by FLAC__metadata_get_tags() and
FLAC__metadata_get_cuesheet().
2009-10-16 17:39:17 +02:00
Max Kellermann
ea616b3ed4 tag: removed the "_ITEM_" suffix from the enum names 2009-10-13 16:12:45 +02:00
Max Kellermann
727c301fbc input_stream: use "goffset" instead of "off_t"
The "off_t" type may change when you enable or disable large file
support on 32 bit platforms.  This caused severe ABI problems within
MPD when we enabled LFS for the first time: two sources included
config.h and sys/types.h in different order, and had different off_t
sizes - leading to memory corruption because of ABI incompatibility.
This patch attempts to get rid of all public "off_t" uses: it removes
"off_t" from the input_stream ABI/API, and switches to GLib's 64 bit
"goffset" type.  This may hurt 32 bit embedded platforms a tiny bit,
but that's not even measurable.
2009-10-11 23:32:22 +02:00
Max Kellermann
7013f9fc31 Merged release 0.15.4 from branch 'v0.15.x'
Conflicts:
	NEWS
	configure.ac
2009-10-03 16:17:02 +02:00
Max Kellermann
65693d057b decoder/ffmpeg: use the "artist" tag if "author" is not present
Usually, we read our "artist" tag from ffmpeg's "author" tag.  In some
cases however (e.g. APE), this tag is named "artist".  This patch
implements a fallback: if no "author" is found, MPD tries to use
"artist".
2009-09-30 15:41:43 +02:00
Max Kellermann
b0f9a1454a decoder/faad: skip assertion failure on large ID3 tags
When the ID3 tag in an AAC file is larger than the current buffer, the
function decoder_buffer_consume() aborts.  By using the new function
decoder_buffer_skip() instead, we can safely skip the ID3 tag.
2009-09-30 15:22:47 +02:00
Tony
934a38f976 Make the sidplay decoder filter configurable. 2009-09-28 11:59:55 +02:00
Max Kellermann
aec18c74ec decoder/sidplay: free songlength data blob in error handler
When parsing the songlength database fails, the code forgot to free
the memory allocated by the raw file data.
2009-09-24 10:17:58 +02:00
Max Kellermann
4729d10bb2 decoder/sidplay: moved code to sidplay_load_songlength_db() 2009-09-24 10:14:05 +02:00
Max Kellermann
a8af3ce0dd decoder/sidplay: free GError objects
The caller is responsible fro freeing GError objects.  That
g_error_free() call was missing in two places.
2009-09-24 10:05:21 +02:00
Max Kellermann
d657be33ba decoder/sidplay: pass GError** to g_file_get_contents()
The error handler dereferences GError*, but did not retrieve that
object from g_file_get_contents().
2009-09-24 10:04:24 +02:00
Max Kellermann
fdc479676f Merge branch 'v0.15.x'
Conflicts:
	NEWS
	configure.ac
	doc/mpdconf.example
2009-09-10 23:18:43 +02:00
Max Kellermann
a99202a8a4 decoder/vorbis: revert "faster tag scanning with ov_test_callback()"
This patch made ov_time_total() unusable, and MPD did not know the
duration of songs.
2009-09-10 23:04:01 +02:00
Mike Dawson
430b5b0490 decoder/sidplay: support seeking 2009-08-30 19:49:16 +02:00
Mike Dawson
cde9408bd8 decoder/sidplay: implemented songlength database
[mk: added autoconf test; fixed songlen_data_size type]
2009-08-30 19:49:04 +02:00
Mike Dawson
85ce9aa7de decoder/sidplay: subtunes 2009-08-30 19:48:56 +02:00
Max Kellermann
f2ff2409ad Merged release 0.15.3 from branch 'v0.15.x'
Conflicts:

	NEWS
	configure.ac
2009-08-30 09:42:12 +02:00
Max Kellermann
bff4c54ece decoder/mpg123: new decoder plugin based on libmpg123
Still missing:
- seeking
- tags
- streaming
- encodings other than MPG123_ENC_SIGNED_16
2009-08-26 20:08:13 +02:00
Gunnar Roth
1e56c7b862 decoder/vorbis: open file in "binary" mode
fopen change for win32 in tag dup of vorbis
win32 adaption for head changes
2009-08-25 00:49:48 +02:00
Rasmus Steinke
408f723701 decoder/vorbis: faster tag scanning with ov_test_callback()
using ov_test_callback with function CALLBACKS_STREAMONLY will cause
scanning to stop after the comment field.  ov_open (and ov_test)
default to CALLBACKS_DEFAULT which scans the file structure causing a
huge slowdown.  The speed improvement is huge: It scanned my files
around 10x faster This procedure has been recommended by monthy (main
vorbis developer) and was said to be safe for scanning files.
2009-08-24 22:14:22 +02:00
Max Kellermann
f401c1059c Merged release 0.15.2 from branch 'v0.15.x'
Conflicts:

	NEWS
	configure.ac
2009-08-15 21:18:38 +02:00
Max Kellermann
1c4f407a6d decoder/flac: don't allocate cuesheet twice (memleak)
The function flac_cue_track() first calls FLAC__metadata_object_new(),
then overwrites this pointer with FLAC__metadata_get_cuesheet().  This
allocate two FLAC__StreamMetadata objects, but the first pointer is
lost, and never freed.
2009-08-14 11:51:42 +02:00
Anton Khirnov
bff72634ca ffmpeg_plugin: convert metadata to generic format 2009-08-03 17:40:22 +02:00
Max Kellermann
f4b39bc263 decoder/flac: fixed indentation of flac_comment_value() 2009-07-22 13:34:33 +02:00
Max Kellermann
47ed89bd4c decoder/flac: parse all replaygain tags
The FLAC replaygain parser used the "||" operator.  This made the code
stop after the first value which was found.
2009-07-22 13:31:48 +02:00
Max Kellermann
cf1fd2b0da decoder/flac: return early from flac_find_float_comment()
When one metadata check fails, return quickly.  This removes 2 levels
of indent.
2009-07-22 13:31:46 +02:00
Max Kellermann
8e2d987996 decoder/flac: removed misplaced authorship comment
This belongs into "git annotate" or AUTHORS.
2009-07-22 13:31:43 +02:00
Max Kellermann
322ef3cb80 mad: skip ID3 frames when libid3tag is disabled
When libid3tag is disabled, the libmad decoder plugin is unable to
identify ID3 frames.  If the file starts with an (unidentified) ID3
frame, it assumes that the file is not a valid MP3 song.  This patch
solves this by adding minimal stubs for the ID3 functions.
2009-07-22 12:57:03 +02:00
David Woodhouse
37754559b8 Add audio_format_init() function
It makes no difference right now, but we're about to add an endianness
flag and will want to make sure it's correctly initialised every time.
2009-07-19 16:54:11 +01:00
Max Kellermann
4100035b19 Merged release 0.15.1 from branch 'v0.15.x' 2009-07-16 07:37:13 +02:00
Serge Ziryukin
297d749fc8 modplug: get track length 2009-07-15 11:22:45 +02:00
Serge Ziryukin
75c0a33ec5 flac: load external cue sheet when no internal one
External cue sheet file for "file.flac" should be named as "file.flac.cue".
2009-07-09 19:01:24 +02:00
Max Kellermann
1eebbc746f decoder/sndfile: new decoder plugin based on libsndfile 2009-07-07 08:58:51 +02:00
Max Kellermann
c0c5119788 decoder/flac: fix assertion failure in tag_free() call
Initialize flac_data.tag right after flac_data_init().  This way, the
"goto fail" won't jump to the point where tag_free(NULL) can be
called.
2009-07-06 22:09:30 +02:00
Max Kellermann
eacd604518 ffmpeg: support multiple tags
Call av_metadata_get() in a loop.
2009-06-25 08:43:59 +02:00
Max Kellermann
74334a516c ffmpeg: moved code to ffmpeg_copy_metadata() 2009-06-08 08:45:54 +02:00
Max Kellermann
f5d4079d11 ffmpeg: removed "new metadata api" warning
This warning is useless.  I assume the author added it for debugging
purposes.
2009-06-08 08:41:07 +02:00
Max Kellermann
c434379d79 mad_decoder: use g_ascii_strcasecmp() instead of strcasecmp()
strcasecmp() is locale dependent, making it a bad choice for internal
string comparisons.
2009-04-28 09:29:39 +02:00
Max Kellermann
d5b3dd36fd mp4ff_decoder: use g_ascii_strcasecmp() instead of strcasecmp()
strcasecmp() is locale dependent, making it a bad choice for internal
string comparisons.
2009-04-28 09:29:11 +02:00
Max Kellermann
80de8fb93b fluidsynth: added "experimental" comments in the source file 2009-04-25 12:32:22 +02:00
Avuton Olrich
d38f72b902 vorbis: move #define out of function to top of sources 2009-04-02 16:07:52 -07:00
Avuton Olrich
fd90db35b7 decoder: Rename all main decoder plugins functions to *decoder_plugin. 2009-04-02 15:55:10 -07:00
Max Kellermann
6419cc54ac flac: fixed "unused variable" warning without libcue
Move the declaration of "i" into the "for" loop.
2009-04-01 16:44:27 +02:00
Jochen Keil
4bfbdfe5c5 Tag subtracks according to "cuesheet" vorbis comment value
Cuesheets are often saved as vorbis comment
flac files (CUESHEET=.. case doesn't matter).
We can parse this now and use the information to
tag the subtracks (from the embedded cuesheets).
2009-03-31 22:17:56 +02:00
Jochen Keil
d7b0c768b0 track length is computed correctly now 2009-03-31 22:17:56 +02:00
Jochen Keil
6720a0a940 free previously allocated flac metadata object 2009-03-31 22:17:56 +02:00
Jochen Keil
a1bde6b99d remove old commented code 2009-03-31 22:17:56 +02:00
Jochen Keil
80e2aaf379 Bugfix for time/offset in flac plugin
Previous cast to float didn't have any effect because one value is uint
and the other is a floating type but the number itself is even..
This caused some tracks to end before they were really at an end.
2009-03-28 10:13:44 +01:00
Max Kellermann
49e548e773 mpcdec: changed plugin name to "mpcdec"
The "mpcdec" plugin is based on the libmpcdec library.
2009-03-27 19:58:50 +01:00
Max Kellermann
f5548a8654 mpcdec: support the new libmpcdec SV8 API 2009-03-27 19:51:59 +01:00
Max Kellermann
0e18fab655 mpcdec: no CamelCase
Renamed variables and functions.
2009-03-27 19:37:08 +01:00
Mario Lenz
7ba7e67323 flac/cue: added support for TITLE[n] comments
On 2009/03/17 Max Kellermann<max@duempel.org> wrote:

> There doesn't seem to be an "official" standard.  I'd say: search for
> TITLE[1] first (the most explicit form), then TITLE1, and finally fall
> back to TITLE.  This makes sure MPD supports every possible standard,
> without breaking.

I've also added some additional checks to make sure entry is long
enough.
2009-03-17 12:41:46 +01:00
Mario Lenz
36dab871f1 flac: get CUE track titles from additional FLAC comments
The cue sheet embedded in a flac file doen't contain any information
about track titles and similar.  There are three possibilities: Use an
external cue sheet that includes these information, use a tag CUESHEET
with a cue sheet including these information or use tags.  I think the
latter is the best option and is already used by other projects.
2009-03-16 19:38:34 +01:00
Max Kellermann
0007d84d95 faad: faad_decoder_decode() returns NULL, not false
On failure, the function should return NULL, not a boolean.
2009-03-14 14:31:38 +01:00
Avuton Olrich
0aee49bdf8 all: Update copyright header.
This updates the copyright header to all be the same, which is
pretty much an update of where to mail request for a copy of the GPL
and the years of the MPD project. This also puts all committers under
'The Music Player Project' umbrella. These entries should go
individually in the AUTHORS file, for consistancy.
2009-03-13 11:51:55 -07:00
Jochen Keil
706112bb88 Initial support for embedded cue sheets found in flac files
So far only seekpoints are supported, so no proper tagging yet
except for track number and track length.
Tagging should be done by parsing the cue sheet which
is often embedded as vorbis comment in flac files.
Furthermore the pathname should be configurable like "%A - %t - %T",
where %A means Artist, %t track number and %T Title or so.
2009-03-09 07:58:44 +01:00
Jochen Keil
ab3d89f484 decoder_plugin: added method container_scan()
[mk: fixed whitespace errors; use delete_song() instead of
songvec_delete()]
2009-03-09 07:58:26 +01:00
Max Kellermann
b0fcce65d8 flac: explicitly check for STOP command
After the decoder command was obtained, don't wait until libflac
detects EOF (as a side effect), quit the decoder immediately.  This
check was missing completely.
2009-03-05 18:20:43 +01:00
Max Kellermann
efd606337e flac: check command after flac_process_single() failure
When the MPD core sends the decoder a command while
flac_process_single() is executed, this function fails.  Abort the
decoder only if not seeking.  This fixes a seeking bug.
2009-03-05 18:20:41 +01:00
Viliam Mateicka
3b76ca7186 ffmpeg: fix version comparision for av_get_bits_per_sample_format() implemetation
function was implemented in the version we are comparing to so there must be higher or equal
2009-03-03 21:30:55 +01:00
Viliam Mateicka
c89482de65 ffmpeg: support for new metadata api 2009-03-03 21:30:46 +01:00
Viliam Mateicka
8694574f63 ffmpeg: use ffmpeg's sampleformat for output format 2009-03-02 20:12:36 +01:00
Max Kellermann
ba3a8474b6 flac: parse stream tags
Parse the vorbis comments in libflac's metadata_callback and pass them
as tag struct to the decoder API.
2009-03-01 14:07:23 +01:00
Max Kellermann
af66f666c6 audiofile: added 24 bit support
Don't hard code the "bits" parameter to 16.  Try to use the input's
sample format, if possible.
2009-03-01 10:53:46 +01:00
Max Kellermann
d29db0111c audiofile: removed duplicate decoder_get_command() calls
decoder_data() returns a decoder_command, no need to call
decoder_get_command() twice after decoder_command().
2009-02-28 19:28:38 +01:00
Max Kellermann
0813092c63 audiofile: refuse to play non-seekable files
If an input_stream is not seekable, libaudiofile fails to play at all:

 Audio File Library: unrecognized audio file format [error 0]

Since we know in advance whether the input_stream is seekable, just
refuse to play on a non-seekable stream.
2009-02-28 19:24:40 +01:00
Max Kellermann
44b55bff89 audiofile: no CamelCase
Renamed several variables and a function.
2009-02-28 19:09:54 +01:00
Max Kellermann
75c2029b1c tag: no CamelCase
Renamed numOfItems to num_items.
2009-02-27 09:01:55 +01:00
Max Kellermann
6823217697 ls: moved generic URI utilities to uri.c
"ls" is a bad name for a library which parses URIs.  We'll move the
rest of the "ls" library later.
2009-02-25 16:44:06 +01:00
Avuton Olrich
39a33344f2 ffmpeg: add all known ffmpeg extensions and mime-types.
After much research[1][2][3] this should be the majority of currently
supported file extensions and mime-types for the currently supported
ffmpeg formats. This list maybe incomplete, but it's more complete
than anything else out there that I've been able to find. This list
needs to be updated every now and again as the ffmpeg sources support
more formats.

 1. Sources
 2. wiki.multimedia.cx
 3. filext.com
2009-02-23 10:48:43 -08:00
Max Kellermann
c228635489 faad: use faacDecFrameInfo instead of NeAACDecFrameInfo
Don't use libfaad's internal type names.
2009-02-19 13:29:15 +01:00
Max Kellermann
fcf65de46b mp4ff: always free the mp4ff_read_sample() buffer
When mp4ff_read_sample() returns a value bigger than zero, it
guarantees that the buffer is set.  Remove the check.
2009-02-18 19:08:52 +01:00
Max Kellermann
5900ea5299 mp4ff: don't allocate seek_table when input is not seekable
Don't waste any precious memory when the seek_table cannot be used.
2009-02-18 18:40:40 +01:00
Max Kellermann
8aa3edb6af mp4ff: include cleanup
Don't include limits.h, use GLib constants instead.
2009-02-18 18:40:33 +01:00
Max Kellermann
51c59f6228 mp4ff: use faacDecInit2() to find the AAC track
Use faacDecInit2() instead of AudioSpecificConfig() to detect the AAC
track in the MP4 file.  This has a great advantage: it initializes the
libfaad decoder, which the caller would normally do anyway - but now
we can go without the AudioSpecificConfig() call.  When decoder==NULL
(called from mp4_tag_dup()), fall back to a mp4ff_get_track_type()==1
check, like other audio players do.
2009-02-18 18:39:12 +01:00
Max Kellermann
111c73e701 mp4ff: moved code to mp4_faad_new()
Moved the libfaad decoder initialization to mp4_faad_new(), and also
fill the audio_format struct there.  This eliminates a little bit of
complexity in mp4_decode().
2009-02-18 18:38:09 +01:00
Max Kellermann
2bc0fabe73 mp4ff: call decoder_initialized() after libfaad initialization
Don't wait for the first frame to be decoded.  We already have the
sample rate and the channel count from faacDecInit2().
2009-02-18 18:18:29 +01:00
Max Kellermann
47e3eab872 mp4ff: merged mp4_load_tag() into mp4_tag_dup()
The function mp4_load_tag() is used only once, and mp4_tag_dup() is a
one-liner.  Merge them.
2009-02-18 18:18:25 +01:00
Max Kellermann
4aca1fa493 faad: variable cleanup
Make some variables more local, and eliminate superfluous ones.
2009-02-17 23:44:29 +01:00
Max Kellermann
122e0f3338 faad: added source code comments 2009-02-17 23:42:06 +01:00
Max Kellermann
76b0601f6b faad: faad_decoder_init() returns an audio_format
Instead of returning the sample rate and channel count as separate
values, fill an audio_format struct.
2009-02-17 23:35:49 +01:00
Max Kellermann
161bfc4bc0 faad: call decoder_initialized() after libfaad initialization
Don't wait for the first frame to be decoded.  We already have the
sample rate and the channel count from faacDecInit().
2009-02-17 23:26:51 +01:00
Max Kellermann
a72c7a7b18 faad: removed DECODE_COMMAND_SEEK check
The MPD core will never send a SEEK command to a decoder which has
declared to be not seekable.
2009-02-17 23:20:16 +01:00
Max Kellermann
7b84f1e6b3 faad: use the decoder_buffer library
Replace this plugin's own buffer library with the new decoder_buffer
library.
2009-02-17 22:56:42 +01:00
Max Kellermann
7cea5357e3 faad: check the result of adts_find_frame()
Instead of checking if the buffer is empty after adts_find_frame(),
check adts_find_frame()'s return value.  This is more robust.
2009-02-17 22:56:07 +01:00
Max Kellermann
77db32f8fb faad: added libfaad wrappers
Moved libfaad API quirks to the wrapper functions faad_decoder_init()
and faad_decoder_decode().
2009-02-17 22:54:26 +01:00
Max Kellermann
6a72db22d7 faad: functions return duration, no float pointer
Instead of writing the song duration into a float pointer, return it
from the function.
2009-02-17 22:54:01 +01:00
Max Kellermann
e30ba2e4cf faad: removed length==NULL check in faad_song_duration()
There are no callers which pass NULL here.
2009-02-17 22:53:28 +01:00
Max Kellermann
867ae1cf6f faad: fill buffer in adts_find_frame()
All callers of adts_find_frame() use faad_buffer_fill() before that.
Move that faad_buffer_fill() call into adts_find_frame() instead.
adts_find_frame() will get its own logic for on-demand filling.
2009-02-17 22:53:25 +01:00
Max Kellermann
66b4a3ab2e faad: converted length check to assertion in adts_check_frame()
adts_check_frame() must not be called with a buffer length smaller
than 8.  We can eliminate that duplicate check, and convert it into an
assertion.
2009-02-17 19:28:11 +01:00
Max Kellermann
8edd407918 faad: added length check before comparing "ADIF"
It's not valid to use the buffer's data without ensuring that the
buffer contains enough data.
2009-02-17 19:27:36 +01:00
Max Kellermann
d75ce5c4a0 faad: renamed internal functions
"aac" -> "faad"
2009-02-17 19:27:01 +01:00
Max Kellermann
943b17c99a wavpack: added GLib log domain 2009-02-17 19:26:36 +01:00
Max Kellermann
d8db46edfa decoders: added and fixed GLib log domains
Fixed the log domains of the renamed decoders.  Added G_LOG_DOMAIN
macros in decoders which don't have one already.
2009-02-17 08:51:34 +01:00
Max Kellermann
c4d69f0ae1 renamed decoder plugin "mpc" to "mpcdec"
This plugin is based on "libmpcdec".
2009-02-17 08:48:20 +01:00
Max Kellermann
70523657bf renamed decoder plugin "mp4" to "mp4ff"
This plugin is based on "libmp4ff".
2009-02-17 08:45:26 +01:00
Max Kellermann
68314c33e9 faad: no CamelCase
Renamed functions and variables.
2009-02-16 19:31:11 +01:00
Max Kellermann
8d2e6bf54c faad: removed AacBuffer.fileOffset
The element fileOffset is only written, but never read.  It can be
removed safely.
2009-02-16 19:31:08 +01:00
Max Kellermann
c6205bd461 renamed decoder plugin "oggvorbis" to "vorbis"
This plugin uses libvorbis.
2009-02-16 19:31:06 +01:00
Max Kellermann
cafaf33aa8 renamed decoder plugin "aac" to "faad"
A decoder plugin should be named after the library which is used.
2009-02-16 19:30:54 +01:00
Max Kellermann
c5edb53797 renamed decoder plugin "mp3" to "mad"
A decoder plugin should be named after the library which is used.
2009-02-16 19:30:45 +01:00
Max Kellermann
ed591f19ef wildmidi: check if configurationn file exists
Don't call WildMidi_Init() if the configuration file does not exist.
Don't let libwildmidi clutter stderr with its warning message.
2009-02-15 18:41:05 +01:00
Max Kellermann
5c68f91dae wildmidi: obtain timidity.cfg location from mpd.conf 2009-02-15 18:41:03 +01:00
Max Kellermann
dec5d48f80 decoder_plugin: pass struct config_param to init() method
Preparing for per-plugin configuration sections in mpd.conf.
2009-02-15 18:34:14 +01:00
Max Kellermann
a06e281421 aac: fix stream metadata
Pass the input_stream object to decoder_data().  Without it, the MPD
core does not see stream tags.
2009-02-12 18:39:19 +01:00
Max Kellermann
a2ce6e5b82 wildmidi: added seeking support
Use WildMidi_SampledSeek() for seeking in a MIDI file.
2009-02-12 18:19:13 +01:00
Max Kellermann
321eb1077a wildmidi: provide and current total song time
The _WM_Info struct provides all we need, it is obtained by
WildMidi_GetInfo().
2009-02-12 16:47:48 +01:00
Max Kellermann
1492339463 wildmidi: new decoder plugin for MIDI files 2009-02-12 16:43:18 +01:00
Max Kellermann
e56a90f3b3 fluidsynth: new decoder plugin for MIDI files
There are a few problems left in this plugin:

- fluidsynth decodes in real time, while MPD prefers to buffer as
  quickly as possible; as a workaround, this plugin uses a timer
  object to synchronize with real-time playback

- I don't know yet how fluidsynth tells me when the song has ended

- the "soundfont" configuration setting is not yet documented, and it
  will likely change soon (in favor of a per-decoder configuration
  block)
2009-02-12 08:43:26 +01:00
Max Kellermann
1136f6fb7a sidplay: new decoder plugin for playing C64 SID files 2009-02-11 20:31:17 +01:00
Max Kellermann
550b9c3f23 ffmpeg: added TTA support
The ffmpeg library supports the "True Audio Codec".  The entry in
ffmpeg_suffixes was missing.
2009-02-11 18:27:11 +01:00
Max Kellermann
824d299eb1 ffmpeg: fixed seek integer overflow
The "current" variable is used for calculating the seek destination,
and was declared as "int".  With very long song files, the 32 bit
integer can overflow.  ffmpeg expects an int64_t, which is very
unlikely to overflow.  Switch to int64_t.
2009-02-03 22:51:44 +01:00
Max Kellermann
f3b73b824f ffmpeg: check if the time stamp is valid
When ffmpeg cannot estimate the elapsed time, it sets
AVPacket.pts=AV_NOPTS_VALUE.  Our ffmpeg decoder plugin did not check
for that special value.
2009-02-03 22:51:41 +01:00
Max Kellermann
81b6c0d77b ffmpeg: don't warn of empty packet output
If avcodec_decode_audio2() returns no output for an AVPacket,
libavcodec may buffer some data, and return a larger chunk of output
later.  This patch disables a lot of bogus warnings.
2009-02-03 22:51:38 +01:00
Max Kellermann
a7632b09e0 ffmpeg: print codec name
Output the name of the codec as a debug message.  During my tests,
ffmpeg never filled this struct member, but it may do so in the past,
and this debug message might become helpful.
2009-02-03 22:51:35 +01:00
Matthias Drochner
5b85288664 mikmod: call MikMod_Exit() only in the finish() method
Hi -
independently of libmikmod's other problems - there seems
to be a problem in mpd's wrapper: MikMod_Exit() is called
after the first file is decoded, which frees some ressources
within the mikmod library. An attempt to play a second file
leads to a crash. The appended patch fixes this for me.
(I don't know what the "dup" entry is good for - someone
who knows should review that too.)
best regards
Matthias

[mk: removed 3 more MikMod_Exit() invocations]
2009-01-30 17:51:16 +01:00
Max Kellermann
02bfb0c4e4 wavpack: pass NULL if the .wvc file fails to open
The wavpack library seems to use the .wvc stream even if the OPEN_WVC
flag is not set.  In this case, pass NULL to be sure libwavpack won't
use it.
2009-01-30 16:05:02 +01:00
David Horn
efb04532df ffmeg: added support for the tags comment, genre, year
ffmpeg_tag_internal() does not look for a few tags that mpd
supports. Most noteably:

 comment -> TAG_ITEM_COMMENT -> Description
 genre -> TAG_ITEM_GENRE -> WM/Genre (not WM/GenreID)
 year -> TAG_ITEM_DATE -> WM/Year

I *think* that this is the last of the tags that AVFormatContext() in
ffmpeg supports that mpd also uses.
2009-01-30 09:42:49 +01:00
Max Kellermann
a45922cd66 use g_free() instead of free()
On some platforms, g_free() must be used for memory allocated by
GLib.  This patch intends to correct a lot of occurrences, but is
probably not complete.
2009-01-25 18:47:21 +01:00
Max Kellermann
2bfe6f6412 renamed the "mod" decoder plugin to "mikmod"
We have two mod plugins now: modplug and mod.  Rename the latter to a
more useful name.
2009-01-24 20:18:44 +01:00
Max Kellermann
0dc1b4a44e modplug: removed EOF check from the while loop
EOF is checked by input_stream_read() (decoder_read() here).  Don't do
it twice.  The check was wrong anyway, it was reversed.
2009-01-24 20:02:06 +01:00
Max Kellermann
793934cf9c modplug: check for input_stream errors
When input_stream_read() returns 0, and input_stream_eof() returns
false, an I/O error has occured.  Skip this song.
2009-01-24 19:16:33 +01:00
Max Kellermann
14b37656a6 modplug: use size_t instead of int for buffer sizes 2009-01-24 19:16:31 +01:00
Max Kellermann
4a4c6fb6dc modplug: check size limit before appending new buffer
Don't enlarge the GByteArray when the size limit may overflow in this
operation; check the size limit first.
2009-01-24 19:16:20 +01:00
Max Kellermann
b53e80d785 modplug: use GByteArray.len, remove total_len
The local variable "total_len" is superfluous because GByteArray
always knows its size.
2009-01-24 19:16:10 +01:00
Max Kellermann
0c71640528 modplug: unknown size is -1; check for empty file
The input_stream API sets size to -1 when the size of the resource is
not known.  The modplug decoder checked for size==0, which would be an
empty file.
2009-01-24 19:16:07 +01:00
Max Kellermann
961d172200 modplug: header cleanup
Don't include utils.h and log.h, they are relics from the past.
2009-01-24 19:16:05 +01:00
Max Kellermann
9229869f04 modplug: define G_LOG_DOMAIN
Make sure that log messages are decorated correctly.
2009-01-24 19:15:53 +01:00
Max Kellermann
b381638009 modplug: declare constants as enum
Don't write CPP if you can write C.
2009-01-24 19:15:50 +01:00
Max Kellermann
24d4c2df92 modplug: use only decoder_read(), not input_stream_read()
You are allowed to call decoder_read() with decoder==NULL.  It is a
convenience function provided by the decoder API.  Don't manually fall
back to input_stream_read().
2009-01-24 19:15:48 +01:00
Andrzej Rybczak
82df4cb2b0 modplug: change settings before loading a file
alternative settings must be set before the file
is loaded, otherwise they won't be respected.
2009-01-24 13:10:02 +01:00
Max Kellermann
fbed96dcea flac: include config.h
The plugin queries build-time configuration variables, and should
include config.h.
2009-01-19 09:54:47 +01:00
Max Kellermann
a1a97cc048 conf: use config_get_bool() instead of getBoolConfigParam() 2009-01-17 20:23:33 +01:00
Max Kellermann
5395f5f6b3 moved fallback APE/ID3 tag loader to song.c
Some plugins used the APE or ID3 tag loader as a fallback when their
own methods of loading tags did not work.  Move this code out of all
decoder plugins, into song_file_update().
2009-01-17 13:23:42 +01:00
Max Kellermann
d83eff80a5 oggvorbis: disable seeking on remote songs
When libvorbis knows that a song is seekable, it seeks around like
crazy in the file before starting to decode it.  This is very
expensive on remote HTTP resources, and delays MPD for 10 or 20
seconds.

This patch disables seeking on remote songs, because the advantages of
quickly playing a song seem to weigh more than the theoretical ability
of seeking for most MPD users.  If users feel this feature is needed,
we will make a configuration option for that.
2009-01-17 11:46:31 +01:00
Qball Cow
b533307d6f Enable wav file streaming for ffmpeg input plugin 2009-01-16 17:11:16 +01:00
Rasmus Steinke
3e87e4f3ab flac: map "Album Artist" to "AlbumArtist"
This patch allows mpd to recognise the albumartist tag in the way
foobar2000 and others write it to files.
2009-01-15 22:45:29 +01:00
Max Kellermann
9cc373d62d flac: splitted flac_copy_vorbis_comment()
Splitted flac_copy_vorbis_comment() into flac_copy_comment() and
flac_copy_comment().
2009-01-15 22:45:28 +01:00
Max Kellermann
0dec3f787f flac: moved code to flac_comment_value()
Simplify flac_copy_vorbis_comment() by moving the comment
identification code out.
2009-01-15 22:44:21 +01:00
Max Kellermann
f30adc3526 flac: always allocate tag object
Free the tag object when it turns out to be empty.  This simplifies
several functions and APIs.
2009-01-15 22:43:39 +01:00
Max Kellermann
15435b09af flac: use bool instead of int 2009-01-15 19:57:57 +01:00
Max Kellermann
8307dd3e87 flac: removed "vorbis_comment_found" flag
Use tag_is_empty() instead.
2009-01-15 19:53:07 +01:00
Max Kellermann
86dc79293f flac: no CamelCase
Renamed types, functions, variables.
2009-01-15 19:50:28 +01:00
Rasmus Steinke
9b0ce18144 oggvorbis: map "Album Artist" to "AlbumArtist"
This patch allows mpd to recognise the albumartist tag in the way foobar2000
and others write it to files.
2009-01-15 06:51:58 +01:00
Max Kellermann
283c2621f3 oggvorbis: use g_ascii_strncasecmp() instead of strncasecmp()
Don't depend on the daemon's locale settings.  Comment names are
ASCII.
2009-01-14 23:23:05 +01:00
Max Kellermann
f353bf77ba oggvorbis: moved tag look into vorbis_parse_comment()
vorbis_parse_comment() should be a function which converts one comment
to a tag item.  It should do everything required to do the conversion,
including looping over all possible tag types.
2009-01-14 23:21:45 +01:00
Max Kellermann
69b033757f oggvorbis: moved code to vorbis_copy_comment() 2009-01-14 23:15:14 +01:00
Max Kellermann
25cf333355 oggvorbis: use vorbis_comment_value() in vorbis_parse_comment()
Eliminate some duplicate code.
2009-01-14 23:09:36 +01:00
Max Kellermann
5a26c949bb oggvorbis: always allocate a tag object
Always allocate a new tag object before parsing the vorbis comments;
free it when it turns out to be empty.  This simplifies the code a
bit.
2009-01-14 23:09:31 +01:00
Max Kellermann
b5cadc9c04 oggvorbis: no CamelCase
Renamed functions and variables.
2009-01-14 23:09:02 +01:00
Max Kellermann
b8e06d414a oggvorbis: use bool
Make ogg_parseCommentAddToTag() return bool instead of unsigned int.
2009-01-14 22:51:11 +01:00
Max Kellermann
5e93d3682f added missing explicit config.h includes 2009-01-08 21:37:02 +01:00
Max Kellermann
d9c2960a55 fix G_BYTE_ORDER check
"#ifdef G_BYTE_ORDER == G_BIG_ENDIAN" cannot work, of course.
2009-01-05 12:40:57 +01:00
Max Kellermann
ac0fe98ffb use GLib byte order macros 2009-01-05 08:17:22 +01:00
Max Kellermann
fed719197c song: allocate the result of song_get_url() 2009-01-04 19:09:34 +01:00
Max Kellermann
38bf81285f utils: removed unused functions
Removed all allocation functions, xwrite(), xread(), ARRAY_SIZE().
Those have been superseded by GLib.
2009-01-03 14:53:42 +01:00
Max Kellermann
38e3220fd4 oggflac: don't use gcc.h
Use G_GNUC_UNUSED instead of mpd_unused (which has already been
removed).
2009-01-02 09:50:12 +01:00
Max Kellermann
17bdcc8bae decoder plugins: don't include gcc.h
Use GLib's G_GNUC_UNUSED instead of gcc.h's mpd_unused.
2009-01-01 18:09:24 +01:00
Max Kellermann
95b3430f52 removed os_compat.h
Only include headers which are really needed.  os_compat.h aimed to
make MPD easily portable, but was never actually made portable.
2008-12-29 17:28:32 +01:00
Frank Mulder
a51fada124 mp4: support the writer/composer tag
I tried to search for a certain composer in my collection, but only
non-mp4 files showed up. The source code reveals that this tag is not
read. This can be fixed by reading the 'Writer' tag field, in
mp4_plugin.c, in function mp4_load_tag.

I actually tried this, and after compiling with those lines added,
also mp4 (.m4a) files showed up when searching for a composer.
2008-12-29 11:29:01 +01:00
Max Kellermann
4b3a055ffe mikmod: use Glib instead of utils.h/log.h 2008-12-28 19:48:53 +01:00
Max Kellermann
4ca02bfcfc mikmod: convert mod_Data.audio_buffer to a static array
Don't do two allocations for the mod_Data structure.
2008-12-28 19:48:53 +01:00
Viliam Mateicka
d838a1ad24 decoder: new plugin using modplug library 2008-12-28 17:11:18 +01:00
Pauli Virtanen
65b18644e1 Add RVA2 tag support to MPD
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>
2008-12-28 13:02:34 +01:00
Max Kellermann
cc3b6c2f5b audiofile: don't close onput stream in libaudiofile destroy()
The input_stream object should only be closed by the MPD core
(i.e. decoder_thread.c / decoder_run()).  A decoder plugin which
attempts to close it will result in a segmentation fault.
2008-12-27 14:34:51 +01:00
Max Kellermann
9220e0edff Merge branch 'experimental' of git://git.musicpd.org/metyl/mpd
Conflicts:

	configure.ac
	src/ls.h
	src/output/shout_plugin.c
2008-12-27 13:34:51 +01:00
Max Kellermann
7f98ba24c7 ffmpeg: case AV_NOPTS_VALUE to int64_t
The old code casted it to a 32 bit integer, which cut off bits.
AVFormatContext.duration is a int64_t, so use this type.
2008-12-24 11:56:53 +01:00
Max Kellermann
82ef85a309 ffmpeg: don't assign "0" to pointer
Use NULL instead.  Found by sparse.
2008-12-24 11:49:37 +01:00
Max Kellermann
fc723803a4 mp3: "tag" argument is unused when libid3tag is disabled
Add G_GNUC_UNUSED attributes.
2008-12-24 11:07:58 +01:00
Viliam Mateicka
88ab54d3d4 ffmpeg: fixing ffmpeg_send_packet to allow multipackets 2008-12-15 19:37:10 +01:00
Viliam Mateicka
8a412aaa27 ffmpeg: adding APE support 2008-12-15 19:34:58 +01:00
Max Kellermann
87f6f57bf6 mp3: declare variables as "enum mp3_action"
Variables which hold one of the DECODE_* values should be declared as
"enum mp3_action" instead of "int".
2008-12-08 16:49:19 +01:00
Viliam Mateicka
e61ba50ebd decoder: audiofile plugin using input stream instead of file 2008-12-03 20:26:08 +01:00
Max Kellermann
910c000954 mp3: use GLib logging
Use GLib's g_warning(), ... instead of MPD's deprecated log.h.
2008-11-27 19:19:05 +01:00
Max Kellermann
14e121af90 flac, mpc, ogg, wavpack: include unistd.h for SEEK_SET
SEEK_SET is defined by unistd.h.  Explicitly include it.
2008-11-24 10:33:08 +01:00
Laszlo Ashin
a493aafe02 wavpack: use assert_static() 2008-11-22 14:28:11 +01:00
Max Kellermann
976d5045c6 decoder: check audio_format_valid() in all decoders
Refuse to play audio formats which are not supported by MPD.
2008-11-21 20:27:30 +01:00
Max Kellermann
63c3ebee46 flac, oggflac: use GLib instead of utils.h/log.h 2008-11-21 20:15:50 +01:00
Max Kellermann
f15fc4e99a ffmpeg: use GLib instead of log.h 2008-11-21 20:13:41 +01:00
Max Kellermann
4a3a621caf audiofile: use GLib instead of log.h 2008-11-21 20:13:36 +01:00
Max Kellermann
7a2fe930b8 aac: use GLib instead of utils.h/log.h
Removed the superfluous my_usleep() call.
2008-11-21 20:13:26 +01:00
Max Kellermann
927bf45f84 ogg: moved the "errorStr" variable into the error handler 2008-11-20 20:11:00 +01:00
Laszlo Ashin
65a8822a0b aac: get rid of gcc warnings 2008-11-20 19:20:25 +01:00
Max Kellermann
1f50146e29 ogg: check the ov_read() return value before the vorbis_info evaluation
The ov_info() return value may be corrupt when ov_read() did not
return a positive value.  First check for success, then check
ov_info().
2008-11-20 12:45:17 +01:00
Laszlo Ashin
05f4629fa3 wavpack: redo using audio_format_frame_size()
Somehow we lost 600e1322 after renaming some variables in ed6f6046.
2008-11-19 00:02:06 +01:00
Viliam Mateicka
33b5015469 ffmpeg: read tags from AVFormatContext
The ffmpeg library provides some of the song metadata in the
AVFormatContext struct.  Pass it from there to MPD.
2008-11-18 20:03:00 +01:00
Viliam Mateicka
eac4ed2241 audiofile: fixed misplaced if
[mk: by definition, tag_new() cannot fail - removed check]
2008-11-18 19:54:42 +01:00
Max Kellermann
7591403566 input_stream: size==-1 means unknown size
Define the special value "-1" as "unknown size".  Previously, there
was no indicator for streams with unknown size, which might confuse
some decoders.
2008-11-16 20:42:08 +01:00
Max Kellermann
8882f06200 ffmpeg: fixed AVSEEK_SIZE
With whence==AVSEEK_SIZE, the seek function should return the file
size, not the current offset.  Check the return value of
input_stream_seek().
2008-11-16 20:25:31 +01:00
Max Kellermann
9c4e97a61b aac: detect whether to pass "uint32_t*" to NeAACDecInit2()
neaacdec.h declares all arguments as "unsigned long", but internally
expects uint32_t pointers.  This triggers gcc warnings on 64 bit
architectures.  To avoid that, make configure.ac detect whether we're
using Debian's corrected headers or the original libfaad headers.  In
any case, pass a pointer to an uint32_t, conditionally casted to
"unsigned long*".
2008-11-16 20:04:49 +01:00
Laszlo Ashin
c368a2f91c aac: fix compiler warnings on amd64 2008-11-15 11:54:22 +01:00
Laszlo Ashin
00da7db1e3 aac: don't try to free static buffer
In 432da18e a dynamic buffer was replaced by a static one but some
frees were accidently left there which caused some segfaults.
2008-11-15 11:50:25 +01:00
László Áshin
440b1ea3ea wavpack: be more robust if the underlying stream is not seekable
The wavpack open function gives us an option called OPEN_STREAMING. This
provides more robust and error tolerant playback, but it automatically
disables seeking. (More exactly the wavpack lib will not return the
length information.) So, if the stream is already not seekable we can
use this option safely.
2008-11-14 15:23:18 +01:00
László Áshin
c495c6f5af wavpack: tolerate less decoded data than requested
Wavpack plugin doesn't stop decoding if a block couldn't be fully
decoded, rather it tries to go on.
2008-11-14 15:23:13 +01:00
László Áshin
ed6f60460d wavpack: renamed variables and modified coding style slightly 2008-11-14 15:21:44 +01:00
Max Kellermann
7b7340f703 mp3: fix SEEK command check after mp3_synth_and_send()
mp3 seeking was broken, because the command==SEEK check was never
reached.  Swap the command check order (==SEEK before !=NONE) to fix
that.
2008-11-13 14:43:19 +01:00
Max Kellermann
93f488f034 wavpack: remove commented debug messages 2008-11-12 21:25:08 +01:00
Max Kellermann
600e132280 wavpack: calculate outsamplesize with audio_format_frame_size() 2008-11-12 21:25:02 +01:00
Max Kellermann
ef80464c0c ogg: revert "use ogg_fopen() instead of ogg_open()"
Unfortunately, ov_fopen() is not supported by libvorbis versions older
than 1.2.
2008-11-12 08:38:04 +01:00
Max Kellermann
b67a8e4d6e aac: shift the input buffer before the full check
When the buffer was full, but everything was already consumed,
fillAacBuffer() would not attempt to flush and refill it.
2008-11-12 08:32:21 +01:00
Max Kellermann
432da18e44 aac: make the input buffer static
Allocate the input buffer within the AacBuffer struct.
2008-11-12 08:29:40 +01:00
Max Kellermann
487e05c67d aac: reject SEEK commands
The aac plugin does not support seeking.  Reject SEEK requests by
calling decoder_seek_error().  Quit the plugin's main loop only when
STOP is received.
2008-11-12 08:25:09 +01:00
Max Kellermann
a9723e661a aac: get decoder command from decoder_data()
Removed a superfluous decoder_get_command() call.
2008-11-12 08:25:06 +01:00
Max Kellermann
35a4ca2421 aac: convert audio_format to temporary variable
The audio_format variable is only used and initialized for
decoder_initialized().  Move it into that block to save some bytes on
the stack.
2008-11-12 08:21:00 +01:00
Max Kellermann
39fa60769c aac: removed method file_decode()
aac_stream_decode() was basically copy+pasted from aac_decode().
Since stream_decode() can also decode files, eliminate aac_decode().
2008-11-12 08:17:50 +01:00
Max Kellermann
e19b53f814 aac: check the buffer length in the ADIF parser
Check whether enough data has been read yet.
2008-11-12 08:16:54 +01:00
Max Kellermann
b30ec73099 aac: use unsigned integers and size_t where appropriate 2008-11-12 08:16:38 +01:00
Max Kellermann
9806355d4c aac: check if the stream is seekable before length check
If the stream is not seekable, don't try to decode all frames to find
out the total song time.
2008-11-12 07:46:01 +01:00
Max Kellermann
f6765c4d8b aac: removed attribute "atEof"
Use input_stream_eof() instead.
2008-11-12 07:41:54 +01:00
Max Kellermann
eff21067f0 mpc: assume the result fo of mpc_decoder_decode() is unsigned
According to the documentation, mpc_decoder_decode() returns an
mpc_uint32_t.  Since the special return value (mpc_uint32_t)-1
translates to a very large long integer, this may cause segmentation
faults if not interpreted properly.
2008-11-12 07:14:18 +01:00
Max Kellermann
0a6f4048d0 mpc: don't assume the stream is stereo
Don't hard-code the factor "2".
2008-11-12 07:07:40 +01:00
Max Kellermann
8d1ffb1684 mpc: get decoder command from decoder_data()
Removed 3 superfluous decoder_get_command() invocations.
2008-11-12 07:07:12 +01:00
Max Kellermann
731e99c26e mpc: moved code to mpc_to_mpd_buffer()
mpc_to_mpd_buffer() converts a whole chunk at a time.  This eliminates
3 local variables in mpc_decode().
2008-11-12 07:06:47 +01:00
Max Kellermann
975d5cd77e mpc: make the buffer large enough for one mpc frame
Don't split the buffer conversion loop.  When libmpcdec returns a
chunk, convert and send the whole chunk at a time.  This moves several
checks out of the loop, and greatly improves performance.
2008-11-12 07:03:44 +01:00
Max Kellermann
865757835e mpc: use GLib instead of utils.h/log.h
Don't use deprecated MPD libraries.
2008-11-12 07:02:29 +01:00
Max Kellermann
1414a3de4c mpc: declare buffer as int32_t[]
The buffer is always casted to int32_t* anyway; declare it as int32_t
array, and remove the cast.
2008-11-12 07:02:06 +01:00
Max Kellermann
06c60888dc mpc: eliminated the local variable "eof"
Since each "eof=true" is followed by "break", the variable is
superfluous.
2008-11-11 21:39:50 +01:00
Max Kellermann
97080b796c ogg: removed stray "}"
Due to an unnoticed merge error, there was a superfluous "}".  Remove
it.
2008-11-11 21:39:31 +01:00
Max Kellermann
53c17db5e9 ogg: use ogg_fopen() instead of ogg_open()
Move the reponsibility for freeing the file handle to libvorbis.
2008-11-11 21:33:10 +01:00
Max Kellermann
448ff32c96 ogg: use GLib instead of utils.h/log.h 2008-11-11 21:33:01 +01:00
Max Kellermann
0cba1ae312 ogg: get decoder command from decoder_data()
Eliminate two decoder_get_command() invocations from the main loop.
2008-11-11 21:21:54 +01:00
Max Kellermann
7b575b55c2 ogg: flush buffer after every ov_read() call
Don't let the buffer grow until it is full, flush it whenever there is
data available.
2008-11-11 21:15:01 +01:00
Max Kellermann
67814eddff mp3: support stream tags
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.
2008-11-11 20:53:24 +01:00
Max Kellermann
514c37b0cd mp3: eliminated duplicate command check
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.
2008-11-11 20:50:37 +01:00
Max Kellermann
81d2076bcf oggflac: removed the obsolete try_decode() method 2008-11-11 17:17:06 +01:00
Max Kellermann
9eed41911f decoder: return void from decode() methods
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.
2008-11-11 17:13:44 +01:00
Max Kellermann
5ddde0aac7 replay_gain: converted struct replay_gain_info elements to an array
Having an array instead of individual variables allows the use of the
replay_gain_mode enum as an array index.
2008-11-11 16:24:27 +01:00
Max Kellermann
5e686add91 wavpack: added wavpack_tag_float()
The function simplifies wavpack_replaygain(), because it already
contains the float parser, and it works with a fixed buffer instead of
doing expensive heap allocations.
2008-11-11 16:21:09 +01:00
Max Kellermann
c883d761ab wavpack: make the "key" argument to wavpack_tag() const
This allows us to remove the "static char[]" hack.
2008-11-11 16:19:29 +01:00
Max Kellermann
e2c07dbbbc ogg: ogg_getReplayGainInfo() returns replay_gain_info pointer
Some code simplification.  Avoid pointers to pointers.
2008-11-11 16:19:00 +01:00
Max Kellermann
114b3c1e78 replay_gain: no CamelCase
Renamed functions and variables.
2008-11-11 15:55:34 +01:00
Max Kellermann
ff1acefb21 decoder: removed plugin method try_decode()
Instead of having a seprate try_decode() method, let the
stream_decode() and file_decode() methods decide whether they are able
to decode the song.
2008-11-10 15:07:01 +01:00
Max Kellermann
23a4ce4444 flac: call flac_process_metadata() for ogg files
The flac plugin wasn't initialized properly when an OGG file was being
decoded.  For some reason, flac_process_metadata() was explicitly not
called for OGG files.  Since that seems to fix the issue, make it
always call flac_process_metadata().
2008-11-10 14:49:34 +01:00
Max Kellermann
0e87f85598 flac: enable the oggflac plugin with older libflac versions
Since decoder_list.c does not include the libflac headers, it cannot
know whether to add the oggflac plugin to the decoder list.  Solve
this by always enabling the oggflac sub-plugin, even with older
libflac versions.  When the libflac API cannot support oggflac,
disable the plugin at runtime by returning "false" from its init()
method.
2008-11-10 14:39:42 +01:00
Max Kellermann
ab24e203cd wavpack: removed try_decode() method
Wavpack's try_decode() implementation does nothing useful, it only
duplicates code already in stream_decode() / file_decode(), and slows
down MPD.
2008-11-09 22:10:48 +01:00
Max Kellermann
b054ad0ea6 flac: make the init() method check for oggflac support
Disable flac's "oggflac" sub-plugin when libflac does not support
ogg-flac files.
2008-11-09 22:01:47 +01:00
Laszlo Ashin
343a8a20e3 wavpack: make 24-bit samples available for mpd
This patch makes 24-bit samples available for mpd. I tested with the
WavPack Test Suite found on wavpack.com:

 http://www.rarewares.org/wavpack/test_suite.zip

Every test file worked fine.
2008-11-08 13:11:10 +01:00
Laszlo Ashin
3e338da871 wavpack: check last_byte in push_back_byte() method
At this moment the wavpack lib doesn't use the return value of the
push_back function, which has an equivalent meaning of the return
value of ungetc().  This is a lucky situation, because so far it
simply returned with 1 as a hard coded value.  From now on the
function will return EOF on error.  (This function makes exactly one
byte pushable back.)
2008-11-08 13:10:15 +01:00
Laszlo Ashin
cfd55b29bd wavpack: wrapper for converting void* to struct wavpack_input*
A new function has been added to do a cast and a little check in the
wavpack-mpd input stream wrapper.
2008-11-08 13:09:07 +01:00
Laszlo Ashin
2b4a410bb0 wavpack: put braces around one line code blocks
I think this makes the code more easily modifiable and prevents some
annoying mistakes.
2008-11-08 13:08:21 +01:00
Laszlo Ashin
d68df99ef4 wavpack: added prefix to local function names
There are some functions in the wavpack-mpd input streams wrapper
which had too commonly used names (especially can_seek). I prefixed
these with "wavpack_input_".
2008-11-08 13:07:40 +01:00
Laszlo Ashin
ff2e69c003 wavpack: unified code style
Not every function header has its return type in a distinct line. This
patch corrects that.  This way there is more space for the arguments.
2008-11-08 13:07:09 +01:00
Laszlo Ashin
2e0ba90208 wavpack: check wvc seekability
Using wvc streams the seekableness depends on the seekability of the
wvc stream as well.
2008-11-06 06:48:33 +01:00
Laszlo Ashin
56d2b51056 wavpack: close wvc stream on error
The input stream opened for wvc is not closed in an if branch.  A
close call has been added.
2008-11-06 06:48:33 +01:00
Laszlo Ashin
089c9b7e5c wavpack: enable seeking
Somehow seeking is disabled on all kinds of wavpack playbacks now in
the git version.  This patch corrects that.
2008-11-06 06:48:33 +01:00
Max Kellermann
eedbd28ec9 wavpack: read_bytes() should not return after partial reads
libwavpack expects the read_bytes() stream method to fill the whole
buffer, and fails badly when we return a partial read (i.e. not enough
data available yet).  This caused wavpack streams to break.
Re-implement the buffer filling loop.
2008-11-05 07:24:57 +01:00
Max Kellermann
010a27cd95 wavpack: don't close the stream
The input_stream object is opened and closed by the caller.
2008-11-05 07:13:55 +01:00
Max Kellermann
85a7d1a148 decoder: removed stream_types
Instead of checking the stream_types bit set, we can simply check
whether the methods stream_decode() and file_decode() are implemented.
2008-11-04 17:10:19 +01:00
Max Kellermann
59c20e5afe wavpack: removed NULL element from tagtypes
The number of tag types is known at compile time.  Use the GLib macro
G_N_ELEMENTS instead of having a NULL element at the end.
2008-11-04 17:10:17 +01:00
Max Kellermann
66eb3e90c3 wavpack: use enum tag_type
Don't store tag type values in a plain integer, use the proper enum.
2008-11-04 17:10:13 +01:00
Max Kellermann
946e69b2f6 wavpack: use GLib instead of utils.h / log.h
Replace deprecated code with GLib.
2008-11-04 17:10:10 +01:00
Max Kellermann
097bccd4ae wavpack: read first byte from wvc stream
Instead of manually waiting for the input stream to become ready (to
catch server errors), just read the first byte.  Since the
wavpack_input has the capability to push back one byte, we can simply
re-feed it.  Advantage is: decoder_read() handles everything for us,
i.e. waiting for the stream, polling for decoder commands and error
handling.
2008-11-04 17:10:03 +01:00
Max Kellermann
3cf54591e9 wavpack: use the bool data type
Use boolean true/false instead of 1/0.
2008-11-04 17:10:01 +01:00
Max Kellermann
b6ea410ca7 wavpack: no CamelCase
Renamed functions and variables.
2008-11-04 17:08:59 +01:00
Max Kellermann
c1dfa52cbf wavpack: fix indent
Fixed the indent of the switch statement in format_samples_int().
2008-11-04 17:08:57 +01:00
Max Kellermann
fef14683ae mp4: get decoder command from decoder_data()
Eliminate a superfluous decoder_get_command() call.  decoder_data()
already returns the command.
2008-11-04 17:05:08 +01:00
Max Kellermann
11404b5d10 mp4: initialize audio_format before decoder_initialized()
Removed the duplicate audio_format initialization.
2008-11-04 17:05:05 +01:00
Max Kellermann
290347c482 mp4: use decoder_read() instead of input_stream_read()
decoder_read() handles decoder commands, and should be used in decoder
plugins.
2008-11-04 17:05:02 +01:00
Max Kellermann
9ecfc57c3a mp4: pass struct mp4_context to the mp4ff_callback_t methods
We need the decoder object, so we have to begin passing a new struct
to these callbacks, instead of only the pointer to the input_stream
object.
2008-11-04 17:05:00 +01:00
Max Kellermann
632dc7c96b mp4: use GLib instead of utils.h / log.h
Replace deprecated code with GLib.
2008-11-04 17:04:57 +01:00
Max Kellermann
01706dd46c mp4: use tag_is_empty() instead of passing the tag_is_found flag
The API of mp4_load_tag() was strange: it always returned a tag
object, no matter if a tag was found in the file; the existence of a
tag was indicated with the tag_found integer reference.  This flag is
superfluous, since we can simply check whether the tag is empty or
not.
2008-11-04 17:04:54 +01:00
Max Kellermann
02a172f2c2 mp4: static mp4ff_callback_t variables
Allocate the mp4ff_callback_t object on the stack.  This is easier to
handle, since we don't have to free it.  Incidentally, this fixes a
memory leak in mp4_load_tag().
2008-11-04 16:55:12 +01:00
Max Kellermann
8712a1f7bf mp4: no CamelCasee
Renamed functions and variables.
2008-11-04 16:55:12 +01:00
Max Kellermann
ab07cdd453 ffmpeg: removed loop from mpd_ffmpeg_read()
The function decoder_read() already cares about the decoder command,
and loops until data is available.  Reduced mpd_ffmpeg_read() to no
more than the decoder_read() call.
2008-11-04 16:55:12 +01:00
Max Kellermann
292334a27a ffmpeg: removed ffmpeg_context.codec
That variable is never used except during initialization in
ffmpeg_helper().
2008-11-04 16:55:12 +01:00
Max Kellermann
7e84c73b17 ffmpeg: moved code to ffmpeg_find_audio_stream() 2008-11-04 16:55:12 +01:00
Max Kellermann
5e486964e8 ffmpeg: no CamelCase
Renamed variables.
2008-11-04 16:55:11 +01:00
Max Kellermann
ac96022c1d decoder_api: automatically send stream tag
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.
2008-11-03 18:24:01 +01:00
Max Kellermann
e6f334a088 mod: removed boolean globals for lazy init
The variables mod_mikModInitiated and mod_mikModInitError were used to
control lazy initialization, but they are superfluous now.
2008-11-03 07:32:02 +01:00
Max Kellermann
bb15c3bd45 mod: always initialize libmikmod
The "mod" decoder plugin was being initialized lazily, but was
deinitialized unconditionally.  That led to segmentation faults.
Convert mod_initMikMod() to be the global module initialization
method.  The MPD core should care about lazy initialization.
2008-11-03 07:30:42 +01:00
Max Kellermann
e5137706d1 ffmpeg: fix boolean inversion in ffmpeg_tag()
ffmpeg_tag() deleted the tag when ffmpeg_helper() returned success.
The return value was interpreted incorrectly, it should return the tag
on success.
2008-11-02 17:32:40 +01:00
Max Kellermann
accc82cd6c ffmpeg: don't rewind stream in url_close()
Rewinding the stream here is not useful, but may consume valuable
resources (and time).
2008-11-02 17:10:12 +01:00
Max Kellermann
2124df1390 decoder: rewind input stream after try_decode()
The try_decode() method may have read some data from the stream, which
is now lost.  To make this data available to other methods, get it
back by rewinding the input stream after each try_decode() invocation.

The ogg and wavpack plugins did this manually and inconsistently; this
code can now be removed.
2008-11-02 17:10:02 +01:00
Max Kellermann
0f80428fda ffmpeg: use decoder_read() wrapper instead of direct input_stream_read()
decoder_read() checks the decoder command.  Without this patch, the
ffmpeg plugin could become unresponsive.
2008-11-02 17:06:53 +01:00
Max Kellermann
4d069b4991 ogg, ffmpeg: try to decode, even when the stream is not seekable
Ogg and ffmpeg detection was disabled when the stream was not
seekable, because the detection was too expensive.  Since the curl
input stream can now rewind the stream cheaply, we can re-enable
detection on streams.
2008-11-02 17:06:32 +01:00
Max Kellermann
020c04e702 decoder_api: added decoder_tag()
Provide an API for submitting additional tags from the stream.
2008-11-02 17:02:28 +01:00
Max Kellermann
5b13f067cd aac, mod: moved decoder command check into loop condition
Avoid while(true) loops, and convert them to a loop with a proper
condition.
2008-11-02 17:02:23 +01:00
Max Kellermann
3f6fcfd38e aac, mod: don't check for SEEK command
Since the aac and mod plugins have told MPD that they cannot seek, MPD
will never send a SEEK command to them.  Removed the SEEK comand
checks from both plugins.
2008-11-02 17:02:00 +01:00
Max Kellermann
c9e15bc418 decoder_api: pass "seekable" flag to decoder_initialized()
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.
2008-11-02 17:01:51 +01:00
Max Kellermann
4c1b96c307 decoder: make the suffixes and mime_types arrays really const
The strings were constant, but the pointers weren't.  C syntax is
somewhat tricky..
2008-11-01 14:55:23 +01:00
Max Kellermann
0b614fbaae decoder: make all decoder_plugin structs const
All decoder_plugin structs are initialized at compile time, and must
never change.
2008-11-01 14:54:09 +01:00
Max Kellermann
78448fe1a5 decoder_api: pass constant path pointers 2008-10-31 15:56:43 +01:00
Max Kellermann
ea515494cb added prefix to header macros
"LOG_H" is a macro which is also used by ffmpeg/log.h.  This is
ffmpeg's fault, because short macros should be reserved for
applications, but since it's always a good idea to choose prefixed
macro names, even for applications, we are going to do that in MPD.
2008-10-31 09:19:53 +01:00
Max Kellermann
8f37f7c838 ogg: don't include _flac_common.h
The source _ogg_common.c does not need any symbols from
_flac_common.h, but including it leads to compiler errors when libflac
isn't available.
2008-10-31 08:52:09 +01:00
Max Kellermann
d65d6548a3 oggflac: adapt to new API
Again, I forgot to adapt oggflac to the new API (struct input_stream,
bool return values).
2008-10-31 08:52:09 +01:00
Max Kellermann
5024f0b6cc ffmpeg: pass input_stream pointer to decoder_data()
decoder_data() uses wait times to let the input stream continue its
transfer.
2008-10-30 19:09:20 +01:00
Max Kellermann
b15c4cdeb5 ffmpeg: use return value of decoder_data()
decoder_data() always returns the current command.  If we use this, we
can save a lot of decoder_get_command() calls.
2008-10-30 19:03:41 +01:00
Max Kellermann
f3b4a28518 ffmpeg: output buffer size cannot be negative
Converted the runtime check to an assertion.
2008-10-30 19:03:38 +01:00
Max Kellermann
130fc58b36 ffmpeg: break immediately after av_read_frame()
Remove one indent level.
2008-10-30 19:03:31 +01:00
Max Kellermann
5f1df0a927 ffmpeg: moved code to ffmpeg_send_frame()
Move code from ffmpeg_decode_internal() to make it smaller and more
readable.
2008-10-30 19:03:20 +01:00
Max Kellermann
048d62a628 ffmpeg: report seek errors to MPD
The decoder API provides the function decoder_seek_error() to report
seek errors.  Use this function instead of logging the error.
2008-10-30 19:02:38 +01:00
Max Kellermann
cd7a720426 ffmpeg: simplified mpdurl_read()
The function mpdurl_read() is too complicated, and uses the wrong data
types.
2008-10-30 19:02:01 +01:00
Max Kellermann
964442c5ad ffmpeg: call tag_free() instead of free()
tag objects must be freed with tag_free() to ensure that all resources
are freed.
2008-10-30 19:01:36 +01:00
Max Kellermann
25f4efcdb8 ffmpeg: eliminated local variable "tag"
The function ffmpeg_tag() already has the variable base.tag, which can
be used for this.
2008-10-30 19:01:31 +01:00
Max Kellermann
7cbd9821c6 ffmpeg: make ffmpeg_helper() return bool
ffmpeg_try_decode() did not interpret ffmpeg_helper()'s return value
properly; migrate everything to bool to make it consistent.
2008-10-30 19:01:23 +01:00
Max Kellermann
078d83ca13 ffmpeg: removed debug messages
We don't need those anymore, they just fill the log.
2008-10-30 19:01:18 +01:00
Max Kellermann
b180d0b47f ffmpeg: initialize base.decoder
ffmpeg_tag() did not initialize base.decoder, which made valgrind
unhappy, and can lead to a egmentation fault.
2008-10-30 18:08:52 +01:00
Max Kellermann
5f6383d68c mpc: provide 24 bit samples
Similar to libmad, libmpcdec provides samples with higher quality than
16 bit.  Send 24 bit samples to MPD, which allows MPD to apply
dithering just in case the output devices are only 16 bit capable.
2008-10-30 08:45:00 +01:00
Max Kellermann
0db07a920e mpc: moved sample size into a constant
Don't hard-code the "16 bits" or "2 bytes" in multiple locations.
2008-10-30 08:44:51 +01:00
Max Kellermann
6773dea5b0 mpc: renamed variable "s16" to "dest"
The name "s16" implies 16 bit integers.  To make the code more
generic, rename it to "dest".
2008-10-30 08:44:43 +01:00
Max Kellermann
51348d6992 mpc: fix broken integer sample conversion
The conversion of integer samples was completely broken, which
presumably didn't annoy anybody because libmpcdec provides float
samples on most installations.
2008-10-30 08:44:28 +01:00
Max Kellermann
ecd485acbd mpc: fix boolean interpretation of input_stream_seek()
When input_stream_seek() was converted to return a bool, this wasn't
adjusted in the musepack plugin.
2008-10-30 08:42:18 +01:00
Max Kellermann
62d4fa9306 decoder: use bool for return values and flags
Don't return 0/-1 on success/error, but true/false.  Instead of int,
use bool for storing flags.
2008-10-30 08:38:54 +01:00
Max Kellermann
d29bad4410 mp3: make mp3_read() return bool
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.
2008-10-30 06:09:28 +01:00
Max Kellermann
528b7c3f5e decoder: automatically flush the output buffer after decoder exits
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-29 17:29:06 +01:00
Max Kellermann
be90199c5a decoder_api: removed decoder_clear()
Call ob_clear() in decoder_command_finished() instead of implementing
that call in every decoder plugin.
2008-10-29 17:28:47 +01:00
Max Kellermann
d6c4441c78 mp3: seek in background
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.
2008-10-29 17:22:56 +01:00
Max Kellermann
de588448df mp3: return from mp3_synth_and_send() on any command
Previously, the function would only return when a STOP was issued.  It
makes more sense to consider all possible commands.
2008-10-29 16:17:21 +01:00
Max Kellermann
6158858f82 mp3: moved code to mp3_synth_and_send()
Break the large function mp3_read() into smaller pieces.
2008-10-29 16:14:08 +01:00
Max Kellermann
e0532ae0a8 mp3: moved code to mp3_send_pcm()
Break the large function mp3_read() into smaller pieces.
2008-10-29 16:14:02 +01:00
Max Kellermann
a6ad0e4047 mp3: moved code to mp3_update_timer_next_frame()
Break the large function mp3_read() into smaller pieces.
2008-10-29 16:13:51 +01:00
Max Kellermann
0d079ee515 mp3: moved code to mp3_this_frame_offset()
Break the large function mp3_read() into smaller pieces.
2008-10-29 16:13:01 +01:00
Max Kellermann
a6f8776c94 mp3: moved code to mp3_time_to_frame()
Break the large function mp3_read() into smaller pieces.
2008-10-29 16:12:26 +01:00
Max Kellermann
ec3083948f mp3: assert that the stream is seekable
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.
2008-10-29 16:11:16 +01:00
Max Kellermann
a0b57f3782 mp3: moved code to mp3_filesize_to_song_length()
The function mp3_decode_first_frame() is too large.  Move some code to
separate smaller functions.
2008-10-28 20:44:08 +01:00
Max Kellermann
898978a67d mp3: no "goto"
http://xkcd.com/292/
2008-10-28 20:43:17 +01:00
Max Kellermann
28b47725ff mp3: use GLib allocation functions
This removes the need for util.h.
2008-10-28 20:43:15 +01:00
Max Kellermann
56ebdf1cd1 mp3: use bool
Use the C99 bool data type for boolean values.
2008-10-28 20:42:33 +01:00
Max Kellermann
e4bbc120ac mp3: no CamelCase
Renamed all functions and variables.  Also removed the mp3DecodeData
typedef.
2008-10-28 20:42:01 +01:00
Max Kellermann
1f7c53e619 mp3: remove obsolete comments 2008-10-28 20:41:25 +01:00
Max Kellermann
0a61877702 input_stream: convert offset and size to the off_t data type
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.
2008-10-28 20:39:09 +01:00
Max Kellermann
016d996131 utils: use g_str_has_prefix() instead of prefixcmp()
Remove duplicated code from MPD.
2008-10-28 20:33:56 +01:00
Max Kellermann
5c19776f2f input_stream: use "bool" instead of "int"
For boolean values and success flags, use bool instead of integer (1/0
for true/false, 0/-1 for success/failure).
2008-10-26 20:56:46 +01:00
Max Kellermann
dbc7e9ba2f input_stream: no CamelCase
Renamed all functions and variables.
2008-10-26 20:34:47 +01:00
Max Kellermann
21b8590b53 input_stream: removed the InputStream typedef
Everybody should use struct input_stream.
2008-10-26 19:54:57 +01:00
Max Kellermann
e11355f47d renamed src/inputPlugins/ to src/decoder/
These plugins are not input plugins, they are decoder plugins.  No
CamelCase in the directory name.
2008-10-26 11:29:25 +01:00