[Musicpd-dev-team] [PATCH 2/2] decoder/modplug: Add loop_count parameter

2013-10-19 Thread Sebastian Thorarensen
The loop_count configuration parameter allows the user to set how
many times a module with backward loops shall loop. 0 (the default)
means a module is not allowed to use backward loops at all. -1
enables inifinite looping.
---
 NEWS |  1 +
 doc/user.xml | 31 +++
 src/decoder/ModplugDecoderPlugin.cxx | 17 -
 3 files changed, 48 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index 1b575dd..c66d91e 100644
--- a/NEWS
+++ b/NEWS
@@ -18,6 +18,7 @@ ver 0.18 (2012/??/??)
   - opus: new decoder plugin for the Opus codec
   - vorbis: skip 16 bit quantisation, provide float samples
   - mikmod: add loop configuration parameter
+  - modplug: add loop_count configuration parameter
   - mp4ff: obsolete plugin removed
 * encoder:
   - opus: new encoder plugin for the Opus codec
diff --git a/doc/user.xml b/doc/user.xml
index b3ab8d4..cebc4ca 100644
--- a/doc/user.xml
+++ b/doc/user.xml
@@ -1001,6 +1001,37 @@ systemctl start mpd.socket/programlisting
   /section
 
   section
+titlevarnamemodplug/varname/title
+
+para
+  Module player based on MODPlug.
+/para
+
+informaltable
+  tgroup cols=2
+thead
+  row
+entrySetting/entry
+entryDescription/entry
+  /row
+/thead
+tbody
+  row
+entry
+  varnameloop_count/varname
+/entry
+entry
+  Number of times to loop the module if it uses backward loops.
+  Default is parameter0/parameter which prevents looping.
+  parameter-1/parameter loops forever.
+/entry
+  /row
+/tbody
+  /tgroup
+/informaltable
+  /section
+
+  section
 titlevarnamewildmidi/varname/title
 
 para
diff --git a/src/decoder/ModplugDecoderPlugin.cxx 
b/src/decoder/ModplugDecoderPlugin.cxx
index 6856753..e3779a6 100644
--- a/src/decoder/ModplugDecoderPlugin.cxx
+++ b/src/decoder/ModplugDecoderPlugin.cxx
@@ -22,6 +22,7 @@
 #include DecoderAPI.hxx
 #include InputStream.hxx
 #include tag/TagHandler.hxx
+#include system/FatalError.hxx
 #include util/Domain.hxx
 #include Log.hxx
 
@@ -38,6 +39,19 @@ static constexpr size_t MODPLUG_PREALLOC_BLOCK = 256 * 1024;
 static constexpr size_t MODPLUG_READ_BLOCK = 128 * 1024;
 static constexpr input_stream::offset_type MODPLUG_FILE_LIMIT = 100 * 1024 * 
1024;
 
+static int modplug_loop_count;
+
+static bool
+modplug_decoder_init(const config_param param)
+{
+   modplug_loop_count = param.GetBlockValue(loop_count, 0);
+   if (modplug_loop_count  -1)
+   FormatFatalError(Invalid loop count in line %d: %i,
+param.line, modplug_loop_count);
+
+   return true;
+}
+
 static GByteArray *
 mod_loadfile(struct decoder *decoder, struct input_stream *is)
 {
@@ -114,6 +128,7 @@ mod_decode(struct decoder *decoder, struct input_stream *is)
settings.mChannels = 2;
settings.mBits = 16;
settings.mFrequency = 44100;
+   settings.mLoopCount = modplug_loop_count;
/* insert more setting changes here */
ModPlug_SetSettings(settings);
 
@@ -192,7 +207,7 @@ static const char *const mod_suffixes[] = {
 
 const struct decoder_plugin modplug_decoder_plugin = {
modplug,
-   nullptr,
+   modplug_decoder_init,
nullptr,
mod_decode,
nullptr,
-- 
1.8.1.5

--
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register 
http://pubads.g.doubleclick.net/gampad/clk?id=60135031iu=/4140/ostg.clktrk
___
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team


[Musicpd-dev-team] [PATCH 0/2] decoder/modplug: Add loop_count parameter

2013-10-19 Thread Sebastian Thorarensen
Hi again,

This is a set of patches similiar to the patch I sent for the Mikmod
decoder. It adds a configuration parameter called loop_count for the
Modplug decoder, which allows the user to set how many times the decoder
should loop modules which uses backward loops.

Mikmod only allows for disabling and enabling backward loops, but Modplug
can set a limit on the number of loops, a nice feature.

The patch for ConfigData is to enable signed integers in the
configuration, so that the user can set loop_count to -1, which
gives infinite looping.

Please consider applying these patches as well :)

Sebastian Thorarensen (2):
  ConfigData: Add support for signed integers
  decoder/modplug: Add loop_count parameter

 NEWS |  1 +
 doc/user.xml | 31 +++
 src/ConfigData.cxx   | 21 +++--
 src/ConfigData.hxx   |  6 ++
 src/decoder/ModplugDecoderPlugin.cxx | 17 -
 5 files changed, 73 insertions(+), 3 deletions(-)

-- 
1.8.1.5

--
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register 
http://pubads.g.doubleclick.net/gampad/clk?id=60135031iu=/4140/ostg.clktrk
___
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team


Re: [Musicpd-dev-team] Tags in OGG httpd stream

2013-10-19 Thread Max Kellermann
On 2013/10/11 05:12, Ben Boeckel maths...@gmail.com wrote:
 the tag chunk is dropped because chunk-length is 0 for it. A patch
 which fixes the issue is attached.

Merged, thanks.  Sorry for letting you wait for so long.

--
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register 
http://pubads.g.doubleclick.net/gampad/clk?id=60135031iu=/4140/ostg.clktrk
___
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team


Re: [Musicpd-dev-team] Tags in OGG httpd stream

2013-10-19 Thread Ben Boeckel
On Sat, Oct 19, 2013 at 15:47:25 +0200, Max Kellermann wrote:
 On 2013/10/11 05:12, Ben Boeckel maths...@gmail.com wrote:
  the tag chunk is dropped because chunk-length is 0 for it. A patch
  which fixes the issue is attached.
 
 Merged, thanks.  Sorry for letting you wait for so long.

Thanks! No problem; I'm getting other patches through to get these tags
visible on the player end too (ffmpeg and mpv need patched; mplayer had
its own ogg decoder); quite the adventure!

--Ben

--
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register 
http://pubads.g.doubleclick.net/gampad/clk?id=60135031iu=/4140/ostg.clktrk
___
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team


Re: [Musicpd-dev-team] ProxyDatabase plugin

2013-10-19 Thread Max Kellermann
On 2013/10/11 16:26, j...@dockes.org wrote:
 
 Hi,
 
 I have fleshed out the code inside ProxyDatabasePlugin.cpp so that it
 now works.

Your patch is hard to read because it's all in one big undocumented
chunk.  Please split the patch into smaller pieces and document the
API changes.

--
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register 
http://pubads.g.doubleclick.net/gampad/clk?id=60135031iu=/4140/ostg.clktrk
___
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team


Re: [Musicpd-dev-team] YouTube support plugin

2013-10-19 Thread Max Kellermann
On 2013/10/12 16:38, Oleg Omelyusik oleg.omelyu...@gmail.com wrote:
 Hello everyone,
 
 I've started implementing YouTube (and maybe some other same services in
 future) support plugin.
 (I saw feature request on MPD's bugtracker which were submitted a year ago
 http://bugs.musicpd.org/view.php?id=3598).
 
 At this moment valid title isn't displayed in the playlist (there is just a
 video url) and a user can't
 choose quality of the video.Work with YouTube implemented in the separate
 library (you can it find
 here: http://github.com/oleg-omelyusik/GSSlib).

Your library fails to build:

 gcc -c -Wall -Wextra -MMD  tools/test.c -o tools/test.o
 tools/test.c:4:17: fatal error: gss.h: No such file or directory

Installation is cumbersome, because the install target requires be
to override both LIBDIR and INCLUDEDIR.

The library's API is completely undocumented.

Indentation in your configure.ac changes is wrong.

Your default is enable_gss=auto but that value is nevery handled; it
is considered the same as no.

Does linking the MPD binary really work with that plugin?  I mean, you
explicitly disabled appending -lgss to $LIBS - but the Makefile never
adds the flag.  I did not test.

You disabled error handling in configure.ac.  What is the point of
calling AC_CHECK_LIB when you ignore the result?

configure.ac should only check for libgss if libcurl was enabled
before.  You should not use -lcurl because CURL may require more
flags to find libcurl.so (using curl-config / pkg-config).

+/* necessary because libavutil/common.h uses UINT64_C */
+#define __STDC_CONSTANT_MACROS

Huh, you're not using libavutil!

Your input_gss_read() does not fill the Error.  Maybe because libgss
has no (documented) way to obtain error information?

Why do you say your stream is seekable when all you can do is rewind
to offset==0?  And not even that is useful; all you do is close the
inner object and reopen it.  If that was useful, the MPD core could do
it was well with any input plugin.

--
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register 
http://pubads.g.doubleclick.net/gampad/clk?id=60135031iu=/4140/ostg.clktrk
___
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team


Re: [Musicpd-dev-team] [PATCH 1/2] ConfigData: Add support for signed integers

2013-10-19 Thread Max Kellermann
On 2013/10/19 15:38, Sebastian Thorarensen se...@naju.se wrote:
 +unsigned
 +block_param::GetUnsignedValue() const
 +{
 + long value2 = GetIntValue();

This explicitly limits the range of unsigned integers to 2^31.  Why
that?

I admit that the existing code is bad as well, by using strtol() when
sizeof(long)==4 on i386, and that should be improved.  But your change
makes it even worse, by enforcing that limitation on all platforms.

--
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register 
http://pubads.g.doubleclick.net/gampad/clk?id=60135031iu=/4140/ostg.clktrk
___
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team


Re: [Musicpd-dev-team] [PATCH 1/2] ConfigData: Add support for signed integers

2013-10-19 Thread Sebastian Thorarensen
On Sat, 19 Oct 2013, Max Kellermann wrote:

 This explicitly limits the range of unsigned integers to 2^31.  Why
 that?

To save three lines of code and but I missed that it would limit the
range, so it was by mistake.

-- 
Sebastian Thorarensen

--
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register 
http://pubads.g.doubleclick.net/gampad/clk?id=60135031iu=/4140/ostg.clktrk
___
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team