MPEG2TransportStreamFramer Class Reference

#include <MPEG2TransportStreamFramer.hh>

Inheritance diagram for MPEG2TransportStreamFramer:

Inheritance graph
[legend]
Collaboration diagram for MPEG2TransportStreamFramer:

Collaboration graph
[legend]

Public Types

typedef void( afterGettingFunc )(void *clientData, unsigned frameSize, unsigned numTruncatedBytes, struct timeval presentationTime, unsigned durationInMicroseconds)
typedef void( onCloseFunc )(void *clientData)

Public Member Functions

unsigned long tsPacketCount () const
void changeInputSource (FramedSource *newInputSource)
void clearPIDStatusTable ()
FramedSourceinputSource () const
void getNextFrame (unsigned char *to, unsigned maxSize, afterGettingFunc *afterGettingFunc, void *afterGettingClientData, onCloseFunc *onCloseFunc, void *onCloseClientData)
void stopGettingFrames ()
virtual unsigned maxFrameSize () const
Boolean isCurrentlyAwaitingData () const
virtual Boolean isRTPSource () const
virtual Boolean isMPEG1or2VideoStreamFramer () const
virtual Boolean isMPEG4VideoStreamFramer () const
virtual Boolean isH264VideoStreamFramer () const
virtual Boolean isJPEGVideoSource () const
virtual Boolean isAMRAudioSource () const
UsageEnvironmentenvir () const
char const * name () const
virtual Boolean isSink () const
virtual Boolean isRTCPInstance () const
virtual Boolean isRTSPClient () const
virtual Boolean isRTSPServer () const
virtual Boolean isMediaSession () const
virtual Boolean isServerMediaSession () const
virtual Boolean isDarwinInjector () const

Static Public Member Functions

static MPEG2TransportStreamFramercreateNew (UsageEnvironment &env, FramedSource *inputSource)
static Boolean lookupByName (UsageEnvironment &env, char const *sourceName, FramedSource *&resultSource)
static Boolean lookupByName (UsageEnvironment &env, char const *sourceName, MediaSource *&resultSource)
static Boolean lookupByName (UsageEnvironment &env, char const *mediumName, Medium *&resultMedium)
static void handleClosure (void *clientData)
static void close (UsageEnvironment &env, char const *mediumName)
static void close (Medium *medium)

Protected Member Functions

 MPEG2TransportStreamFramer (UsageEnvironment &env, FramedSource *inputSource)
virtual ~MPEG2TransportStreamFramer ()
virtual char const * MIMEtype () const
virtual void getAttributes () const
TaskTokennextTask ()

Static Protected Member Functions

static void afterGetting (FramedSource *source)

Protected Attributes

FramedSourcefInputSource
unsigned char * fTo
unsigned fMaxSize
unsigned fFrameSize
unsigned fNumTruncatedBytes
timeval fPresentationTime
unsigned fDurationInMicroseconds

Private Member Functions

virtual void doGetNextFrame ()
virtual void doStopGettingFrames ()
void afterGettingFrame1 (unsigned frameSize, struct timeval presentationTime)
void updateTSPacketDurationEstimate (unsigned char *pkt, double timeNow)

Static Private Member Functions

static void afterGettingFrame (void *clientData, unsigned frameSize, unsigned numTruncatedBytes, struct timeval presentationTime, unsigned durationInMicroseconds)

Private Attributes

unsigned long fTSPacketCount
double fTSPacketDurationEstimate
HashTablefPIDStatusTable
unsigned long fTSPCRCount

Detailed Description

Definition at line 34 of file MPEG2TransportStreamFramer.hh.


Member Typedef Documentation

typedef void( FramedSource::afterGettingFunc)(void *clientData, unsigned frameSize, unsigned numTruncatedBytes, struct timeval presentationTime, unsigned durationInMicroseconds) [inherited]

Definition at line 36 of file FramedSource.hh.

typedef void( FramedSource::onCloseFunc)(void *clientData) [inherited]

Definition at line 40 of file FramedSource.hh.


Constructor & Destructor Documentation

MPEG2TransportStreamFramer::MPEG2TransportStreamFramer ( UsageEnvironment env,
FramedSource inputSource 
) [protected]

Definition at line 60 of file MPEG2TransportStreamFramer.cpp.

References HashTable::create(), and ONE_WORD_HASH_KEYS.

MPEG2TransportStreamFramer::~MPEG2TransportStreamFramer (  )  [protected, virtual]

Definition at line 66 of file MPEG2TransportStreamFramer.cpp.

References clearPIDStatusTable(), and fPIDStatusTable.

00066                                                         {
00067   clearPIDStatusTable();
00068   delete fPIDStatusTable;
00069 }


Member Function Documentation

MPEG2TransportStreamFramer * MPEG2TransportStreamFramer::createNew ( UsageEnvironment env,
FramedSource inputSource 
) [static]

Definition at line 55 of file MPEG2TransportStreamFramer.cpp.

References env.

Referenced by MPEG2TransportFileServerMediaSubsession::createNewStreamSource(), and MediaSubsession::initiate().

00055                                                             {
00056   return new MPEG2TransportStreamFramer(env, inputSource);
00057 }

unsigned long MPEG2TransportStreamFramer::tsPacketCount (  )  const [inline]

Definition at line 39 of file MPEG2TransportStreamFramer.hh.

References fTSPacketCount.

Referenced by ClientTrickPlayState::updateTSRecordNum().

00039 { return fTSPacketCount; }

void MPEG2TransportStreamFramer::changeInputSource ( FramedSource newInputSource  )  [inline]

Definition at line 41 of file MPEG2TransportStreamFramer.hh.

References FramedFilter::fInputSource.

Referenced by ClientTrickPlayState::updateStateOnScaleChange().

00041 { fInputSource = newInputSource; }

void MPEG2TransportStreamFramer::clearPIDStatusTable (  ) 

Definition at line 71 of file MPEG2TransportStreamFramer.cpp.

References fPIDStatusTable, NULL, and HashTable::RemoveNext().

Referenced by doStopGettingFrames(), ClientTrickPlayState::updateStateFromNPT(), and ~MPEG2TransportStreamFramer().

00071                                                      {
00072   PIDStatus* pidStatus;
00073   while ((pidStatus = (PIDStatus*)fPIDStatusTable->RemoveNext()) != NULL) {
00074     delete pidStatus;
00075   }
00076 }

void MPEG2TransportStreamFramer::doGetNextFrame (  )  [private, virtual]

Implements FramedSource.

Definition at line 78 of file MPEG2TransportStreamFramer.cpp.

References afterGettingFrame(), FramedSource::fFrameSize, FramedFilter::fInputSource, FramedSource::fMaxSize, FramedSource::fTo, FramedSource::getNextFrame(), and FramedSource::handleClosure().

00078                                                 {
00079   // Read directly from our input source into our client's buffer:
00080   fFrameSize = 0;
00081   fInputSource->getNextFrame(fTo, fMaxSize,
00082                              afterGettingFrame, this,
00083                              FramedSource::handleClosure, this);
00084 }

void MPEG2TransportStreamFramer::doStopGettingFrames (  )  [private, virtual]

Reimplemented from FramedFilter.

Definition at line 86 of file MPEG2TransportStreamFramer.cpp.

References clearPIDStatusTable(), FramedFilter::doStopGettingFrames(), fTSPacketCount, and fTSPCRCount.

00086                                                      {
00087   FramedFilter::doStopGettingFrames();
00088   fTSPacketCount = 0;
00089   fTSPCRCount = 0;
00090 
00091   clearPIDStatusTable();
00092 }

void MPEG2TransportStreamFramer::afterGettingFrame ( void *  clientData,
unsigned  frameSize,
unsigned  numTruncatedBytes,
struct timeval  presentationTime,
unsigned  durationInMicroseconds 
) [static, private]

Definition at line 95 of file MPEG2TransportStreamFramer.cpp.

References afterGettingFrame1().

Referenced by afterGettingFrame1(), and doGetNextFrame().

00098                                                          {
00099   MPEG2TransportStreamFramer* framer = (MPEG2TransportStreamFramer*)clientData;
00100   framer->afterGettingFrame1(frameSize, presentationTime);
00101 }

void MPEG2TransportStreamFramer::afterGettingFrame1 ( unsigned  frameSize,
struct timeval  presentationTime 
) [private]

Definition at line 105 of file MPEG2TransportStreamFramer.cpp.

References FramedSource::afterGetting(), afterGettingFrame(), Medium::envir(), FramedSource::fDurationInMicroseconds, FramedSource::fFrameSize, FramedFilter::fInputSource, FramedSource::fPresentationTime, FramedSource::fTo, fTSPacketDurationEstimate, FramedSource::getNextFrame(), FramedSource::handleClosure(), NULL, TRANSPORT_PACKET_SIZE, TRANSPORT_SYNC_BYTE, and updateTSPacketDurationEstimate().

Referenced by afterGettingFrame().

00106                                                                                      {
00107   fFrameSize += frameSize;
00108   unsigned const numTSPackets = fFrameSize/TRANSPORT_PACKET_SIZE;
00109   fFrameSize = numTSPackets*TRANSPORT_PACKET_SIZE; // an integral # of TS packets
00110   if (fFrameSize == 0) {
00111     // We didn't read a complete TS packet; assume that the input source has closed.
00112     handleClosure(this);
00113     return;
00114   }
00115 
00116   // Make sure the data begins with a sync byte:
00117   unsigned syncBytePosition;
00118   for (syncBytePosition = 0; syncBytePosition < fFrameSize; ++syncBytePosition) {
00119     if (fTo[syncBytePosition] == TRANSPORT_SYNC_BYTE) break;
00120   }
00121   if (syncBytePosition == fFrameSize) {
00122     envir() << "No Transport Stream sync byte in data.";
00123     handleClosure(this);
00124     return;
00125   } else if (syncBytePosition > 0) {
00126     // There's a sync byte, but not at the start of the data.  Move the good data
00127     // to the start of the buffer, then read more to fill it up again:
00128     memmove(fTo, &fTo[syncBytePosition], fFrameSize - syncBytePosition);
00129     fFrameSize -= syncBytePosition;
00130     fInputSource->getNextFrame(&fTo[fFrameSize], syncBytePosition,
00131                                afterGettingFrame, this,
00132                                FramedSource::handleClosure, this);
00133     return;
00134   } // else normal case: the data begins with a sync byte
00135 
00136   fPresentationTime = presentationTime;
00137 
00138   // Scan through the TS packets that we read, and update our estimate of
00139   // the duration of each packet:
00140   struct timeval tvNow;
00141   gettimeofday(&tvNow, NULL);
00142   double timeNow = tvNow.tv_sec + tvNow.tv_usec/1000000.0;
00143   for (unsigned i = 0; i < numTSPackets; ++i) {
00144     updateTSPacketDurationEstimate(&fTo[i*TRANSPORT_PACKET_SIZE], timeNow);
00145   }
00146 
00147   fDurationInMicroseconds
00148     = numTSPackets * (unsigned)(fTSPacketDurationEstimate*1000000);
00149 
00150   // Complete the delivery to our client:
00151   afterGetting(this);
00152 }

void MPEG2TransportStreamFramer::updateTSPacketDurationEstimate ( unsigned char *  pkt,
double  timeNow 
) [private]

Definition at line 155 of file MPEG2TransportStreamFramer.cpp.

References HashTable::Add(), Medium::envir(), PIDStatus::firstClock, PIDStatus::firstRealTime, fPIDStatusTable, fTSPacketCount, fTSPacketDurationEstimate, fTSPCRCount, PIDStatus::lastClock, PIDStatus::lastPacketNum, PIDStatus::lastRealTime, HashTable::Lookup(), MAX_PLAYOUT_BUFFER_DURATION, NEW_DURATION_WEIGHT, NULL, PCR_PERIOD_VARIATION_RATIO, TIME_ADJUSTMENT_FACTOR, and TRANSPORT_SYNC_BYTE.

Referenced by afterGettingFrame1().

00155                                                                    {
00156   // Sanity check: Make sure we start with the sync byte:
00157   if (pkt[0] != TRANSPORT_SYNC_BYTE) {
00158     envir() << "Missing sync byte!\n";
00159     return;
00160   }
00161 
00162   ++fTSPacketCount;
00163 
00164   // If this packet doesn't contain a PCR, then we're not interested in it:
00165   u_int8_t const adaptation_field_control = (pkt[3]&0x30)>>4;
00166   if (adaptation_field_control != 2 && adaptation_field_control != 3) return;
00167       // there's no adaptation_field
00168 
00169   u_int8_t const adaptation_field_length = pkt[4];
00170   if (adaptation_field_length == 0) return;
00171 
00172   u_int8_t const discontinuity_indicator = pkt[5]&0x80;
00173   u_int8_t const pcrFlag = pkt[5]&0x10;
00174   if (pcrFlag == 0) return; // no PCR
00175 
00176   // There's a PCR.  Get it, and the PID:
00177   ++fTSPCRCount;
00178   u_int32_t pcrBaseHigh = (pkt[6]<<24)|(pkt[7]<<16)|(pkt[8]<<8)|pkt[9];
00179   double clock = pcrBaseHigh/45000.0;
00180   if ((pkt[10]&0x80) != 0) clock += 1/90000.0; // add in low-bit (if set)
00181   unsigned short pcrExt = ((pkt[10]&0x01)<<8) | pkt[11];
00182   clock += pcrExt/27000000.0;
00183 
00184   unsigned pid = ((pkt[1]&0x1F)<<8) | pkt[2];
00185 
00186   // Check whether we already have a record of a PCR for this PID:
00187   PIDStatus* pidStatus = (PIDStatus*)(fPIDStatusTable->Lookup((char*)pid));
00188 
00189   if (pidStatus == NULL) {
00190     // We're seeing this PID's PCR for the first time:
00191     pidStatus = new PIDStatus(clock, timeNow);
00192     fPIDStatusTable->Add((char*)pid, pidStatus);
00193 #ifdef DEBUG_PCR
00194     fprintf(stderr, "PID 0x%x, FIRST PCR 0x%08x+%d:%03x == %f @ %f, pkt #%lu\n", pid, pcrBaseHigh, pkt[10]>>7, pcrExt, clock, timeNow, fTSPacketCount);
00195 #endif
00196   } else {
00197     // We've seen this PID's PCR before; update our per-packet duration estimate:
00198     double durationPerPacket
00199       = (clock - pidStatus->lastClock)/(fTSPacketCount - pidStatus->lastPacketNum);
00200 
00201     // Hack (suggested by "Romain"): Don't update our estimate if this PCR appeared unusually quickly.
00202     // (This can produce more accurate estimates for wildly VBR streams.)
00203     double meanPCRPeriod = 0.0;
00204     if (fTSPCRCount > 0) {
00205       meanPCRPeriod=(double)fTSPacketCount/fTSPCRCount;
00206       if (fTSPacketCount - pidStatus->lastPacketNum < meanPCRPeriod*PCR_PERIOD_VARIATION_RATIO) return;
00207     }
00208 
00209     if (fTSPacketDurationEstimate == 0.0) { // we've just started
00210       fTSPacketDurationEstimate = durationPerPacket;
00211     } else if (discontinuity_indicator == 0 && durationPerPacket >= 0.0) {
00212       fTSPacketDurationEstimate
00213         = durationPerPacket*NEW_DURATION_WEIGHT
00214         + fTSPacketDurationEstimate*(1-NEW_DURATION_WEIGHT);
00215 
00216       // Also adjust the duration estimate to try to ensure that the transmission
00217       // rate matches the playout rate:
00218       double transmitDuration = timeNow - pidStatus->firstRealTime;
00219       double playoutDuration = clock - pidStatus->firstClock;
00220       if (transmitDuration > playoutDuration) {
00221         fTSPacketDurationEstimate *= TIME_ADJUSTMENT_FACTOR; // reduce estimate
00222       } else if (transmitDuration + MAX_PLAYOUT_BUFFER_DURATION < playoutDuration) {
00223         fTSPacketDurationEstimate /= TIME_ADJUSTMENT_FACTOR; // increase estimate
00224       }
00225     } else {
00226       // the PCR has a discontinuity from its previous value; don't use it now,
00227       // but reset our PCR and real-time values to compensate:
00228       pidStatus->firstClock = clock;
00229       pidStatus->firstRealTime = timeNow;
00230     }
00231 #ifdef DEBUG_PCR
00232     fprintf(stderr, "PID 0x%x, PCR 0x%08x+%d:%03x == %f @ %f (diffs %f @ %f), pkt #%lu, discon %d => this duration %f, new estimate %f, mean PCR period=%f\n", pid, pcrBaseHigh, pkt[10]>>7, pcrExt, clock, timeNow, clock - pidStatus->firstClock, timeNow - pidStatus->firstRealTime, fTSPacketCount, discontinuity_indicator != 0, durationPerPacket, fTSPacketDurationEstimate, meanPCRPeriod );
00233 #endif
00234   }
00235 
00236   pidStatus->lastClock = clock;
00237   pidStatus->lastRealTime = timeNow;
00238   pidStatus->lastPacketNum = fTSPacketCount;
00239 }

FramedSource* FramedFilter::inputSource (  )  const [inline, inherited]

Definition at line 30 of file FramedFilter.hh.

References FramedFilter::fInputSource.

Referenced by AC3AudioStreamFramer::AC3AudioStreamFramer(), EndianSwap16::createNew(), HostFromNetworkOrder16::createNew(), NetworkFromHostOrder16::createNew(), PCMFromuLawAudioSource::createNew(), QCELPDeinterleaver::createNew(), MPEG4VideoStreamFramer::createNew(), MPEG4VideoStreamDiscreteFramer::createNew(), MPEG2IFrameIndexFromTransportStream::createNew(), MPEG1or2VideoStreamFramer::createNew(), MPEG1or2VideoStreamDiscreteFramer::createNew(), MPEG1or2AudioStreamFramer::createNew(), MP3Transcoder::createNew(), MP3ADUTranscoder::createNew(), MP3ADUdeinterleaver::createNew(), MP3ADUinterleaver::createNew(), MP3FromADUSource::createNew(), ADUFromMP3Source::createNew(), H263plusVideoStreamFramer::createNew(), AC3AudioStreamFramer::createNew(), H264VideoRTPSink::doSpecialFrameHandling(), MP3ADUinterleaverBase::getInputSource(), H263plusVideoStreamFramer::H263plusVideoStreamFramer(), MPEG1or2VideoStreamFramer::MPEG1or2VideoStreamFramer(), MPEG4VideoStreamFramer::MPEG4VideoStreamFramer(), MP3AudioFileServerMediaSubsession::seekStreamSource(), ClientTrickPlayState::setSource(), and MP3AudioFileServerMediaSubsession::setStreamSourceScale().

00030 { return fInputSource; }

char const * FramedFilter::MIMEtype (  )  const [protected, virtual, inherited]

Reimplemented from MediaSource.

Reimplemented in ADUFromMP3Source, and MP3FromADUSource.

Definition at line 39 of file FramedFilter.cpp.

References FramedFilter::fInputSource, MediaSource::MIMEtype(), and NULL.

00039                                          {
00040   if (fInputSource == NULL) return "";
00041 
00042   return fInputSource->MIMEtype();
00043 }

void FramedFilter::getAttributes (  )  const [protected, virtual, inherited]

Reimplemented from MediaSource.

Reimplemented in MP3ADUTranscoder.

Definition at line 45 of file FramedFilter.cpp.

References FramedFilter::fInputSource, MediaSource::getAttributes(), and NULL.

00045                                        {
00046   if (fInputSource != NULL) fInputSource->getAttributes();
00047 }

Boolean FramedSource::lookupByName ( UsageEnvironment env,
char const *  sourceName,
FramedSource *&  resultSource 
) [static, inherited]

Definition at line 41 of file FramedSource.cpp.

References env, False, MediaSource::isFramedSource(), MediaSource::lookupByName(), NULL, and True.

Referenced by MP3ADUinterleaverBase::getInputSource().

00042                                                                 {
00043   resultSource = NULL; // unless we succeed
00044 
00045   MediaSource* source;
00046   if (!MediaSource::lookupByName(env, sourceName, source)) return False;
00047 
00048   if (!source->isFramedSource()) {
00049     env.setResultMsg(sourceName, " is not a framed source");
00050     return False;
00051   }
00052 
00053   resultSource = (FramedSource*)source;
00054   return True;
00055 }

Boolean MediaSource::lookupByName ( UsageEnvironment env,
char const *  sourceName,
MediaSource *&  resultSource 
) [static, inherited]

Definition at line 62 of file MediaSource.cpp.

References env, False, Medium::isSource(), Medium::lookupByName(), NULL, and True.

Referenced by RTPSource::lookupByName(), and FramedSource::lookupByName().

00064                                                               {
00065   resultSource = NULL; // unless we succeed
00066 
00067   Medium* medium;
00068   if (!Medium::lookupByName(env, sourceName, medium)) return False;
00069 
00070   if (!medium->isSource()) {
00071     env.setResultMsg(sourceName, " is not a media source");
00072     return False;
00073   }
00074 
00075   resultSource = (MediaSource*)medium;
00076   return True;
00077 }

Boolean Medium::lookupByName ( UsageEnvironment env,
char const *  mediumName,
Medium *&  resultMedium 
) [static, inherited]

Definition at line 65 of file Media.cpp.

References env, False, MediaLookupTable::lookup(), NULL, MediaLookupTable::ourMedia(), UsageEnvironment::setResultMsg(), and True.

Referenced by ServerMediaSession::lookupByName(), RTSPServer::lookupByName(), RTSPClient::lookupByName(), RTCPInstance::lookupByName(), MediaSource::lookupByName(), MediaSink::lookupByName(), MediaSession::lookupByName(), and DarwinInjector::lookupByName().

00066                                                          {
00067   resultMedium = MediaLookupTable::ourMedia(env)->lookup(mediumName);
00068   if (resultMedium == NULL) {
00069     env.setResultMsg("Medium ", mediumName, " does not exist");
00070     return False;
00071   }
00072 
00073   return True;
00074 }

void FramedSource::getNextFrame ( unsigned char *  to,
unsigned  maxSize,
afterGettingFunc afterGettingFunc,
void *  afterGettingClientData,
onCloseFunc onCloseFunc,
void *  onCloseClientData 
) [inherited]

Definition at line 57 of file FramedSource.cpp.

References FramedSource::doGetNextFrame(), Medium::envir(), FramedSource::fAfterGettingClientData, FramedSource::fAfterGettingFunc, FramedSource::fDurationInMicroseconds, FramedSource::fIsCurrentlyAwaitingData, FramedSource::fMaxSize, FramedSource::fNumTruncatedBytes, FramedSource::fOnCloseClientData, FramedSource::fOnCloseFunc, FramedSource::fTo, and True.

Referenced by afterGettingFrame1(), InputESSourceRecord::askForNewData(), MPEG2TransportStreamFromPESSource::awaitNewBuffer(), QuickTimeFileSink::continuePlaying(), DummySink::continuePlaying(), HTTPSink::continuePlaying(), FileSink::continuePlaying(), AVIFileSink::continuePlaying(), BasicUDPSink::continuePlaying1(), EndianSwap16::doGetNextFrame(), HostFromNetworkOrder16::doGetNextFrame(), NetworkFromHostOrder16::doGetNextFrame(), PCMFromuLawAudioSource::doGetNextFrame(), uLawFromPCMAudioSource::doGetNextFrame(), QCELPDeinterleaver::doGetNextFrame(), MPEG4VideoStreamDiscreteFramer::doGetNextFrame(), doGetNextFrame(), MPEG2IFrameIndexFromTransportStream::doGetNextFrame(), MPEG1or2VideoStreamDiscreteFramer::doGetNextFrame(), MP3ADUTranscoder::doGetNextFrame(), MP3ADUdeinterleaver::doGetNextFrame(), MP3ADUinterleaver::doGetNextFrame(), H264FUAFragmenter::doGetNextFrame(), ByteStreamMultiFileSource::doGetNextFrame(), AMRDeinterleaver::doGetNextFrame(), SegmentQueue::enqueueNewSegment(), StreamParser::ensureValidBytes1(), MultiFramedRTPSink::packFrame(), AC3AudioStreamParser::readAndSaveAFrame(), and MPEG2TransportStreamTrickModeFilter::readTransportPacket().

00061                                                          {
00062   // Make sure we're not already being read:
00063   if (fIsCurrentlyAwaitingData) {
00064     envir() << "FramedSource[" << this << "]::getNextFrame(): attempting to read more than once at the same time!\n";
00065     exit(1);
00066   }
00067 
00068   fTo = to;
00069   fMaxSize = maxSize;
00070   fNumTruncatedBytes = 0; // by default; could be changed by doGetNextFrame()
00071   fDurationInMicroseconds = 0; // by default; could be changed by doGetNextFrame()
00072   fAfterGettingFunc = afterGettingFunc;
00073   fAfterGettingClientData = afterGettingClientData;
00074   fOnCloseFunc = onCloseFunc;
00075   fOnCloseClientData = onCloseClientData;
00076   fIsCurrentlyAwaitingData = True;
00077 
00078   doGetNextFrame();
00079 }

void FramedSource::handleClosure ( void *  clientData  )  [static, inherited]

Definition at line 95 of file FramedSource.cpp.

References False, FramedSource::fIsCurrentlyAwaitingData, FramedSource::fOnCloseClientData, FramedSource::fOnCloseFunc, and NULL.

Referenced by afterGettingFrame1(), MP3ADUTranscoder::afterGettingFrame1(), InputESSourceRecord::askForNewData(), MPEG2TransportStreamFromPESSource::awaitNewBuffer(), WAVAudioFileSource::doGetNextFrame(), EndianSwap16::doGetNextFrame(), HostFromNetworkOrder16::doGetNextFrame(), NetworkFromHostOrder16::doGetNextFrame(), PCMFromuLawAudioSource::doGetNextFrame(), uLawFromPCMAudioSource::doGetNextFrame(), QCELPDeinterleaver::doGetNextFrame(), MPEG4VideoStreamDiscreteFramer::doGetNextFrame(), doGetNextFrame(), MPEG1or2VideoStreamDiscreteFramer::doGetNextFrame(), MPEG1or2DemuxedElementaryStream::doGetNextFrame(), MP3FileSource::doGetNextFrame(), MP3ADUTranscoder::doGetNextFrame(), MP3ADUdeinterleaver::doGetNextFrame(), MP3ADUinterleaver::doGetNextFrame(), ADUFromMP3Source::doGetNextFrame(), H264FUAFragmenter::doGetNextFrame(), DeviceSource::doGetNextFrame(), ByteStreamMultiFileSource::doGetNextFrame(), ByteStreamFileSource::doGetNextFrame(), AMRDeinterleaver::doGetNextFrame(), AMRAudioFileSource::doGetNextFrame(), ADTSAudioFileSource::doGetNextFrame(), ByteStreamFileSource::doReadFromFile(), SegmentQueue::enqueueNewSegment(), MPEG2IFrameIndexFromTransportStream::handleInputClosure1(), and MPEG2TransportStreamTrickModeFilter::onSourceClosure1().

00095                                                  {
00096   FramedSource* source = (FramedSource*)clientData;
00097   source->fIsCurrentlyAwaitingData = False; // because we got a close instead
00098   if (source->fOnCloseFunc != NULL) {
00099     (*(source->fOnCloseFunc))(source->fOnCloseClientData);
00100   }
00101 }

void FramedSource::stopGettingFrames (  )  [inherited]

Definition at line 103 of file FramedSource.cpp.

References FramedSource::doStopGettingFrames(), False, and FramedSource::fIsCurrentlyAwaitingData.

Referenced by MPEG2TransportStreamFromPESSource::doStopGettingFrames(), FramedFilter::doStopGettingFrames(), AMRDeinterleaver::doStopGettingFrames(), and MediaSink::stopPlaying().

00103                                      {
00104   fIsCurrentlyAwaitingData = False; // indicates that we can be read again
00105 
00106   // Perform any specialized action now:
00107   doStopGettingFrames();
00108 }

unsigned FramedSource::maxFrameSize (  )  const [virtual, inherited]

Reimplemented in MPEG1or2DemuxedElementaryStream.

Definition at line 116 of file FramedSource.cpp.

Referenced by StreamParser::ensureValidBytes1().

00116                                           {
00117   // By default, this source has no maximum frame size.
00118   return 0;
00119 }

Boolean FramedSource::isCurrentlyAwaitingData (  )  const [inline, inherited]

Definition at line 60 of file FramedSource.hh.

References FramedSource::fIsCurrentlyAwaitingData.

Referenced by afterPlaying(), InputESSourceRecord::askForNewData(), MPEG2TransportStreamFromESSource::awaitNewBuffer(), QuickTimeFileSink::continuePlaying(), AVIFileSink::continuePlaying(), DeviceSource::deliverFrame(), QCELPDeinterleaver::doGetNextFrame(), AMRDeinterleaver::doGetNextFrame(), ByteStreamFileSource::fileReadableHandler(), and BasicUDPSource::incomingPacketHandler1().

00060 {return fIsCurrentlyAwaitingData;}

void FramedSource::afterGetting ( FramedSource source  )  [static, protected, inherited]

Definition at line 81 of file FramedSource.cpp.

References FramedSource::fAfterGettingClientData, FramedSource::fAfterGettingFunc, False, FramedSource::fDurationInMicroseconds, FramedSource::fFrameSize, FramedSource::fIsCurrentlyAwaitingData, FramedSource::fNumTruncatedBytes, FramedSource::fPresentationTime, and NULL.

Referenced by ByteStreamMultiFileSource::afterGettingFrame(), EndianSwap16::afterGettingFrame1(), HostFromNetworkOrder16::afterGettingFrame1(), NetworkFromHostOrder16::afterGettingFrame1(), PCMFromuLawAudioSource::afterGettingFrame1(), uLawFromPCMAudioSource::afterGettingFrame1(), afterGettingFrame1(), MPEG1or2DemuxedElementaryStream::afterGettingFrame1(), MP3ADUTranscoder::afterGettingFrame1(), MPEG2TransportStreamTrickModeFilter::attemptDeliveryToClient(), MPEGVideoStreamFramer::continueReadProcessing(), MPEG1or2AudioStreamFramer::continueReadProcessing(), H263plusVideoStreamFramer::continueReadProcessing(), DeviceSource::deliverFrame(), MPEG2IFrameIndexFromTransportStream::deliverIndexRecord(), WAVAudioFileSource::doGetNextFrame(), QCELPDeinterleaver::doGetNextFrame(), MPEG2TransportStreamTrickModeFilter::doGetNextFrame(), MPEG2TransportStreamMultiplexor::doGetNextFrame(), MP3FileSource::doGetNextFrame(), MP3ADUdeinterleaver::doGetNextFrame(), MP3ADUinterleaver::doGetNextFrame(), MP3FromADUSource::doGetNextFrame(), H264FUAFragmenter::doGetNextFrame(), AMRDeinterleaver::doGetNextFrame(), AMRAudioFileSource::doGetNextFrame(), ADTSAudioFileSource::doGetNextFrame(), MultiFramedRTPSource::doGetNextFrame1(), ADUFromMP3Source::doGetNextFrame1(), ByteStreamFileSource::doReadFromFile(), BasicUDPSource::incomingPacketHandler1(), and AC3AudioStreamFramer::parseNextFrame().

00081                                                     {
00082   source->fIsCurrentlyAwaitingData = False;
00083       // indicates that we can be read again
00084       // Note that this needs to be done here, in case the "fAfterFunc"
00085       // called below tries to read another frame (which it usually will)
00086 
00087   if (source->fAfterGettingFunc != NULL) {
00088     (*(source->fAfterGettingFunc))(source->fAfterGettingClientData,
00089                                    source->fFrameSize, source->fNumTruncatedBytes,
00090                                    source->fPresentationTime,
00091                                    source->fDurationInMicroseconds);
00092   }
00093 }

Boolean MediaSource::isRTPSource (  )  const [virtual, inherited]

Reimplemented in RTPSource.

Definition at line 43 of file MediaSource.cpp.

References False.

Referenced by RTPSource::lookupByName().

00043                                        {
00044   return False; // default implementation
00045 }

Boolean MediaSource::isMPEG1or2VideoStreamFramer (  )  const [virtual, inherited]

Reimplemented in MPEG1or2VideoStreamFramer.

Definition at line 46 of file MediaSource.cpp.

References False.

Referenced by MPEG1or2VideoRTPSink::sourceIsCompatibleWithUs().

00046                                                        {
00047   return False; // default implementation
00048 }

Boolean MediaSource::isMPEG4VideoStreamFramer (  )  const [virtual, inherited]

Reimplemented in MPEG4VideoStreamFramer.

Definition at line 49 of file MediaSource.cpp.

References False.

Referenced by MPEG4ESVideoRTPSink::sourceIsCompatibleWithUs().

00049                                                     {
00050   return False; // default implementation
00051 }

Boolean MediaSource::isH264VideoStreamFramer (  )  const [virtual, inherited]

Reimplemented in H264VideoStreamFramer.

Definition at line 52 of file MediaSource.cpp.

References False.

Referenced by H264VideoRTPSink::sourceIsCompatibleWithUs().

00052                                                    {
00053   return False; // default implementation
00054 }

Boolean MediaSource::isJPEGVideoSource (  )  const [virtual, inherited]

Reimplemented in JPEGVideoSource.

Definition at line 55 of file MediaSource.cpp.

References False.

Referenced by JPEGVideoRTPSink::sourceIsCompatibleWithUs().

00055                                              {
00056   return False; // default implementation
00057 }

Boolean MediaSource::isAMRAudioSource (  )  const [virtual, inherited]

Reimplemented in AMRAudioSource.

Definition at line 58 of file MediaSource.cpp.

References False.

Referenced by AMRAudioRTPSink::sourceIsCompatibleWithUs(), and AMRAudioFileSink::sourceIsCompatibleWithUs().

00058                                             {
00059   return False; // default implementation
00060 }

void Medium::close ( UsageEnvironment env,
char const *  mediumName 
) [static, inherited]

Definition at line 76 of file Media.cpp.

References env, MediaLookupTable::ourMedia(), and MediaLookupTable::remove().

Referenced by afterPlaying(), Medium::close(), closeMediaSinks(), OnDemandServerMediaSubsession::closeStreamSource(), WAVAudioFileSource::createNew(), QuickTimeFileSink::createNew(), QCELPAudioRTPSource::createNew(), MP3HTTPSource::createNew(), MP3FileSource::createNew(), AVIFileSink::createNew(), AMRAudioRTPSource::createNew(), WAVAudioFileServerMediaSubsession::createNewStreamSource(), MPEG1or2DemuxedServerMediaSubsession::createNewStreamSource(), MediaSubsession::deInitiate(), MediaSubsession::initiate(), MPEG1or2ProgramStreamFileDuration(), MPEG1or2Demux::noteElementaryStreamDeletion(), ByteStreamMultiFileSource::onSourceClosure1(), StreamState::reclaim(), RTSPServer::removeServerMediaSession(), OnDemandServerMediaSubsession::sdpLines(), shutdown(), H264VideoRTPSink::stopPlaying(), subsessionAfterPlaying(), ClientTrickPlayState::updateStateOnScaleChange(), AMRDeinterleaver::~AMRDeinterleaver(), ByteStreamMultiFileSource::~ByteStreamMultiFileSource(),