Qt 4.8
Public Functions | Protected Variables | List of all members
QWSSoundServerStream Class Reference
Inheritance diagram for QWSSoundServerStream:
QWSSoundServerProvider

Public Functions

bool finished () const
 
 QWSSoundServerStream (int d, int c, int f, int b, int wid, int sid)
 
int readySamples (int)
 
 ~QWSSoundServerStream ()
 
- Public Functions inherited from QWSSoundServerProvider
int add (int *mixl, int *mixr, int count)
 
bool equal (int wid, int sid)
 
int getSample (int off, int bps)
 
int groupId () const
 
bool muted ()
 
 QWSSoundServerProvider (int w, int s)
 
void setMute (bool m)
 
void setPriority (bool p)
 
void setVolume (int lv, int rv)
 
int soundId () const
 
void startSampleRunin ()
 
virtual ~QWSSoundServerProvider ()
 

Protected Variables

time_t lasttime
 
- Protected Variables inherited from QWSSoundServerProvider
struct {
   qint32   avgBytesPerSec
 
   qint16   blockAlign
 
   qint16   channels
 
   qint16   formatTag
 
   qint32   samplesPerSec
 
   qint16   wBitsPerSample
 
chunkdata
 
int dev
 
int samples_due
 

Additional Inherited Members

- Static Public Functions inherited from QWSSoundServerProvider
static void setPlayPriorityOnly (bool p)
 
- Protected Functions inherited from QWSSoundServerProvider
int devSamples ()
 
char * prepareBuffer (int &size)
 
void updateBuffer (int read)
 

Detailed Description

Definition at line 645 of file qsoundqss_qws.cpp.

Constructors and Destructors

◆ QWSSoundServerStream()

QWSSoundServerStream::QWSSoundServerStream ( int  d,
int  c,
int  f,
int  b,
int  wid,
int  sid 
)
inline

Definition at line 647 of file qsoundqss_qws.cpp.

Referenced by QWSSoundServerPrivate::playRawFile().

649  : QWSSoundServerProvider(wid, sid)
650  {
651  chunkdata.channels = c;
652  chunkdata.samplesPerSec = f;
653  chunkdata.wBitsPerSample = b;
654  dev = d;
655  //fcntl( dev, F_SETFL, O_NONBLOCK );
656  lasttime = 0;
657  }
double d
Definition: qnumeric_p.h:62
unsigned char c[8]
Definition: qnumeric_p.h:62
struct QWSSoundServerProvider::@162 chunkdata
QWSSoundServerProvider(int w, int s)

◆ ~QWSSoundServerStream()

QWSSoundServerStream::~QWSSoundServerStream ( )
inline

Definition at line 659 of file qsoundqss_qws.cpp.

660  {
661  if (dev != -1) {
662  ::close(dev);
663  dev = -1;
664  }
665  }

Functions

◆ finished()

bool QWSSoundServerStream::finished ( ) const
inlinevirtual

Implements QWSSoundServerProvider.

Definition at line 667 of file qsoundqss_qws.cpp.

668  {
669  return (dev == -1);
670  }

◆ readySamples()

int QWSSoundServerStream::readySamples ( int  )
inlinevirtual

Implements QWSSoundServerProvider.

Definition at line 673 of file qsoundqss_qws.cpp.

674  {
675  int size;
676  char *dest = prepareBuffer(size);
677  if (size > 0 && dest != 0 && dev != -1) {
678 
679  int read = ::read(dev, dest, size);
680  if (read < 0) {
681  switch(errno) {
682  case EAGAIN:
683  case EINTR:
684  // means read may yet succeed on the next attempt
685  break;
686  default:
687  // unexpected error, fail.
688  ::close(dev);
689  dev = -1;
690  }
691  } else if (read == 0) {
692  // 0 means writer has closed dev and/or
693  // file is at end.
694  ::close(dev);
695  dev = -1;
696  } else {
697  updateBuffer(read);
698  }
699  }
700  int possible = devSamples();
701  if (possible == 0)
703  return possible;
704  }
void updateBuffer(int read)
char * prepareBuffer(int &size)
int errno

Properties

◆ lasttime

time_t QWSSoundServerStream::lasttime
protected

Definition at line 707 of file qsoundqss_qws.cpp.


The documentation for this class was generated from the following file: