liveMedia/MP3StreamState.cpp File Reference

#include "MP3StreamState.hh"
#include "InputFile.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 214 of file MP3StreamState.cpp.

Referenced by MP3StreamState::findNextFrame().

#define MILLION   1000000

Definition at line 29 of file MP3StreamState.cpp.

#define XING_BYTES_FLAG   0x0002

Definition at line 414 of file MP3StreamState.cpp.

Referenced by MP3StreamState::checkForXingHeader().

#define XING_FRAMES_FLAG   0x0001

Definition at line 413 of file MP3StreamState.cpp.

Referenced by MP3StreamState::checkForXingHeader().

#define XING_TOC_FLAG   0x0004

Definition at line 415 of file MP3StreamState.cpp.

Referenced by MP3StreamState::checkForXingHeader().

#define XING_VBR_SCALE_FLAG   0x0008

Definition at line 416 of file MP3StreamState.cpp.


Function Documentation

static void checkFunc ( void *   )  [static]

Definition at line 374 of file MP3StreamState.cpp.

References watchVariable.

Referenced by waitUntilSocketIsReadable().

00374                                             {
00375   watchVariable = ~0;
00376 }

static Boolean socketIsReadable ( int  socket  )  [static]

Definition at line 360 of file MP3StreamState.cpp.

References NULL.

Referenced by waitUntilSocketIsReadable().

00360                                             {
00361   const unsigned numFds = socket+1;
00362   fd_set rd_set;
00363   FD_ZERO(&rd_set);
00364   FD_SET((unsigned)socket, &rd_set);
00365   struct timeval timeout;
00366   timeout.tv_sec = timeout.tv_usec = 0;
00367 
00368   int result = select(numFds, &rd_set, NULL, NULL, &timeout);
00369   return result != 0; // not > 0, because windows can return -1 for file sockets
00370 }

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

Definition at line 378 of file MP3StreamState.cpp.

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

Referenced by MP3StreamState::readFromStream().

00378                                                                          {
00379   while (!socketIsReadable(socket)) {
00380     // Delay a short period of time before checking again.
00381     unsigned usecsToDelay = 1000; // 1 ms
00382     env.taskScheduler().scheduleDelayedTask(usecsToDelay,
00383                                             (TaskFunc*)checkFunc, (void*)NULL);
00384     watchVariable = 0;
00385     env.taskScheduler().doEventLoop(&watchVariable);
00386         // This allows other tasks to run while we're waiting:
00387   }
00388 }


Variable Documentation

char watchVariable [static]

Definition at line 372 of file MP3StreamState.cpp.

Referenced by checkFunc(), and waitUntilSocketIsReadable().


Generated on Thu Feb 2 23:53:43 2012 for live by  doxygen 1.5.2