icy.cpp
上传用户:chn_coc
上传日期:2007-12-20
资源大小:563k
文件大小:1k
源码类别:

P2P编程

开发平台:

Windows_Unix

  1. #include "icy.h" #include "socket.h"
  2. // ------------------------------------------------ void ICYSource::stream(Channel *ch) {
  3. ChannelStream *source=NULL; try  {
  4. if (!ch->sock)
  5. throw StreamException("ICY channel has no socket");
  6. ch->resetPlayTime();
  7. ch->setStatus(Channel::S_BROADCASTING);
  8. source = ch->createSource(); ch->readStream(*ch->sock,source);
  9. }catch(StreamException &e) { LOG_ERROR("Channel aborted: %s",e.msg); } ch->setStatus(Channel::S_CLOSING); if (ch->sock) { ch->sock->close(); delete ch->sock;
  10. ch->sock = NULL; } if (source)
  11. delete source;
  12. }