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 423 of file MP3StreamState.cpp.

Referenced by MP3StreamState::checkForXingHeader().

#define XING_FRAMES_FLAG   0x0001

Definition at line 422 of file MP3StreamState.cpp.

Referenced by MP3StreamState::checkForXingHeader().

#define XING_TOC_FLAG   0x0004

Definition at line 424 of file MP3StreamState.cpp.

Referenced by MP3StreamState::checkForXingHeader().

#define XING_VBR_SCALE_FLAG   0x0008

Definition at line 425 of file MP3StreamState.cpp.


Function Documentation

static void checkFunc ( void *   )  [static]

Definition at line 383 of file MP3StreamState.cpp.

References watchVariable.

Referenced by waitUntilSocketIsReadable().

00383                                             {
00384   watchVariable = ~0;
00385 }

static Boolean socketIsReadable ( int  socket  )  [static]

Definition at line 369 of file MP3StreamState.cpp.

References NULL.

Referenced by waitUntilSocketIsReadable().

00369                                             {
00370   const unsigned numFds = socket+1;
00371   fd_set rd_set;
00372   FD_ZERO(&rd_set);
00373   FD_SET((unsigned)socket, &rd_set);
00374   struct timeval timeout;
00375   timeout.tv_sec = timeout.tv_usec = 0;
00376 
00377   int result = select(numFds, &rd_set, NULL, NULL, &timeout);
00378   return result != 0; // not > 0, because windows can return -1 for file sockets
00379 }

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

Definition at line 387 of file MP3StreamState.cpp.

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

Referenced by MP3StreamState::readFromStream().

00387                                                                          {
00388   while (!socketIsReadable(socket)) {
00389     // Delay a short period of time before checking again.
00390     unsigned usecsToDelay = 1000; // 1 ms
00391     env.taskScheduler().scheduleDelayedTask(usecsToDelay,
00392                                             (TaskFunc*)checkFunc, (void*)NULL);
00393     watchVariable = 0;
00394     env.taskScheduler().doEventLoop(&watchVariable);
00395         // This allows other tasks to run while we're waiting:
00396   }
00397 }


Variable Documentation

char watchVariable [static]

Definition at line 381 of file MP3StreamState.cpp.

Referenced by checkFunc(), and waitUntilSocketIsReadable().


Generated on Fri Sep 3 02:36:40 2010 for live by  doxygen 1.5.2