Dave St John
2004-Aug-06 14:57 UTC
[icecast-dev] icecast2 ogg vorbis client request headers
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? Dave St John Mediacast1 Administration Need Support ? http://mediacast1.com/helpdesk ----- Original Message ----- From: "Michael Smith" <msmith@xiph.org> To: <icecast-dev@xiph.org> Sent: Thursday, April 01, 2004 7:12 PM Subject: Re: [icecast-dev] icecast2 ogg vorbis client request headers <p>> On Friday 02 April 2004 11:04, Dave St John wrote:> > > You must have some other, unrelated, problem, presumably elsewhere in > > > your code. > > > > this is what i have, and does work with mp3, but ogg does not want towork.> > im testing with winamp, you think that may be the issue? > > > > > > > > fwrite($fp,"GET /mymp3 HTTP/1.1\nUser-Agent:$HTTP_USER_AGENT\n\n"); > > for ($i=0; $i<120; $i++) { > > if (feof($sp)) break; > > $str.=fread($sp,4096); > > usleep(200000); > > if (strpos($str,"\r\n\r\n")) break; > > } > > > > flush(); > > echo substr($str,strpos($str,"\r\n\r\n")+4); > > flush(); > > I'm guessing here... so this could be completely wrong - but is this callto> 'echo' just above intended to send the HTTP headers? What about the restof> the data (i.e. the actual http body) that was read in your last fread()call?> Dropping this will just cause some normal data packets to be dropped inthe> mp3 case, but with ogg it'll drop the (critically important) headerpackets.> > So it's clearly wrong in both cases, but the consequences are worse forogg.> > Mike > > --- >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@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@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
Michael Smith
2004-Aug-06 14:57 UTC
[icecast-dev] icecast2 ogg vorbis client request headers
On Friday 02 April 2004 12:54, Dave St John 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 easiest (if my guesses as to how PHP works are right) and most correct change to your script would be to change the line: echo substr($str,strpos($str,"\r\n\r\n")+4); to echo $str; This will be more correct for mp3 as well. Mike --- >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@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
Dave St John
2004-Aug-06 14:57 UTC
[icecast-dev] icecast2 ogg vorbis client request headers
So instead set it from 4096 bytes to 0 and increment till it reaches the end? show me an example please. <p>Dave St John Mediacast1 Administration Need Support ? http://mediacast1.com/helpdesk ----- Original Message ----- From: "oddsock" <oddsock@oddsock.org> To: <icecast-dev@xiph.org> Sent: Thursday, April 01, 2004 9:15 PM Subject: Re: [icecast-dev] icecast2 ogg vorbis client request headers <p>> 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 icecast2and> >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 readin> 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@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@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
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. o 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 <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@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.