It probably won't work in its current form, but I would image the porting effort wouldn't be very difficult, as long as you could get the required libraries running on OSX. But I don't have an OSX machine with which to work on it.

If you would like to refer to this comment somewhere else in this project, copy and paste the following link:

Since I also use a Mac OS X machine as home media server, I started porting efforts to OS X some days ago. minidlna seems to be the DLNA server of choice for the reasons of being open source, running as a daemon without GUI, and reported functionality.

There are some "linuxisms" in the code which have made the porting effort somewhat large. I had to rewrite some code with ioctls and sysctls, and some code parsing files in /proc.

Now I have a running minidlna on OS X, but its not workee yet:

- I only see two of my videos on the TV, while there are many more in my directory… probably some code in the scanner is broken
- Playing (one of the two visible) videos on the TV gives "unsupported format", while I know from other posts that the format should be supported
- inotify code is not ported yet, inotify stuff not workee
- debug output tells something about data modified after being free, so some additional bug here

I will try to look into this in the next few days.

I will also try to find out whether my code works also under Linux and/or FreeBSD. (I tried to use portable system calls, but have not tested it yet.) This would enable people to work on this code who don't have OS X available. (Unfortunately the OpenDarwin project obviously has died some years ago… this would have been the perfect testing platform I guess.)

But for a truly portable project, one needs to use something like autoconf or similar…

If you would like to refer to this comment somewhere else in this project, copy and paste the following link:

Update: I have a working minidlna for OS X available. There are still some issues, though.

* scanner dies with 'incorrect checksum for freed object - object was probably modified after being freed.' This is the reason for this "I see only two videos" issue: scanner is dying just before it is able to add a third video. If I do not use USE_FORK=1 in upnpglobalvars.h, scanner is not in his own process and the failed assertion there makes entire minidlna server abort. Thus, this bug is pretty much confined, but I nevertheless failed to track it down yet. And as final observation: This error only occurs with nested directories. If I put some videos in one single flat directory, it is scanned correctly by the scanner and also visible on the TV.
* OS X is lacking a sendfile library call which is comparable to the one from Linux. (It actually has a sendfile call, but it behaves differently. Already the manpage from Linux' sendfile says: "Other Unix systems implement sendfile() with different semantics and prototypes. It should not be used in portable programs." I therefore replaced the call to sendfile by some construction with read(2) and write(2) in upnphttp.c. Now streaming works, but forward/rewind does not work properly. I guess my construction still does not behave properly.
* And finally the inotify stuff is still missing.

But the good news is that it is working now in principle!

If you would like to refer to this comment somewhere else in this project, copy and paste the following link:

Hello everybody. I have been trying to port minidlna to the Mac OS X for a while and I have a version, where I had to change some code but tried to keep the original code (I inserted the OS X code between #ifdef __APPLE__ delimiters). I noticed the same problems regarding the sendfile (but went on using the original - little modified - call) but I got problems with the database loading code (same as detue): it is not able to recursively scan directories, sooner or later it bombs with an 'out of boundaries' error on a malloc. I could not get rid of it yet - it looks like the process gets too little memory and goes out of stack, but I don't know how to make OS X allocate more stack (I mainly program in Java, have been using C only for fun). I could share my minidlna_mac code (with the codeproject file and the external libraries compiled with MacPorts) in order to try to merge it with other efforts. Just let me know if you are interested (mainly detue, of course). Best regards.

If you would like to refer to this comment somewhere else in this project, copy and paste the following link:

In the last few days I created GNU autotool scripts for the project so it now has has configure script which can configure and build it on Linux, Mac OS X and FreeBSD, and adjust the code to be as portable as possible, and to use #ifdefs where I have not been able to find portable code.

The bug in my sendfile replacement code has been found so that my new portable code works properly including forward and rewind (tested with a TV as client, a Samsung B650).

The issue with the scanner still persists (scanning only works without problem if a single flat dir is used) and the inotify stuff compiles, surprisingly, but I have not tested it, though.

Thus, the software can stream videos with forward and rewind and as such it now should somewhere be made available to the public, I think. The question is whether you, jmaggard, want to have my code "as is" including the bugs and issues mentioned above, or whether we want to prefer to have it as a separate project (minidlna-portable for example) as long as the portable version has serious bugs compared to the linux version.

stedip: what is the status of your port? You said you have the same problems as I do, but in principle, is it working? Of course we should bundle our efforts and "cherrypick" the bugfixes from both our codes.

If you would like to refer to this comment somewhere else in this project, copy and paste the following link:

Hi detue (and everybody). The status of my port is as follows: the basic loop (the upnp/dlna stuff) is working, though with the sendfile issue; it works beautifully with photos, issuing the preview etc., does not work with music (but, if you stop the debugger just after the sendfile, wait for a second and go on it surprisingly works - well, I guess that it gives time for a retry to the Samsung TV, a 40A756); the video is not working at all (always gives the "unsupported format" error). I just tried once to connect to the PS3 and never to the XBOX (my children are busy at the consoles!) with poor results. Nevertheless the main issue is that my instance is not able to create the sqlite db - it bombs, looks like the recursion or any other problem prevents it to complete, so the dlna loop is working only from the second try on when I try to create the db. I read that the os x leopard does not need to explicitly manage memory, so apparently there is no fix (I guess that the external libs that I import could not be perfect, they have been created with the aid of MacPorts). Then I am using the standard development environment supplied by Apple (CodeProject etc.) because I am not able to deal with the makefile stuff and the like.
I partially ported the inotify stuff, too. I just miss the main routine, which is quite useless if the db creation code is not working…
My final goal would be to make a System Preferences panel out of minidlna (adding the extra Apple code and embedding the minidlna executable as is). I suggest that we exchange code at this point and try to merge, or just optimize the better working one (which of course I guess is yours: but maybe some snippet of mine could be just useful). I wonder how you solved the problem of the external libs. Ah, by the way, I have an Intel MB Pro with Leopard 10.5.8.

If you would like to refer to this comment somewhere else in this project, copy and paste the following link:

I just tried music and photos. I have not been interested in these and have never tested them, but to my great pleasure it works. Watching photos and playing music works fine. (With music, there seems to be no way to spool forward or backwards. The client seems not to be able to do this, the left and right buttons on the remote control switch to the next or previous title, and spooling is not available.)

And I never tried a different client but the Samsung B650. (No XBox, no PS3 available, hm, perhaps I can borrow one from a colleague after the holidays.)

About the sqlite stuff: have you tried to use only a single flat directory for your files? It works for me like this. It only bombs if subdirectories are present. (Which is of course a major bug, but it is nevertheless already of some use value.)

What do you mean with "os x leopard does not need to explicitly manage memory"? Never heard about that.

My libs are also from macports.

And I am using Makefiles and GNU autotools since I am not able to deal properly with XCode ;-) But it sounds very promising that you plan to make a System Preferences Panel, I did not think beyond the Idea of a running daemon that is started from the command line. But a System Preferences Panel sounds very cool.

I am using Snow Leopard here. This is good, then we have already two testing platforms available, 10.5 and 10.6.

About code sharing. I do not want to "publish" something as long as jmaggard did not tell his position about this. I do not want to "fork" his project without his agreement. (Besides that, it still may be a good idea depending on the goals to manage the "portable version" as a separate project as long as it is inferior to the original linux code from jmaggard.)

If you would like to refer to this comment somewhere else in this project, copy and paste the following link:

Can you post a diff of what you have so far? Please use "cvs -q diff -uN" to generate the diff. I think you should be able to post it in the "Patches" tracker. I may be able to get ahold of an OSX laptop to use for a couple days.

If you would like to refer to this comment somewhere else in this project, copy and paste the following link:

are you interested in the GNU autoconf-based configuration and build system I created for minidlna? (GNU autotools is what creates those well-known configure scripts from so many open source packages.)

If so, submitting a simple patch is not possible since I would need to "cvs add" some files which I lack the permissions to. I could submit a patch for the already existing files and submit the other files as a tar.gz file, for example.

If you would like to stick to the present genconfig.sh and handcrafted Makefile, I need to extend those first to the new requirements before I can submit a patch. (But please consider using the autoconf tools, it is much more powerful, flexible and extensible.)

If you would like to refer to this comment somewhere else in this project, copy and paste the following link:

Hello everybody. I have been testing the main patch by detue and want to thank him for the great job that he has done. It works beautifully (under Snow Leopard - ie-x64) together with my Samsung 40LE756. Everything is ok, quick and responsive (photos, music and films), so: great job.
I have tried testing it under Leopard on both PPC and ie386 platforms and… photos ok, nothing else working. I've tried testing this way because 'the rest of us' is probably still in that situation, and at the moment there is only one app doing this stuff (quite) well under Leopard - intel (by the way, its name is Serviio and is written in Java, so it's quite heavy and slow) and none for the PPC.
The problem of building the database has been solved under ALL the Mac platforms/O.S. releases (again, thanks to detue).
I have tested the minidlna against a PS3 with similar results, so the problem could be located within the system network management of the Leopard OS.
The investigation goes on.

If you would like to refer to this comment somewhere else in this project, copy and paste the following link:

Anonymous
-
2010-07-21

Hi, I'm trying to compile MiniDLNA in my G5 running Leopard. Not really a developer so this is kind of a project for me. When searching for dependencies through MacPorts several of them doesn't appear, or they appear with a different name. When "make" is invoked it asks again for the same dependencies, what should I do about it?

In order to use macports installed items you need to inform the compiler and linker of certain things:
export CFLAGS='-I/opt/local/include'
export LDFLAGS='L/opt/local/lib'
The same goes for fink users:
export CFLAGS='-I/sw/include'
export LDFLAGS='-L/sw/lib'
Then run configure and it should pick up the dependencies. (If you have installed them of course)

If you would like to refer to this comment somewhere else in this project, copy and paste the following link:

Anonymous
-
2010-08-02

Thanks, carbnsack, I'm trying to do so, but I've still got the same error. Even thought I've got he dependencies installed. And tried to export flags as you suggested. (I also tried adding and changing the CFLAGS paths in the make file)

Here is the error I got and my macport installed dependencies. Maybe this have to do with some OSX 10.5 specific variable? Like .profile not being in the home directory but in /etc ? Once more, I'm just an amateur in this stuff. Maybe is something really basic.

/genconfig.sh
-e
ERROR! Cannot continue.
-e The following required libraries are either missing, or are missing development headers:

I had a problem with iconv when I compiled. I needed to add a line
AC_CHECK_LIB(, ,,)
to "configure.ac", for the library to be linked.

Also, I can not do "make install". I am a complete newbie when it comes to autoconf and friends, so I don't know how to fix it. On the other hand this is not critical in any way. The program works beautifully, streaming media to my Sony BDP-S370.

If you would like to refer to this comment somewhere else in this project, copy and paste the following link: