[icecast-dev] icecast2 ogg vorbis client request headers

oddsock oddsock at oddsock.org
Thu Apr 1 20:37:00 PST 2004



I imagine something to the effect of (a completely untested and hack-ish 
way to do it):
$count = 0;
while (!feof($sp)) {
         $str = fread($sp,1);
         if ($count == 0) {
                 if ($str == "\r") {
                         $count = 1;
                         continue;
                 }
         }
         if ($count == 1) {
                 if ($str == "\n") {
                         $count = 2;
                         continue;
                 }
         }
         if ($count == 2) {
                 if ($str == "\r") {
                         $count = 3;
                         continue;
                 }
         }
         if ($count == 3) {
                 if ($str == "\n") {
                         $count = 4;
                         continue;
                 }
         }
         if ($count == 4) {
                 break;
         }
}
// now your at the end of the header
while (!feof($sp)) {
         $str = fread($sp,4096);
         // Write data (in $str to client (listener in this case) - not 
sure how you do this...
}

At 10:26 PM 4/1/2004, you wrote:
>So instead set it from 4096 bytes to 0  and increment till it reaches the
>end?
>show me an example please.
>
>
>Dave St John
>Mediacast1 Administration
>
>Need Support ?
>http://mediacast1.com/helpdesk
>----- Original Message -----
>From: "oddsock" <oddsock at oddsock.org>
>To: <icecast-dev at xiph.org>
>Sent: Thursday, April 01, 2004 9:15 PM
>Subject: Re: [icecast-dev] icecast2 ogg vorbis client request headers
>
>
> > At 08:54 PM 4/1/2004, you wrote:
> > >Well the code itself is what i took from tom peppers sc proxy script and
> > >incorperated our own auth system for icecast2
> > >i know i got it close with ogg and it seems to be when i tweak the
> > >$str.=fread($sp,4096);
> > >bit amount, i get different results, 4096 works fine for mp3 on icecast2
>and
> > >shoutcast, but im assuimg maybe there is more or less to read from
> > >the ogg headers?? if so what would be the correct amount?
> >
> > the correct amount would vary depending on what your http response headers
> > look like.
> >
> > don't read a flat 4096 amount, this will (as Mike said) most likely read
>in
> > part of the vorbis headers, and since your throwing away this 4096 bytes,
> > you are throwing away part of the vorbis headers, which are required to be
> > sent first in a vorbis stream.
> >
> > so instead of reading 4096, just read a byte at a time until you get a
> > character series "\r\n\r\n"...then you know your at the end of the http
> > header and you won't be thowing away vorbis critical data..
> >
> > oddsock
> >
> >
> > --- >8 ----
> > List archives:  http://www.xiph.org/archives/
> > icecast project homepage: http://www.icecast.org/
> > To unsubscribe from this list, send a message to
>'icecast-dev-request at xiph.org'
> > containing only the word 'unsubscribe' in the body.  No subject is needed.
> > Unsubscribe messages sent to the list will be ignored/filtered.
> >
>
>
>--- >8 ----
>List archives:  http://www.xiph.org/archives/
>icecast project homepage: http://www.icecast.org/
>To unsubscribe from this list, send a message to 
>'icecast-dev-request at xiph.org'
>containing only the word 'unsubscribe' in the body.  No subject is needed.
>Unsubscribe messages sent to the list will be ignored/filtered.

<p>--- >8 ----
List archives:  http://www.xiph.org/archives/
icecast project homepage: http://www.icecast.org/
To unsubscribe from this list, send a message to 'icecast-dev-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the Icecast-dev mailing list