RawAMRRTPSource Class Reference

Inheritance diagram for RawAMRRTPSource:

Inheritance graph
[legend]
Collaboration diagram for RawAMRRTPSource:

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

Boolean isWideband () const
unsigned char ILL () const
unsigned char ILP () const
unsigned TOCSize () const
unsigned char * TOC () const
unsigned & frameIndex ()
BooleanisSynchronized ()
Boolean curPacketMarkerBit () const
unsigned char rtpPayloadFormat () const
GroupsockRTPgs () const
u_int32_t SSRC () const
unsigned timestampFrequency () const
RTPReceptionStatsDBreceptionStatsDB () const
u_int32_t lastReceivedSSRC () const
void setStreamSocket (int sockNum, unsigned char streamChannelId)
void setAuxilliaryReadHandler (AuxHandlerFunc *handlerFunc, void *handlerClientData)
u_int16_t curPacketRTPSeqNum () const
u_int32_t curPacketRTPTimestamp () 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 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 RawAMRRTPSourcecreateNew (UsageEnvironment &env, Groupsock *RTPgs, unsigned char rtpPayloadFormat, Boolean isWideband, Boolean isOctetAligned, Boolean isInterleaved, Boolean CRCsArePresent)
static Boolean lookupByName (UsageEnvironment &env, char const *sourceName, RTPSource *&resultSource)
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

virtual Boolean packetIsUsableInJitterCalculation (unsigned char *packet, unsigned packetSize)
virtual void doStopGettingFrames ()
TaskTokennextTask ()

Static Protected Member Functions

static void afterGetting (FramedSource *source)

Protected Attributes

Boolean fCurrentPacketBeginsFrame
Boolean fCurrentPacketCompletesFrame
RTPInterface fRTPInterface
u_int16_t fCurPacketRTPSeqNum
u_int32_t fCurPacketRTPTimestamp
Boolean fCurPacketMarkerBit
Boolean fCurPacketHasBeenSynchronizedUsingRTCP
u_int32_t fLastReceivedSSRC
unsigned char * fTo
unsigned fMaxSize
unsigned fFrameSize
unsigned fNumTruncatedBytes
timeval fPresentationTime
unsigned fDurationInMicroseconds

Private Member Functions

 RawAMRRTPSource (UsageEnvironment &env, Groupsock *RTPgs, unsigned char rtpPayloadFormat, Boolean isWideband, Boolean isOctetAligned, Boolean isInterleaved, Boolean CRCsArePresent)
virtual ~RawAMRRTPSource ()
virtual Boolean hasBeenSynchronizedUsingRTCP ()
virtual Boolean processSpecialHeader (BufferedPacket *packet, unsigned &resultSpecialHeaderSize)
virtual char const * MIMEtype () const

Private Attributes

Boolean fIsWideband
Boolean fIsOctetAligned
Boolean fIsInterleaved
Boolean fCRCsArePresent
unsigned char fILL
unsigned char fILP
unsigned fTOCSize
unsigned char * fTOC
unsigned fFrameIndex
unsigned fNumSuccessiveSyncedPackets
Boolean fIsSynchronized

Detailed Description

Definition at line 32 of file AMRAudioRTPSource.cpp.


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

RawAMRRTPSource::RawAMRRTPSource ( UsageEnvironment env,
Groupsock RTPgs,
unsigned char  rtpPayloadFormat,
Boolean  isWideband,
Boolean  isOctetAligned,
Boolean  isInterleaved,
Boolean  CRCsArePresent 
) [private]

Definition at line 210 of file AMRAudioRTPSource.cpp.

Referenced by createNew().

00214   : MultiFramedRTPSource(env, RTPgs, rtpPayloadFormat,
00215                          isWideband ? 16000 : 8000,
00216                          new AMRBufferedPacketFactory),
00217   fIsWideband(isWideband), fIsOctetAligned(isOctetAligned),
00218   fIsInterleaved(isInterleaved), fCRCsArePresent(CRCsArePresent),
00219   fILL(0), fILP(0), fTOCSize(0), fTOC(NULL), fFrameIndex(0),
00220     fNumSuccessiveSyncedPackets(0), fIsSynchronized(false) {
00221 }

RawAMRRTPSource::~RawAMRRTPSource (  )  [private, virtual]

Definition at line 223 of file AMRAudioRTPSource.cpp.

References fTOC.

00223                                   {
00224   delete[] fTOC;
00225 }


Member Function Documentation

RawAMRRTPSource * RawAMRRTPSource::createNew ( UsageEnvironment env,
Groupsock RTPgs,
unsigned char  rtpPayloadFormat,
Boolean  isWideband,
Boolean  isOctetAligned,
Boolean  isInterleaved,
Boolean  CRCsArePresent 
) [static]

Definition at line 200 of file AMRAudioRTPSource.cpp.

References env, RawAMRRTPSource(), and RTPSource::RTPgs().

Referenced by AMRAudioRTPSource::createNew().

00203                                                                           {
00204   return new RawAMRRTPSource(env, RTPgs, rtpPayloadFormat,
00205                              isWideband, isOctetAligned,
00206                              isInterleaved, CRCsArePresent);
00207 }

Boolean RawAMRRTPSource::isWideband (  )  const [inline]

Definition at line 40 of file AMRAudioRTPSource.cpp.

References fIsWideband.

Referenced by AMRBufferedPacket::nextEnclosedFrameSize().

00040 { return fIsWideband; }

unsigned char RawAMRRTPSource::ILL (  )  const [inline]

Definition at line 41 of file AMRAudioRTPSource.cpp.

References fILL.

Referenced by AMRDeinterleavingBuffer::deliverIncomingFrame().

00041 { return fILL; }

unsigned char RawAMRRTPSource::ILP (  )  const [inline]

Definition at line 42 of file AMRAudioRTPSource.cpp.

References fILP.

Referenced by AMRDeinterleavingBuffer::deliverIncomingFrame().

00042 { return fILP; }

unsigned RawAMRRTPSource::TOCSize (  )  const [inline]

Definition at line 43 of file AMRAudioRTPSource.cpp.

References fTOCSize.

Referenced by AMRDeinterleavingBuffer::deliverIncomingFrame(), and AMRBufferedPacket::nextEnclosedFrameSize().

00043 { return fTOCSize; } // total # of frames in the last pkt

unsigned char* RawAMRRTPSource::TOC (  )  const [inline]

Definition at line 44 of file AMRAudioRTPSource.cpp.

References fTOC.

Referenced by AMRDeinterleavingBuffer::deliverIncomingFrame(), and AMRBufferedPacket::nextEnclosedFrameSize().

00044 { return fTOC; } // FT+Q value for each TOC entry

unsigned& RawAMRRTPSource::frameIndex (  )  [inline]

Definition at line 45 of file AMRAudioRTPSource.cpp.

References fFrameIndex.

Referenced by AMRDeinterleavingBuffer::deliverIncomingFrame(), and AMRBufferedPacket::nextEnclosedFrameSize().

00045 { return fFrameIndex; } // index of frame-block within pkt

Boolean& RawAMRRTPSource::isSynchronized (  )  [inline]

Definition at line 46 of file AMRAudioRTPSource.cpp.

References fIsSynchronized.

Referenced by AMRDeinterleaver::doGetNextFrame().

00046 { return fIsSynchronized; }

Boolean RawAMRRTPSource::hasBeenSynchronizedUsingRTCP (  )  [private, virtual]

Reimplemented from RTPSource.

Definition at line 321 of file AMRAudioRTPSource.cpp.

References fIsSynchronized.

00321                                                       {
00322   return fIsSynchronized;
00323 }

Boolean RawAMRRTPSource::processSpecialHeader ( BufferedPacket packet,
unsigned &  resultSpecialHeaderSize 
) [private, virtual]

Reimplemented from MultiFramedRTPSource.

Definition at line 234 of file AMRAudioRTPSource.cpp.

References F, False, fCRCsArePresent, fFrameIndex, fILL, fILP, fIsInterleaved, fIsOctetAligned, fIsWideband, fNumSuccessiveSyncedPackets, FT_NO_DATA, FT_SPEECH_LOST, fTOC, fTOCSize, RTPSource::hasBeenSynchronizedUsingRTCP(), True, and unpackBandwidthEfficientData().

00235                                                           {
00236   // If the data is 'bandwidth-efficient', first unpack it so that it's
00237   // 'octet-aligned':
00238   if (!fIsOctetAligned) unpackBandwidthEfficientData(packet, fIsWideband);
00239 
00240   unsigned char* headerStart = packet->data();
00241   unsigned packetSize = packet->dataSize();
00242 
00243   // First, check whether this packet's RTP timestamp is synchronized:
00244   if (RTPSource::hasBeenSynchronizedUsingRTCP()) {
00245     ++fNumSuccessiveSyncedPackets;
00246   } else {
00247     fNumSuccessiveSyncedPackets = 0;
00248   }
00249 
00250   // There's at least a 1-byte header, containing the CMR:
00251   if (packetSize < 1) return False;
00252   resultSpecialHeaderSize = 1;
00253 
00254   if (fIsInterleaved) {
00255     // There's an extra byte, containing the interleave parameters:
00256     if (packetSize < 2) return False;
00257 
00258     // Get the interleaving parameters, and check them for validity:
00259     unsigned char const secondByte = headerStart[1];
00260     fILL = (secondByte&0xF0)>>4;
00261     fILP = secondByte&0x0F;
00262     if (fILP > fILL) return False; // invalid
00263     ++resultSpecialHeaderSize;
00264   }
00265 #ifdef DEBUG
00266   fprintf(stderr, "packetSize: %d, ILL: %d, ILP: %d\n", packetSize, fILL, fILP);
00267 #endif
00268   fFrameIndex = 0; // initially
00269 
00270   // Next, there's a "Payload Table of Contents" (one byte per entry):
00271   unsigned numFramesPresent = 0, numNonEmptyFramesPresent = 0;
00272   unsigned tocStartIndex = resultSpecialHeaderSize;
00273   Boolean F;
00274   do {
00275     if (resultSpecialHeaderSize >= packetSize) return False;
00276     unsigned char const tocByte = headerStart[resultSpecialHeaderSize++];
00277     F = (tocByte&0x80) != 0;
00278     unsigned char const FT = (tocByte&0x78) >> 3;
00279 #ifdef DEBUG
00280     unsigned char Q = (tocByte&0x04)>>2;
00281     fprintf(stderr, "\tTOC entry: F %d, FT %d, Q %d\n", F, FT, Q);
00282 #endif
00283     ++numFramesPresent;
00284     if (FT != FT_SPEECH_LOST && FT != FT_NO_DATA) ++numNonEmptyFramesPresent;
00285   } while (F);
00286 #ifdef DEBUG
00287   fprintf(stderr, "TOC contains %d entries (%d non-empty)\n", numFramesPresent, numNonEmptyFramesPresent);
00288 #endif
00289 
00290   // Now that we know the size of the TOC, fill in our copy:
00291   if (numFramesPresent > fTOCSize) {
00292     delete[] fTOC;
00293     fTOC = new unsigned char[numFramesPresent];
00294   }
00295   fTOCSize = numFramesPresent;
00296   for (unsigned i = 0; i < fTOCSize; ++i) {
00297     unsigned char const tocByte = headerStart[tocStartIndex + i];
00298     fTOC[i] = tocByte&0x7C; // clear everything except the F and Q fields
00299   }
00300 
00301   if (fCRCsArePresent) {
00302     // 'numNonEmptyFramesPresent' CRC bytes will follow.
00303     // Note: we currently don't check the CRCs for validity #####
00304     resultSpecialHeaderSize += numNonEmptyFramesPresent;
00305 #ifdef DEBUG
00306     fprintf(stderr, "Ignoring %d following CRC bytes\n", numNonEmptyFramesPresent);
00307 #endif
00308     if (resultSpecialHeaderSize > packetSize) return False;
00309   }
00310 #ifdef DEBUG
00311   fprintf(stderr, "Total special header size: %d\n", resultSpecialHeaderSize);
00312 #endif
00313 
00314   return True;
00315 }

char const * RawAMRRTPSource::MIMEtype (  )  const [private, virtual]

Reimplemented from MediaSource.

Definition at line 317 of file AMRAudioRTPSource.cpp.

References fIsWideband.

00317                                             {
00318   return fIsWideband ? "audio/AMR-WB" : "audio/AMR";
00319 }

Boolean MultiFramedRTPSource::packetIsUsableInJitterCalculation ( unsigned char *  packet,
unsigned  packetSize 
) [protected, virtual, inherited]

Reimplemented in MPEG1or2VideoRTPSource.

Definition at line 98 of file MultiFramedRTPSource.cpp.

References True.

Referenced by MultiFramedRTPSource::networkReadHandler().

00099                                                              {
00100   // Default implementation:
00101   return True;
00102 }

void MultiFramedRTPSource::doStopGettingFrames (  )  [protected, virtual, inherited]

Reimplemented from FramedSource.

Definition at line 104 of file MultiFramedRTPSource.cpp.

References MultiFramedRTPSource::fReorderingBuffer, RTPSource::fRTPInterface, MultiFramedRTPSource::reset(), ReorderingPacketBuffer::reset(), and RTPInterface::stopNetworkReading().

00104                                                {
00105   fRTPInterface.stopNetworkReading();
00106   fReorderingBuffer->reset();
00107   reset();
00108 }

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

Definition at line 26 of file RTPSource.cpp.

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

00028                                                           {
00029   resultSource = NULL; // unless we succeed
00030 
00031   MediaSource* source;
00032   if (!MediaSource::lookupByName(env, sourceName, source)) return False;
00033 
00034   if (!source->isRTPSource()) {
00035     env.setResultMsg(sourceName, " is not a RTP source");
00036     return False;
00037   }
00038 
00039   resultSource = (RTPSource*)source;
00040   return True;
00041 }

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 }

Boolean RTPSource::curPacketMarkerBit (  )  const [inline, inherited]

Definition at line 38 of file RTPSource.hh.

References RTPSource::fCurPacketMarkerBit.

Referenced by SubsessionIOState::useFrameForHinting().

00038 { return fCurPacketMarkerBit; }

unsigned char RTPSource::rtpPayloadFormat (  )  const [inline, inherited]

Definition at line 40 of file RTPSource.hh.

References RTPSource::fRTPPayloadFormat.

Referenced by QuickTimeFileSink::addAtom_hdlr2(), MultiFramedRTPSource::networkReadHandler(), and SubsessionIOState::useFrameForHinting().

00040 { return fRTPPayloadFormat; }

Groupsock* RTPSource::RTPgs (  )  const [inline, inherited]

Definition at line 44 of file RTPSource.hh.

References RTPSource::fRTPInterface, and RTPInterface::gs().

Referenced by SimpleRTPSource::createNew(), QuickTimeGenericRTPSource::createNew(), RawQCELPRTPSource::createNew(), MPEG4LATMAudioRTPSource::createNew(), MPEG4GenericRTPSource::createNew(), MPEG4ESVideoRTPSource::createNew(), MPEG1or2VideoRTPSource::createNew(), MPEG1or2AudioRTPSource::createNew(), MP3ADURTPSource::createNew(), JPEGVideoRTPSource::createNew(), H264VideoRTPSource::createNew(), H263plusVideoRTPSource::createNew(), H261VideoRTPSource::createNew(), createNew(), AC3AudioRTPSource::createNew(), and main().

00044 { return fRTPInterface.gs(); }

u_int32_t RTPSource::SSRC (  )  const [inline, inherited]

Definition at line 49 of file RTPSource.hh.

References RTPSource::fSSRC.

Referenced by RTCPInstance::addBYE(), RTCPInstance::addRR(), and RTCPInstance::addSDES().

00049 { return fSSRC; }

unsigned RTPSource::timestampFrequency (  )  const [inline, inherited]

Definition at line 53 of file RTPSource.hh.

References RTPSource::fTimestampFrequency.

Referenced by QuickTimeFileSink::addAtom_hdlr2(), MultiFramedRTPSource::networkReadHandler(), and RTPReceptionStats::noteIncomingPacket().

00053 {return fTimestampFrequency;}

RTPReceptionStatsDB& RTPSource::receptionStatsDB (  )  const [inline, inherited]

Definition at line 55 of file RTPSource.hh.

References RTPSource::fReceptionStatsDB.

Referenced by checkForPacketArrival(), checkInterPacketGaps(), RTCPInstance::enqueueCommonReportSuffix(), RTCPInstance::incomingReportHandler1(), MultiFramedRTPSource::networkReadHandler(), printQOSData(), qosMeasurementRecord::qosMeasurementRecord(), and RTCPInstance::removeSSRC().

00055                                                 {
00056     return *fReceptionStatsDB;
00057   }

u_int32_t RTPSource::lastReceivedSSRC (  )  const [inline, inherited]

Definition at line 59 of file RTPSource.hh.

References RTPSource::fLastReceivedSSRC.

00059 { return fLastReceivedSSRC; }

void RTPSource::setStreamSocket ( int  sockNum,
unsigned char  streamChannelId 
) [inline, inherited]

Definition at line 62 of file RTPSource.hh.

References RTPSource::fRTPInterface, and RTPInterface::setStreamSocket().

Referenced by RTSPClient::setupMediaSubsession().

00062                                                                    {
00063     // hack to allow sending RTP over TCP (RFC 2236, section 10.12)
00064     fRTPInterface.setStreamSocket(sockNum, streamChannelId);
00065   }

void RTPSource::setAuxilliaryReadHandler ( AuxHandlerFunc handlerFunc,
void *  handlerClientData 
) [inline, inherited]

Definition at line 67 of file RTPSource.hh.

References RTPSource::fRTPInterface, and RTPInterface::setAuxilliaryReadHandler().

00068                                                          {
00069     fRTPInterface.setAuxilliaryReadHandler(handlerFunc,
00070                                            handlerClientData);
00071   }

u_int16_t RTPSource::curPacketRTPSeqNum (  )  const [inline, inherited]

Definition at line 76 of file RTPSource.hh.

References RTPSource::fCurPacketRTPSeqNum.

Referenced by SubsessionIOState::afterGettingFrame(), AVISubsessionIOState::afterGettingFrame(), QCELPDeinterleaver::afterGettingFrame1(), and AMRDeinterleavingBuffer::deliverIncomingFrame().

00076 { return fCurPacketRTPSeqNum; }

u_int32_t RTPSource::curPacketRTPTimestamp (  )  const [inline, inherited]

Definition at line 77 of file RTPSource.hh.

References RTPSource::fCurPacketRTPTimestamp.

Referenced by MediaSubsession::getNormalPlayTime().

00077 { return fCurPacketRTPTimestamp; }

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 MPEG2TransportStreamFramer::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(), MPEG2TransportStreamFramer::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 MPEG2TransportStreamFramer::afterGettingFrame1(), MP3ADUTranscoder::afterGettingFrame1(), InputESSourceRecord::askForNewData(), MPEG2TransportStreamFromPESSource::awaitNewBuffer(), WAVAudioFileSource::doGetNextFrame(), EndianSwap16::doGetNextFrame(), HostFromNetworkOrder16::doGetNextFrame(), NetworkFromHostOrder16::doGetNextFrame(), PCMFromuLawAudioSource::doGetNextFrame(), uLawFromPCMAudioSource::doGetNextFrame(), QCELPDeinterleaver::doGetNextFrame(), MPEG4VideoStreamDiscreteFramer::doGetNextFrame(), MPEG2TransportStreamFramer::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]