Re: [Musicpd-dev-team] FS improvements + refinements in PollGroupWinSelect

2013-12-05 Thread Ben Boeckel
On Thu, Dec 05, 2013 at 19:17:56 +0600, Denis Krjuchkov wrote:
 g_get_home_dir() works differently depending on GLib version.
 Newer GLib versions check $HOME first
 and if it's empty use getpwnam_r() to obtain home directory for 
 currently user.
 Old versions go straight into using getpwnam_r().
 What approach should we use?

Please use $HOME then fall back to getpwnam_r(). I have a user with the
same uid/gid, but a different name and $HOME (mainly to put games into a
special root without a separate login), but getpwnam_r() gets my main
user's $HOME because it's earlier in the passwd file.

--Ben

--
Sponsored by Intel(R) XDK 
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631iu=/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] Tags in OGG httpd stream

2013-10-10 Thread Ben Boeckel
On Wed, Dec 05, 2012 at 16:51:54 -0500, Ben Boeckel wrote:
 @@ -524,31 +532,7 @@ decoder_replay_gain(struct decoder *decoder,
   float return_db = 0;
   assert(decoder != NULL);
  
 - if (replay_gain_info != NULL) {
 - static unsigned serial;
 - if (++serial == 0)
 - serial = 1;
 -
 - if (REPLAY_GAIN_OFF != replay_gain_mode) {
 - return_db = 20.0 * log10f(
 - replay_gain_tuple_scale(
 - 
 replay_gain_info-tuples[replay_gain_get_real_mode()],
 - replay_gain_preamp, 
 replay_gain_missing_preamp,
 - replay_gain_limit));
 - }
 -
 - decoder-replay_gain_info = *replay_gain_info;
 - decoder-replay_gain_serial = serial;
 -
 - if (decoder-chunk != NULL) {
 - /* flush the current chunk because the new
 -replay gain values affect the following
 -samples */
 - decoder_flush_chunk(decoder);

So this line here was the issue. This flushes the chunk into the stream
with just the tag and no data on it. Combined with this code right
before the chunk leaves for the sources:

static bool
play_chunk(player_control pc,
   Song *song, struct music_chunk *chunk,
   MusicBuffer buffer,
   const AudioFormat format,
   Error error)
{
assert(chunk-CheckFormat(format));

if (chunk-tag != nullptr)
update_song_tag(song, *chunk-tag);

if (chunk-length == 0) {
buffer.Return(chunk);
return true;
}

pc.Lock();
pc.bit_rate = chunk-bit_rate;
pc.Unlock();

/* send the chunk to the audio outputs */

if (!audio_output_all_play(chunk, error))
return false;

pc.total_play_time += (double)chunk-length /
format.GetTimeToSize();
return true;
}

the tag chunk is dropped because chunk-length is 0 for it. A patch
which fixes the issue is attached.

 - g_cond_signal(decoder-dc-client_cond);
 - }
 - } else
 - decoder-replay_gain_serial = 0;
 + replay_gain_state_set_info(decoder-replay_gain, replay_gain_info);

--Ben
From 9f7690767838052661160de5a30d28acc6ef3473 Mon Sep 17 00:00:00 2001
From: Ben Boeckel maths...@gmail.com
Date: Thu, 10 Oct 2013 23:00:52 -0400
Subject: [PATCH] PlayerThread: Only drop 0 length packets without tags

Fixes a regression from 752dfb3d95482c562e5d24c6ea839c4815de9a6d which
caused the current chunk to be flushed as soon as new replaygain
information was found. If this occurs on a tag chunk, it has no data
(length 0) and is then skipped before pushing it to all of the outputs.

This change allows 0-length chunks through if they contain a tag and
they are now appearing in mplayer and mpv properly.
---
 src/PlayerThread.cxx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/PlayerThread.cxx b/src/PlayerThread.cxx
index 9ad37ea..534a24e 100644
--- a/src/PlayerThread.cxx
+++ b/src/PlayerThread.cxx
@@ -726,7 +726,7 @@ play_chunk(player_control pc,
if (chunk-tag != nullptr)
update_song_tag(song, *chunk-tag);
 
-   if (chunk-length == 0) {
+   if (chunk-length == 0  chunk-tag == nullptr) {
buffer.Return(chunk);
return true;
}
-- 
1.8.3.1

--
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=60134071iu=/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-10 Thread Ben Boeckel
On Thu, Oct 10, 2013 at 23:12:27 -0400, Ben Boeckel wrote:
 So this line here was the issue. This flushes the chunk into the stream
 with just the tag and no data on it. Combined with this code right
 before the chunk leaves for the sources:

It seems this fix isn't complete actually. It works properly if I do
'mpd next', but if the song changes as usual, the tags don't show up
again. This will have to wait until next week for me to dig in further.

--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=60134071iu=/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-10 Thread Ben Boeckel
On Fri, Oct 11, 2013 at 00:14:46 -0400, Ben Boeckel wrote:
 On Thu, Oct 10, 2013 at 23:12:27 -0400, Ben Boeckel wrote:
  So this line here was the issue. This flushes the chunk into the stream
  with just the tag and no data on it. Combined with this code right
  before the chunk leaves for the sources:
 
 It seems this fix isn't complete actually. It works properly if I do
 'mpd next', but if the song changes as usual, the tags don't show up
 again. This will have to wait until next week for me to dig in further.

Or this is just me not checking mplayer, which is fine in both cases.
mpv/ffmpeg isn't seeing the new tags, which is a separate issue. Time
for bed if I'm missing this stuff...

--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=60134071iu=/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] Crash on master on exit/stream disconnect

2013-10-10 Thread Ben Boeckel
When disconnecting a stream or stopping (SIGINT) mpd, I'm seeing the
following backtrace with master
(17c6db6c33b9b14a8627b3f9b3da8580a5f932a2):

#0  EventLoop::RemoveFD (this=0x0, _fd=0, m=...) at src/event/Loop.cxx:64
#1  0x0043f0d7 in SocketMonitor::Schedule (this=0x1a74c28, 
flags=flags@entry=0)
at src/event/SocketMonitor.cxx:172
#2  0x0043f13b in Cancel (this=optimized out) at 
src/event/SocketMonitor.hxx:136
#3  SocketMonitor::Dispatch (this=optimized out, flags=optimized out) at 
src/event/SocketMonitor.cxx:43
#4  0x0044066b in EventLoop::Run (this=0x14f3c60) at 
src/event/Loop.cxx:176
#5  0x0041b436 in mpd_main (argc=optimized out, argv=optimized out) 
at src/Main.cxx:503
#6  0x7fd8cc0d0f75 in __libc_start_main (main=0x409a80 main(int, char**), 
argc=4, argv=0x7fff4df90918,
init=optimized out, fini=optimized out, rtld_fini=optimized out, 
stack_end=0x7fff4df90908)
at libc-start.c:285
#7  0x00409c49 in _start ()

I can bisect if needed, but it's pretty easy to reproduce here with just
connect/disconnecting an mplayer or mpv instance a couple of times.

--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=60134071iu=/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] FileSystem: new library for Path-friendly file system routines

2013-01-20 Thread Ben Boeckel
On Sun, Jan 20, 2013 at 19:10:28 +0600, Denis Krjuchkov wrote:
 Pushed slightly improved version:
 
 http://git.musicpd.org/cgit/dk/mpd.git/commit/?id=e6ed592b8aeb5025be0893ee99ff44e46a9ffd1c

For CheckExists, you should use lstat instead of stat. stat will error
if the path is a broken symlink.

--Ben

--
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_123012
___
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team


Re: [Musicpd-dev-team] UTF-8 file names support for Windows

2013-01-20 Thread Ben Boeckel
On Sun, Jan 20, 2013 at 16:20:13 +0100, Max Kellermann wrote:
  C++ provides wrappers for standard C headers (e.g. cstdio for stdio.h).
  Are there any rules on them? I tend to use them, however they have
  serious disadvantage: it's hard to predict whenever some function
  would appear to std namespace. So should we dismiss those headers?
 
 I have never used the C++ wrapper headers, I don't know why they exist
 and whether using them has an advantage.  Until somebody explains it
 to me, I'll keep on using standard C headers, but I wouldn't mind
 patches using C++ headers and std::.

Things like std::min and std::max are implemented using overloads
instead of as macros. Same with pretty much all of the math functions.
Looking at GCC 4.7.2's cstdlib, there are quite a few functions which
are implemented using real functions instead of macros (so you can pass
them as arguments to std::for_each and other higher-level functions from
algorithm).

--Ben

--
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_123012
___
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team


Re: [Musicpd-dev-team] FileSystem: new library for Path-friendly file system routines

2013-01-20 Thread Ben Boeckel
On Sun, Jan 20, 2013 at 17:14:12 +0100, Max Kellermann wrote:
 - slightly disagree with Ben (but thanks for pointing out that
   potential problem): there should be some way to specify whether
   symbolic links shall be followed.  Some callers may want to follow
   symlinks, some do not, and the database update has that configurable
   at runtime.

Maybe have a CheckFileExists (stat) and a CheckPathExists (lstat)?

--Ben

--
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_123012
___
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team


Re: [Musicpd-dev-team] FileSystem: new library for Path-friendly file system routines

2013-01-20 Thread Ben Boeckel
On Sun, Jan 20, 2013 at 17:25:26 +0100, Max Kellermann wrote:
  bool IsRegularFile(Path, bool follow_symlinks=true)

That works as well.

--Ben

--
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_123012
___
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team