Subject: building apple's streaming server
To: None <netbsd-help@netbsd.org>
From: Danny Thomas <D.Thomas@vthrc.uq.edu.au>
List: netbsd-help
Date: 07/09/1999 05:42:34
I'm interested in getting Apple's OpenSource QuickTime Streaming Server
going - so we can put up movies, like bacteria moving across surfaces or of
fish eye movements.

Anyway the just-released second version of QTSS has made a reasonable
attempt at porting issues, but I'm stuck and don't in any case have to
time/nous to play.

I've got 1.4/386 with the PTL package just installed
I modified the Makefile to define NetBSD instead of linux
changed the CC/C++/LINK to use /usr/pkg/bin/ptlgcc
replaced the #if FreeBSD in OSHeaders.h
didn't know what to do about -lpthread - does PTL define this or
  are you expected to replace it by -lPTL?
if I compile with -D__PTHREADS__=1
  bombs out in the code below about PTHREAD_MUTEX_RECURSIVE_NP
  I believe that's a problem with Solaris, too. BTW NP==Non-Portable !!
if I compile with -D__PTHREADS__=0
  the link complains about some routines mymutex_lock/unlock
  these are declared in a header file, but missing from src (Apple prob)

Commenting out that line with PTHREAD_MUTEX_RECURSIVE_NP alows us to
compile and link the libQTRTPFile.a and also to compile and build the main
server - after adding -lm and commenting out the extraneous second
definition of terminate().

The server bombs out with no msg via syslog or the console whn I try
running it. Whether that's because of the removal of the
PTHREAD_MUTEX_RECURSIVE_NP line, I don't know. It does get past the fork &
processing of cmd-line args. I tried the PRISS.cfg config file from the
streamingserver.org site.

source is available from
  http://www.publicsource.apple.com/projects/streaming/
but first you have to register:
  http://www.publicsource.apple.com/apsl/

http://www.streamingserver.org covers some issues


Suggestions welcome, should I
  use something other than PTL
  can I replace PTHREAD_MUTEX_RECURSIVE_NP in the code below
    out of interest's sake, "the server uses only three threads and uses
    async I/O where possible"

but apart from a quick fix, I don't want to discourage anyone who wants to
make a package. Even better would be someone competent (ie not me)
submitting patches to Apple so the standard distribution could be built on
any NetBSD platform. While this second release is much better in separating
port-specific code, the immediate focus is on supporting linux though
OSHeaders.h does include a set of type defines for FreeBSD.

cheers,
Danny Thomas


PS I chose PTL because Jason recently mentioned that as 'preferred'

PPS you need to 'hint' QuickTime movies to get them in a form suitable for
streaming. Apple's $30 upgrade to QuickTimePro 4 can do this.
http://asu.info.apple.com/swupdates.nsf/artnum/n11357 points to a 9M sample
movie which can be used to test the server.


OSMutex::OSMutex(UInt32 tag)
: fTag(tag)
{
#if !__PTHREADS__
    fMutex = mymutex_alloc();
#else
    static pthread_mutexattr_t  *sMutexAttr=NULL;
    if (sMutexAttr == NULL)
    {
        sMutexAttr = (pthread_mutexattr_t*)malloc(sizeof(pthread_mutexattr_t));
        pthread_mutexattr_init(sMutexAttr);
        pthread_mutexattr_setkind_np(sMutexAttr, PTHREAD_MUTEX_RECURSIVE_NP);
    }
    (void)pthread_mutex_init(&fMutex, sMutexAttr);
#endif
}

OSMutex::~OSMutex()
{
#if !__PTHREADS__
    mymutex_free(fMutex);
#else
    pthread_mutex_destroy(&fMutex);
#endif
}