liveMedia/MP3StreamState.cpp File Reference

#include "MP3StreamState.hh"
#include "GroupsockHelper.hh"

Include dependency graph for MP3StreamState.cpp:

Go to the source code of this file.

Defines

#define MILLION   1000000
#define HDRCMPMASK   0xfffffd00
#define XING_FRAMES_FLAG   0x0001
#define XING_BYTES_FLAG   0x0002
#define XING_TOC_FLAG   0x0004
#define XING_VBR_SCALE_FLAG   0x0008

Functions

static Boolean socketIsReadable (int socket)
static void checkFunc (void *)
static void waitUntilSocketIsReadable (UsageEnvironment &env, int socket)

Variables

static char watchVariable


Define Documentation

#define HDRCMPMASK   0xfffffd00

Definition at line 223 of file MP3StreamState.cpp.

Referenced by MP3StreamState::findNextFrame().

#define MILLION   1000000

Definition at line 28 of file MP3StreamState.cpp.

#define XING_BYTES_FLAG   0x0002

Definition at line 435 of file MP3StreamState.cpp.

Referenced by MP3StreamState::checkForXingHeader().

#define XING_FRAMES_FLAG   0x0001

Definition at line 434 of file MP3StreamState.cpp.

Referenced by MP3StreamState::checkForXingHeader().

#define XING_TOC_FLAG   0x0004

Definition at line 436 of file MP3StreamState.cpp.

Referenced by MP3StreamState::checkForXingHeader().

#define XING_VBR_SCALE_FLAG   0x0008

Definition at line 437 of file MP3StreamState.cpp.


Function Documentation

static void checkFunc ( void *   )  [static]

Definition at line 395 of file MP3StreamState.cpp.

References watchVariable.

Referenced by waitUntilSocketIsReadable().

00395                                             {
00396   watchVariable = ~0;
00397 }

static Boolean socketIsReadable ( int  socket  )  [static]

Definition at line 381 of file MP3StreamState.cpp.

References NULL.

Referenced by waitUntilSocketIsReadable().

00381                                             {
00382   const unsigned numFds = socket+1;
00383   fd_set rd_set;
00384   FD_ZERO(&rd_set);
00385   FD_SET((unsigned)socket, &rd_set);
00386   struct timeval timeout;
00387   timeout.tv_sec = timeout.tv_usec = 0;
00388 
00389   int result = select(numFds, &rd_set, NULL, NULL, &timeout);
00390   return result != 0; // not > 0, because windows can return -1 for file sockets
00391 }

static void waitUntilSocketIsReadable ( UsageEnvironment env,
int  socket 
) [static]

Definition at line 399 of file MP3StreamState.cpp.

References checkFunc(), TaskScheduler::doEventLoop(), env, NULL, TaskScheduler::scheduleDelayedTask(), socketIsReadable(), UsageEnvironment::taskScheduler(), and watchVariable.

Referenced by MP3StreamState::readFromStream().

00399                                                                          {
00400   while (!socketIsReadable(socket)) {
00401     // Delay a short period of time before checking again.
00402     unsigned usecsToDelay = 1000; // 1 ms
00403     env.taskScheduler().scheduleDelayedTask(usecsToDelay,
00404                                             (TaskFunc*)checkFunc, (void*)NULL);
00405     watchVariable = 0;
00406     env.taskScheduler().doEventLoop(&watchVariable);
00407         // This allows other tasks to run while we're waiting:
00408   }
00409 }


Variable Documentation

char watchVariable [static]

Definition at line 393 of file MP3StreamState.cpp.

Referenced by checkFunc(), and waitUntilSocketIsReadable().


Generated on Tue Jul 22 06:40:02 2008 for live by  doxygen 1.5.2