From ca7b4df812b8109911deb1e694fbea039f9818f5 Mon Sep 17 00:00:00 2001 From: Max Kellermann <max@musicpd.org> Date: Thu, 7 Sep 2017 14:21:40 +0200 Subject: [PATCH 1/4] doc/user: document the Opus encoder --- doc/user.xml | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/doc/user.xml b/doc/user.xml index c5c7d341b..e010d5e3e 100644 --- a/doc/user.xml +++ b/doc/user.xml @@ -2991,6 +2991,60 @@ run</programlisting> </informaltable> </section> + <section id="opus_encoder"> + <title><varname>opus</varname></title> + + <para> + Encodes into <ulink + url="http://www.opus-codec.org/">Ogg Opus</ulink>. + </para> + + <informaltable> + <tgroup cols="2"> + <thead> + <row> + <entry>Setting</entry> + <entry>Description</entry> + </row> + </thead> + <tbody> + <row> + <entry> + <varname>bitrate</varname> + </entry> + <entry> + Sets the data rate in bit per second. The special + value "auto" lets <application>libopus</application> + choose a rate (which is the default), and "max" uses + the maximum possible data rate. + </entry> + </row> + + <row> + <entry> + <varname>complexity</varname> + </entry> + <entry> + Sets the <ulink + url="https://wiki.xiph.org/OpusFAQ#What_is_the_complexity_of_Opus.3F">Opus + complexity</ulink>. + </entry> + </row> + + <row> + <entry> + <varname>signal</varname> + </entry> + <entry> + Sets the Opus signal type. Valid values are "auto" + (the default), "voice" and "music". + </entry> + </row> + </tbody> + </tgroup> + </informaltable> + </section> + <section id="vorbis_encoder"> <title><varname>vorbis</varname></title> From b253a6b71e4aaecfe8f2326b6e5b1c32d93fc83c Mon Sep 17 00:00:00 2001 From: Charlie Waters <cawiii@me.com> Date: Mon, 18 Sep 2017 01:44:47 -0400 Subject: [PATCH 2/4] ffmpeg plugin: when decoded stream duration is unavailable, attempt fallback to container duration (fix MusicPlayerDaemon/MPD#110) --- NEWS | 2 ++ src/decoder/plugins/FfmpegDecoderPlugin.cxx | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index a62ed71d1..4857d2cda 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,8 @@ ver 0.20.11 (not yet released) * storage - curl: support Content-Type application/xml +* decoder + - ffmpeg: more reliable song duration ver 0.20.10 (2017/08/24) * decoder diff --git a/src/decoder/plugins/FfmpegDecoderPlugin.cxx b/src/decoder/plugins/FfmpegDecoderPlugin.cxx index 75038e694..aba96886d 100644 --- a/src/decoder/plugins/FfmpegDecoderPlugin.cxx +++ b/src/decoder/plugins/FfmpegDecoderPlugin.cxx @@ -712,7 +712,9 @@ FfmpegDecode(DecoderClient &client, InputStream &input, #endif const SignedSongTime total_time = - FromFfmpegTimeChecked(av_stream.duration, av_stream.time_base); + av_stream.duration != (int64_t)AV_NOPTS_VALUE + ? FromFfmpegTimeChecked(av_stream.duration, av_stream.time_base) + : FromFfmpegTimeChecked(format_context.duration, AV_TIME_BASE_Q); client.Ready(audio_format, input.IsSeekable(), total_time); @@ -842,6 +844,10 @@ FfmpegScanStream(AVFormatContext &format_context, tag_handler_invoke_duration(handler, handler_ctx, FromFfmpegTime(stream.duration, stream.time_base)); + else if (format_context.duration != (int64_t)AV_NOPTS_VALUE) + tag_handler_invoke_duration(handler, handler_ctx, + FromFfmpegTime(format_context.duration, + AV_TIME_BASE_Q)); FfmpegScanMetadata(format_context, audio_stream, handler, handler_ctx); From 6c8d86bb9097a117de5f2c4dc7d10b1f981d9018 Mon Sep 17 00:00:00 2001 From: Max Kellermann <max@musicpd.org> Date: Tue, 19 Sep 2017 18:49:33 +0200 Subject: [PATCH 3/4] output/sndio: rename the "sio_hdl" variable to avoid clash with struct name --- src/output/plugins/SndioOutputPlugin.cxx | 32 +++++++++++------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/src/output/plugins/SndioOutputPlugin.cxx b/src/output/plugins/SndioOutputPlugin.cxx index b0050d6ae..4f5df4981 100644 --- a/src/output/plugins/SndioOutputPlugin.cxx +++ b/src/output/plugins/SndioOutputPlugin.cxx @@ -50,7 +50,7 @@ class SndioOutput { AudioOutput base; const char *const device; const unsigned buffer_time; /* in ms */ - struct sio_hdl *sio_hdl; + struct sio_hdl *hdl; public: SndioOutput(const ConfigBlock &block); @@ -80,16 +80,14 @@ SndioOutput::Create(const ConfigBlock &block) static bool sndio_test_default_device() { - struct sio_hdl *sio_hdl; - - sio_hdl = sio_open(SIO_DEVANY, SIO_PLAY, 0); - if (!sio_hdl) { + auto *hdl = sio_open(SIO_DEVANY, SIO_PLAY, 0); + if (!hdl) { FormatError(sndio_output_domain, "Error opening default sndio device"); return false; } - sio_close(sio_hdl); + sio_close(hdl); return true; } @@ -99,8 +97,8 @@ SndioOutput::Open(AudioFormat &audio_format) struct sio_par par; unsigned bits, rate, chans; - sio_hdl = sio_open(device, SIO_PLAY, 0); - if (!sio_hdl) + hdl = sio_open(device, SIO_PLAY, 0); + if (!hdl) throw std::runtime_error("Failed to open default sndio device"); switch (audio_format.format) { @@ -130,9 +128,9 @@ SndioOutput::Open(AudioFormat &audio_format) par.le = SIO_LE_NATIVE; par.appbufsz = rate * buffer_time / 1000; - if (!sio_setpar(sio_hdl, &par) || - !sio_getpar(sio_hdl, &par)) { - sio_close(sio_hdl); + if (!sio_setpar(hdl, &par) || + !sio_getpar(hdl, &par)) { + sio_close(hdl); throw std::runtime_error("Failed to set/get audio params"); } @@ -142,12 +140,12 @@ SndioOutput::Open(AudioFormat &audio_format) par.pchan != chans || par.sig != 1 || par.le != SIO_LE_NATIVE) { - sio_close(sio_hdl); + sio_close(hdl); throw std::runtime_error("Requested audio params cannot be satisfied"); } - if (!sio_start(sio_hdl)) { - sio_close(sio_hdl); + if (!sio_start(hdl)) { + sio_close(hdl); throw std::runtime_error("Failed to start audio device"); } } @@ -155,7 +153,7 @@ SndioOutput::Open(AudioFormat &audio_format) void SndioOutput::Close() { - sio_close(sio_hdl); + sio_close(hdl); } size_t @@ -163,8 +161,8 @@ SndioOutput::Play(const void *chunk, size_t size) { size_t n; - n = sio_write(sio_hdl, chunk, size); - if (n == 0 && sio_eof(sio_hdl) != 0) + n = sio_write(hdl, chunk, size); + if (n == 0 && sio_eof(hdl) != 0) throw std::runtime_error("sndio write failed"); return n; } From 75c740fe2b6864a0105c82ec76470a794ca8e317 Mon Sep 17 00:00:00 2001 From: Max Kellermann <max@musicpd.org> Date: Tue, 19 Sep 2017 18:50:18 +0200 Subject: [PATCH 4/4] output/sndio: fix indent --- src/output/plugins/SndioOutputPlugin.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/output/plugins/SndioOutputPlugin.cxx b/src/output/plugins/SndioOutputPlugin.cxx index 4f5df4981..699f62571 100644 --- a/src/output/plugins/SndioOutputPlugin.cxx +++ b/src/output/plugins/SndioOutputPlugin.cxx @@ -83,7 +83,7 @@ sndio_test_default_device() auto *hdl = sio_open(SIO_DEVANY, SIO_PLAY, 0); if (!hdl) { FormatError(sndio_output_domain, - "Error opening default sndio device"); + "Error opening default sndio device"); return false; }