Max Kellermann
2b9246c6ad
decoder/ffmpeg: use avcodec_send_packet() and avcodec_receive_frame() on FFmpeg 3.1
2016-07-29 09:20:05 +02:00
Max Kellermann
a9edb4de28
decoder/ffmpeg: use AtScopeExit() for safe cleanup
2016-07-29 09:08:14 +02:00
Max Kellermann
a076ddf38c
util/ScopeExit: new utility library
...
Similar to boost::scope_exit, but fewer include dependencies.
2016-07-29 09:07:58 +02:00
Max Kellermann
cafc266e0b
decoder/ffmpeg: merge avformat_close_input() calls
2016-07-28 20:38:07 +02:00
Max Kellermann
a3d020eff9
decoder/ffmpeg: use AVCodecParameters on FFmpeg 3.1
...
The AVCodecContext attribute is deprecated.
2016-07-28 19:50:25 +02:00
Max Kellermann
8412d94d05
decoder/ffmpeg: add GetCodecParameters()
...
Preparing for FFmpeg 3.1 support.
2016-07-28 19:49:47 +02:00
Max Kellermann
d1c5bb956a
decoder/ffmpeg: move code to IsAudio()
2016-07-28 19:49:45 +02:00
Max Kellermann
70986bc120
decoder/ffmpeg: move code to FfmpegSendFrame()
2016-07-28 19:49:18 +02:00
Max Kellermann
f31fe8b865
decoder/ffmpeg: include cleanup
2016-07-28 19:49:17 +02:00
Max Kellermann
142a9fe530
decoder/ffmpeg: move code to pcm/Interleave.cxx
2016-07-28 19:49:13 +02:00
Max Kellermann
4dd2ad9b27
decoder/ffmpeg: check for commands earlier
...
Improve initial seek by not reading/decoding the first frame before
checking for the seek command.
2016-07-28 19:48:27 +02:00
Max Kellermann
62f7375804
decoder/ffmpeg: simplify mpd_ffmpeg_open_input()
2016-07-28 19:48:25 +02:00
Max Kellermann
543296b5ba
decoder/ffmpeg: move code to lib/ffmpeg/Init.cxx
2016-07-28 19:48:22 +02:00
Max Kellermann
5fee130d00
decoder/ffmpeg: move code to lib/ffmpeg/LogCallback.cxx
2016-07-28 19:47:49 +02:00
Max Kellermann
073facea70
decoder/ffmpeg: remove obsolete comment
2016-07-28 19:47:47 +02:00
Max Kellermann
dbe3b6eee4
decoder/ffmpeg: convert enums to constexpr
2016-07-28 19:47:36 +02:00
Max Kellermann
df97049647
decoder/ffmpeg: move struct AvioStream to FfmpegIo.hxx
2016-07-28 19:47:31 +02:00
Max Kellermann
42c5f68362
decoder/ffmpeg: use AVStream::duration
...
Use the duration of the stream we're actually decoding - not the
"global" attribute AVFormatContext::duration which may differ.
2016-07-28 19:47:24 +02:00
Max Kellermann
cc19e760cf
decoder/ffmpeg: use more references
2016-07-28 19:45:22 +02:00
Max Kellermann
0ff22a16fa
decoder/ffmpeg: move code to lib/ffmpeg/Time.hxx
2016-07-28 19:45:11 +02:00
Max Kellermann
47360ec906
decoder/ffmpeg: use av_free() instead of av_freep()
2016-07-28 19:45:07 +02:00
Max Kellermann
087a9938d2
decoder/ffmpeg: add API documentation
2016-07-28 19:45:05 +02:00
Max Kellermann
26d8e41a6b
decoder/ffmpeg: copy_interleave_frame() returns ConstBuffer
2016-07-28 19:45:01 +02:00
Max Kellermann
750ae1d3f3
decoder/ffmpeg: copy_interleave_frame() returns Error
2016-07-28 19:44:42 +02:00
Max Kellermann
f8a9a7a108
decoder/ffmpeg: simplify ffmpeg_send_packet()
2016-07-28 19:44:39 +02:00
Max Kellermann
eb192137d6
decoder/ffmpeg: copy the AVPacket in ffmpeg_send_packet()
...
Revert commit 70495aad
by rewriting it. Turns out, in old FFmpeg
versions, copying the AVPacket is necessary.
2016-07-28 19:42:25 +02:00
Max Kellermann
c25b464f37
decoder/ffmpeg: move code to class FfmpegBuffer
2016-07-27 17:31:02 +02:00
Max Kellermann
710b48d410
decoder/ffmpeg: log detailed error message
2016-07-27 17:28:12 +02:00
Max Kellermann
5e77a8199d
decoder/ffmpeg: remove obsolete comment
2016-07-27 17:28:12 +02:00
Max Kellermann
6637db086b
decoder/ffmpeg: add "pure" attributes
2016-07-27 17:28:12 +02:00
Max Kellermann
a271a55da7
decoder/ffpmeg: make variables more local
2016-07-27 17:28:12 +02:00
Max Kellermann
6eeec6cbfa
decoder/ffpmeg: simplify ffmpeg_send_packet()
2016-07-27 17:22:13 +02:00
Max Kellermann
5e3f3b0400
decoder/ffpmeg: rename functions to CamelCase
2016-07-27 17:18:58 +02:00
Max Kellermann
923c402f69
decoder/ffmpeg: optimize ffmpeg_scan_dictionary()
...
Don't scan tag items if the handler doesn't implement the tag()
method.
2016-07-27 17:17:14 +02:00
Max Kellermann
ab95027fc6
decoder/flac: suppress warning at end of stream
...
This is required if a stream ands without another chained FLAC file.
2016-07-08 23:19:47 +02:00
Max Kellermann
ed3bc4ab63
decoder/flac: move code to FlacInitAndDecode()
2016-07-08 23:03:49 +02:00
Max Kellermann
68064f1aa6
decoder/flac: move duplicate code to flac_data::Initialize()
2016-07-08 22:44:23 +02:00
Max Kellermann
475ac76a5f
decoder/flac: late "total_frames" initialization
2016-07-08 22:43:31 +02:00
Max Kellermann
79d4f8674c
decoder/flac: remove "duration" parameter from flac_decoder_initialize()
...
It's always 0.
2016-07-08 22:41:19 +02:00
Max Kellermann
e42eed4d4c
decoder/flac: remove pointless check
2016-07-08 22:41:19 +02:00
Max Kellermann
4a7042e847
decoder/flac: handle unknown duration correctly
...
If the duration is unknown, pass SignedSongTime::Negative(), as
documented for decoder_initialized().
2016-07-08 22:33:49 +02:00
Max Kellermann
7f36923eb4
decoder/flac: pass SignedSongTime to decoder_initialized()
2016-07-08 22:32:23 +02:00
Max Kellermann
2ca8d69126
decoder/flac: document flac_data::position
2016-07-08 22:20:16 +02:00
Max Kellermann
70367d70c8
decoder/flac: remove obsolete sub-song support
...
This is obsolete because it has been moved to the MPD core.
2016-07-08 21:59:30 +02:00
Max Kellermann
e6389ff5a1
client/ClientRead: call Break() before Close()
...
Referencing the attribute "partition" is illegal after Close(),
because Close() deletes "this".
2016-07-07 13:54:04 +02:00
Max Kellermann
b46cf57d98
event/BufferedSocket: OnSocketReady() returns true after close
...
Fixes use-after-free bug (https://bugs.musicpd.org/view.php?id=4548 ).
2016-07-07 13:52:20 +02:00
Max Kellermann
6f59d71e07
decoder/API: check initial_seek_running in _check_cancel_read()
...
The "seeking" flag is not set for the initial seek, and so
decoder_read() could be canceled when another SEEK was emitted during
initial seek.
This fixes several seek problems, for example the one reported for the
FLAC decoder plugin:
https://bugs.musicpd.org/view.php?id=4552
2016-07-06 15:46:04 +02:00
Max Kellermann
f9130f42a2
decoder/flac: try to recover from seek error()
...
libFLAC API documentation suggests that FLAC__stream_decoder_flush()
should be called to recover from FLAC__STREAM_DECODER_SEEK_ERROR.
2016-07-05 19:29:56 +02:00
Max Kellermann
faf2eeaa99
decoder/flac: evaluate all possible FLAC__stream_decoder_get_state() values
...
Stop after all fatal errors. This fixes assertion failures in
libFLAC.
2016-07-05 19:27:40 +02:00
Max Kellermann
1c7de0b4ac
output/shout: remove pointless memset() call
2016-07-05 18:02:35 +02:00
Max Kellermann
58487e484f
filter/route: use PcmSilence()
2016-07-05 18:01:29 +02:00
Max Kellermann
104075f3e0
PlayerThread: use PcmSilence() in SendSilence()
...
No change for regular PCM, but DSD uses 0x69 now.
2016-07-05 18:01:29 +02:00
Max Kellermann
b8097eaf2e
pcm/Volume: move silence pattern to Silence.cxx
2016-07-05 17:52:53 +02:00
Max Kellermann
5eb0cbc887
PlayerThread: make chunk allocation error non-fatal in SendSilence()
...
Fixes abort after seeking on fast machines.
2016-07-05 17:44:45 +02:00
Max Kellermann
ba8e579e9b
pcm/Volume: use 0x69 to generate DSD silence
2016-07-01 21:22:21 +02:00
Max Kellermann
072e39c9cf
filter/ReplayGain: skip PcmVolume if a mixer is set
...
Previously, volume was applied twice: once by PcmVolume, and again by
the hardware mixer.
2016-07-01 21:17:52 +02:00
Max Kellermann
4ecd325371
decoder/flac: log seek errors
2016-06-13 18:37:45 +02:00
Max Kellermann
5771d67202
player/Thread: cancel outputs before seeking
...
.. instead of doing it after seeking. After seeking, the command had
no effect, because CheckDecoderStartup() waits for all outputs to
finish. This caused a very long delay while seeking and switching
songs (https://bugs.musicpd.org/view.php?id=4534 ).
2016-06-13 09:13:56 +02:00
Max Kellermann
c9553411bb
encoder/wave: add constant WAVE_FORMAT_PCM
2016-04-30 13:57:09 +02:00
Max Kellermann
62221adf55
encoder/wave: fix indent
2016-04-30 13:45:52 +02:00
Florian Schlichting
27d4b15925
DecoderBuffer: add missing include
...
> In file included from src/decoder/DecoderBuffer.cxx:21:0:
> src/decoder/DecoderBuffer.hxx:41:20: error: 'uint8_t' was not declared in this scope
> DynamicFifoBuffer<uint8_t> buffer;
> ^
> src/decoder/DecoderBuffer.hxx:41:27: error: template argument 1 is invalid
> DynamicFifoBuffer<uint8_t> buffer;
> ^
> src/decoder/DecoderBuffer.hxx: In member function 'void DecoderBuffer::Clear()':
> src/decoder/DecoderBuffer.hxx:61:10: error: request for member 'Clear' in '((DecoderBuffer*)this)->DecoderBuffer::buffer', which is of non-class type 'int'
> buffer.Clear();
> ^
> src/decoder/DecoderBuffer.hxx: In member function 'size_t DecoderBuffer::GetAvailable() const':
> src/decoder/DecoderBuffer.hxx:78:17: error: request for member 'GetAvailable' in '((const DecoderBuffer*)this)->DecoderBuffer::buffer', which is of non-class type 'const int'
> return buffer.GetAvailable();
> ^
> src/decoder/DecoderBuffer.hxx: In member function 'ConstBuffer<void> DecoderBuffer::Read() const':
> src/decoder/DecoderBuffer.hxx:87:19: error: request for member 'Read' in '((const DecoderBuffer*)this)->DecoderBuffer::buffer', which is of non-class type 'const int'
> auto r = buffer.Read();
> ^
> src/decoder/DecoderBuffer.hxx:88:27: error: could not convert '{<expression error>, <expression error>}' from '<brace-enclosed initializer list>' to 'ConstBuffer<void>'
> return { r.data, r.size };
> ^
> src/decoder/DecoderBuffer.hxx: In member function 'void DecoderBuffer::Consume(size_t)':
> src/decoder/DecoderBuffer.hxx:105:10: error: request for member 'Consume' in '((DecoderBuffer*)this)->DecoderBuffer::buffer', which is of non-class type 'int'
> buffer.Consume(nbytes);
> ^
This seems to be caused by a lacking include, fixed by the below patch.
I'm unsure what made this appear now, though, compiler and toolchain
libraries seem to be the same upstream versions that built 0.19.14-1
just fine in late March.
2016-04-25 08:30:27 +02:00
Max Kellermann
c731a82b71
decoder/opus: limit the number of packets in _scan_stream()
2016-04-19 13:08:07 +02:00
Max Kellermann
e6fad97edc
decoder/opus: support bigger OpusTags packets
...
Required for OpusTags packets which contain artwork.
See https://bugs.musicpd.org/view.php?id=4520
2016-04-19 13:05:42 +02:00
Max Kellermann
70495aada1
decoder/ffmpeg: don't copy the AVPacket in ffmpeg_send_packet()
...
Reduce some overhead. It is not necessary to copy the object.
2016-04-13 09:04:51 +02:00
Max Kellermann
f243f615ef
decoder/ffmpeg: convert pointers to references
2016-04-13 09:01:54 +02:00
Max Kellermann
807c72b2f1
decoder/ffmpeg: use av_packet_unref() instead of av_free_packet()
...
av_free_packet() was deprecated in FFmpeg 3.0.
2016-04-12 21:15:05 +02:00
Max Kellermann
74dbaade6f
decoder/Thread: use "ffmpeg" as fallback instead of "mad"
...
Adds support for stream codecs which havn't been explicitly listed in
ffmpeg_mime_types.
2016-03-30 00:58:48 +02:00
Max Kellermann
53677172f2
notify: use "constexpr" only with glibc
...
The Mutex and Cond constructors are only "constexpr" with glibc, and
this is what this #ifdef is about.
Backport of commit 459a812a
See http://bugs.musicpd.org/view.php?id=4511
2016-03-30 00:31:01 +02:00
Max Kellermann
a3afd5178c
tag/TagPool: optimize _dup_item()
...
When a reference counter is at its limit, don't allocate a new
TagPoolSlot - that would result in many TagPoolSlot instances with
ref==1. This in turn would make the linked list very very large,
which means quadratic runtime for many operations.
2016-03-14 13:08:04 +01:00
Max Kellermann
f1285a6dfd
tag/TagPool: add constexpr MAX_REF
2016-03-14 08:07:22 +01:00
Max Kellermann
cf7c1afb93
tag/TagPool: use prime number for NUM_SLOTS
2016-03-14 08:04:51 +01:00
Max Kellermann
e140a28073
archive/iso9660: check path buffer bounds
2016-03-07 14:21:01 +01:00
Max Kellermann
de61c3b962
archive/iso9660: use a single path buffer for Visit()
...
Avoid wasting 4 kB stack per directory level.
2016-03-07 14:01:52 +01:00
Max Kellermann
c46fc4531b
archive/iso9660: move the "." and ".." checks up
2016-03-07 14:01:40 +01:00
Max Kellermann
065a9ed10f
archive/iso9660: add local variable "filename"
2016-03-07 13:57:07 +01:00
Max Kellermann
e44c0254f7
archive/iso9660: make variables more local
2016-03-07 13:15:07 +01:00
Max Kellermann
13f9f0315f
util/HugeAllocator: fix division by zero due to inverted check
...
There were two ways this could fail:
1. division by zero when sysconf(_SC_PAGESIZE)==0
2. mmap() failure because the size parameter is not aligned to page
size
Neither ever happened: sysconf() never fails, and the only caller
passes a size that is already aligned. Phew.
2016-03-06 23:53:41 +01:00
Max Kellermann
1532ffe215
protocol/ArgParser: fix range check
...
The old check
unsigned(value) > std::numeric_limits<unsigned>::max()
.. cannot ever fail.
2016-03-06 23:41:08 +01:00
Max Kellermann
b24cbc68ba
decoder/dsdiff: fix off-by-one buffer overflow
2016-03-06 23:28:29 +01:00
Max Kellermann
976fdd76c1
decoder/opus: limit tag size to 64 kB
2016-03-06 23:26:48 +01:00
Max Kellermann
bbda335e02
mixer/pulse: fix integer division rounding
2016-03-06 23:23:30 +01:00
Max Kellermann
d2dd6f7c70
thread/Posix{Mutex,Cond}: use "constexpr" only with glibc
...
Apparently all other C libraries are not compatible with "constexpr".
Those which are not will get a performance penalty, but at least they
work at all.
2016-03-01 21:23:59 +01:00
Max Kellermann
39fa949345
queue/Playlist: move only the tag items in TagModified()
...
Fixes disappearing duration of remote songs during playback.
See http://bugs.musicpd.org/view.php?id=4492
2016-02-23 21:01:55 +01:00
Max Kellermann
e1d7a5cbf5
DetachedSong: add method MoveTagItemsFrom()
2016-02-23 20:59:44 +01:00
Max Kellermann
f3cefaf043
tag/Tag: move code to MoveItemsFrom()
2016-02-23 20:57:56 +01:00
Max Kellermann
b3460f3f54
configure.ac, unix/Daemon: check for initgroups() at configure time
...
The initgroups() manpage says we need to check for _BSD_SOURCE. The
thing is that glibc deprecated this macro, and doesn't define it
anymore, effectively breaking all MPD supplementary groups.
The real fix is to check for initgroups() availability at configure
time, instead of relying on the deprecated _BSD_SOURCE macro.
2016-02-23 20:13:34 +01:00
Chris Spiegel
1e0ad1f6bf
Add TAK as a supported FFmpeg format.
2016-02-19 17:32:48 +01:00
Max Kellermann
4abcb08cc9
tag/{aiff,riff}: fix ID3 chunk padding
...
Apply padding only to the fseek(), not to the chunk size. This fixes
bogus "failed to read riff chunk" messages when the last chunk has an
odd size.
See http://bugs.musicpd.org/view.php?id=4486
2016-02-19 17:31:20 +01:00
Benno Fünfstück
cae2811762
fix mpd crash on invalid utf8 stream title
2015-12-15 21:49:53 +01:00
Michael Paquier
315f9d98f6
Main: fix build failure on non-Linux systems
2015-11-10 08:38:53 +01:00
Max Kellermann
5719207dfa
gme: don't loop forever, fall back to GME's default play length
...
Fixes http://bugs.musicpd.org/view.php?id=4432
2015-10-26 17:16:20 +01:00
Max Kellermann
a84fbbe327
decoder/gme: free the gme_info_t as early as possible
2015-10-26 17:15:24 +01:00
Max Kellermann
93c97972b9
decoder/gme: call decoder_seek_error() on seek error
2015-10-26 16:32:39 +01:00
Max Kellermann
ac61d43720
output/Command: flush the mixer cache when enabling/disabling output
...
Fixes mixer lag (http://bugs.musicpd.org/view.php?id=4425 ).
2015-10-26 16:29:07 +01:00
Max Kellermann
1958f78cc1
decoder/ffmpeg: fix crash due to wrong avio_alloc_context() call
...
Allocate the buffer dynamically using av_malloc(), and free
AVIOContext.buffer in the destructor, as mandated by the libavformat
documentation.
Fixes http://bugs.musicpd.org/view.php?id=4446
2015-10-26 13:06:29 +01:00
Max Kellermann
a7ee64a25b
decoder/mpcdec: use SampleTraits<SampleFormat::S24_P32>
...
Eliminates some duplicate code, and as a side effect, this works
around clang 3.8 compiler warning because a negative value was
shifted.
2015-10-16 18:12:32 +02:00
Max Kellermann
2a58f22649
decoder/mpcdec: use Clamp()
2015-10-16 18:11:42 +02:00
Max Kellermann
f066bb7716
unix/Daemon, playlist/...: remove unused Domain variables
2015-10-16 18:08:59 +02:00
Max Kellermann
4e3d182189
encoder/flac: fix crash with 32 bit playback
...
Copy to encoder->audio_format *after* adjusting the sample format to
S24_P32.
Fixes http://bugs.musicpd.org/view.php?id=4433
2015-10-16 18:05:34 +02:00
Max Kellermann
205fba74cf
tag/ApeLoader: fix buffer overflow after unterminated key
2015-10-16 14:55:40 +02:00