MPEG2TransportStreamIndexFile Class Reference

#include <MPEG2TransportStreamIndexFile.hh>

Inheritance diagram for MPEG2TransportStreamIndexFile:

Inheritance graph
[legend]
Collaboration diagram for MPEG2TransportStreamIndexFile:

Collaboration graph
[legend]

Public Member Functions

virtual ~MPEG2TransportStreamIndexFile ()
void lookupTSPacketNumFromNPT (float &npt, unsigned long &tsPacketNumber, unsigned long &indexRecordNumber)
void lookupPCRFromTSPacketNum (unsigned long &tsPacketNumber, Boolean reverseToPreviousCleanPoint, float &pcr, unsigned long &indexRecordNumber)
Boolean readIndexRecordValues (unsigned long indexRecordNum, unsigned long &transportPacketNum, u_int8_t &offset, u_int8_t &size, float &pcr, u_int8_t &recordType)
float getPlayingDuration ()
void stopReading ()
int mpegVersion ()
UsageEnvironmentenvir () const
char const * name () const
virtual Boolean isSource () 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 MPEG2TransportStreamIndexFilecreateNew (UsageEnvironment &env, char const *indexFileName)
static Boolean lookupByName (UsageEnvironment &env, char const *mediumName, Medium *&resultMedium)
static void close (UsageEnvironment &env, char const *mediumName)
static void close (Medium *medium)

Protected Member Functions

TaskTokennextTask ()

Private Member Functions

 MPEG2TransportStreamIndexFile (UsageEnvironment &env, char const *indexFileName)
Boolean openFid ()
Boolean seekToIndexRecord (unsigned long indexRecordNumber)
Boolean readIndexRecord (unsigned long indexRecordNum)
Boolean readOneIndexRecord (unsigned long indexRecordNum)
void closeFid ()
u_int8_t recordTypeFromBuf ()
u_int8_t offsetFromBuf ()
u_int8_t sizeFromBuf ()
float pcrFromBuf ()
unsigned long tsPacketNumFromBuf ()
void setMPEGVersionFromRecordType (u_int8_t recordType)
Boolean rewindToCleanPoint (unsigned long &ixFound)

Private Attributes

char * fFileName
FILE * fFid
int fMPEGVersion
unsigned long fCurrentIndexRecordNum
float fCachedPCR
unsigned long fCachedTSPacketNumber
unsigned long fCachedIndexRecordNumber
unsigned long fNumIndexRecords
unsigned char fBuf [INDEX_RECORD_SIZE]

Friends

class MediaLookupTable

Detailed Description

Definition at line 33 of file MPEG2TransportStreamIndexFile.hh.


Constructor & Destructor Documentation

MPEG2TransportStreamIndexFile::~MPEG2TransportStreamIndexFile (  )  [virtual]

Definition at line 58 of file MPEG2TransportStreamIndexFile.cpp.

References closeFid(), and fFileName.

00058                                                               {
00059   closeFid();
00060   delete[] fFileName;
00061 }

MPEG2TransportStreamIndexFile::MPEG2TransportStreamIndexFile ( UsageEnvironment env,
char const *  indexFileName 
) [private]

Definition at line 28 of file MPEG2TransportStreamIndexFile.cpp.

References env, GetFileSize(), INDEX_RECORD_SIZE, and NULL.

00029   : Medium(env),
00030     fFileName(strDup(indexFileName)), fFid(NULL), fMPEGVersion(0), fCurrentIndexRecordNum(0),
00031     fCachedPCR(0.0f), fCachedTSPacketNumber(0), fNumIndexRecords(0) {
00032   // Get the file size, to determine how many index records it contains:
00033   u_int64_t indexFileSize = GetFileSize(indexFileName, NULL);
00034   if (indexFileSize % INDEX_RECORD_SIZE != 0) {
00035     env << "Warning: Size of the index file \"" << indexFileName
00036         << "\" (" << (unsigned)indexFileSize
00037         << ") is not a multiple of the index record size ("
00038         << INDEX_RECORD_SIZE << ")\n";
00039   }
00040   fNumIndexRecords = (unsigned long)(indexFileSize/INDEX_RECORD_SIZE);
00041 }


Member Function Documentation

MPEG2TransportStreamIndexFile * MPEG2TransportStreamIndexFile::createNew ( UsageEnvironment env,
char const *  indexFileName 
) [static]

Definition at line 44 of file MPEG2TransportStreamIndexFile.cpp.

References env, getPlayingDuration(), and NULL.

Referenced by MPEG2TransportFileServerMediaSubsession::createNew(), and main().

00044                                                             {
00045   if (indexFileName == NULL) return NULL;
00046   MPEG2TransportStreamIndexFile* indexFile
00047     = new MPEG2TransportStreamIndexFile(env, indexFileName);
00048 
00049   // Reject empty or non-existent index files:
00050   if (indexFile->getPlayingDuration() == 0.0f) {
00051     delete indexFile;
00052     indexFile = NULL;
00053   }
00054 
00055   return indexFile;
00056 }

void MPEG2TransportStreamIndexFile::lookupTSPacketNumFromNPT ( float &  npt,
unsigned long &  tsPacketNumber,
unsigned long &  indexRecordNumber 
)

Definition at line 64 of file MPEG2TransportStreamIndexFile.cpp.

References closeFid(), False, fCachedIndexRecordNumber, fCachedPCR, fCachedTSPacketNumber, fNumIndexRecords, pcrFromBuf(), readIndexRecord(), rewindToCleanPoint(), and tsPacketNumFromBuf().

Referenced by main(), and ClientTrickPlayState::updateStateFromNPT().

00065                                                              {
00066   if (npt <= 0.0 || fNumIndexRecords == 0) { // Fast-track a common case:
00067     npt = 0.0f;
00068     tsPacketNumber = indexRecordNumber = 0;
00069     return;
00070   }
00071 
00072   // If "npt" is the same as the one that we last looked up, return its cached result:
00073   if (npt == fCachedPCR) {
00074     tsPacketNumber = fCachedTSPacketNumber;
00075     indexRecordNumber = fCachedIndexRecordNumber;
00076     return;
00077   }
00078 
00079   // Search for the pair of neighboring index records whose PCR values span "npt".
00080   // Use the 'regula-falsi' method.
00081   Boolean success = False;
00082   unsigned long ixFound = 0;
00083   do {
00084     unsigned long ixLeft = 0, ixRight = fNumIndexRecords-1;
00085     float pcrLeft = 0.0f, pcrRight;
00086     if (!readIndexRecord(ixRight)) break;
00087     pcrRight = pcrFromBuf();
00088     if (npt > pcrRight) npt = pcrRight;
00089         // handle "npt" too large by seeking to the last frame of the file
00090 
00091     while (ixRight-ixLeft > 1 && pcrLeft < npt && npt <= pcrRight) {
00092       unsigned long ixNew = ixLeft
00093         + (unsigned long)(((npt-pcrLeft)/(pcrRight-pcrLeft))*(ixRight-ixLeft));
00094       if (ixNew == ixLeft || ixNew == ixRight) {
00095         // use bisection instead:
00096         ixNew = (ixLeft+ixRight)/2;
00097       }
00098       if (!readIndexRecord(ixNew)) break;
00099       float pcrNew = pcrFromBuf();
00100       if (pcrNew < npt) {
00101         pcrLeft = pcrNew;
00102         ixLeft = ixNew;
00103       } else {
00104         pcrRight = pcrNew;
00105         ixRight = ixNew;
00106       }
00107     }
00108     if (ixRight-ixLeft > 1 || npt <= pcrLeft || npt > pcrRight) break; // bad PCR values in index file?
00109 
00110     ixFound = ixRight;
00111     // "Rewind' until we reach the start of a Video Sequence or GOP header:
00112     success = rewindToCleanPoint(ixFound);
00113   } while (0);
00114 
00115   if (success && readIndexRecord(ixFound)) {
00116     // Return (and cache) information from record "ixFound":
00117     npt = fCachedPCR = pcrFromBuf();
00118     tsPacketNumber = fCachedTSPacketNumber = tsPacketNumFromBuf();
00119     indexRecordNumber = fCachedIndexRecordNumber = ixFound;
00120   } else {
00121     // An error occurred: Return the default values, for npt == 0:
00122     npt = 0.0f;
00123     tsPacketNumber = indexRecordNumber = 0;
00124   }
00125   closeFid();
00126 }

void MPEG2TransportStreamIndexFile::lookupPCRFromTSPacketNum ( unsigned long &  tsPacketNumber,
Boolean  reverseToPreviousCleanPoint,
float &  pcr,
unsigned long &  indexRecordNumber 
)

Definition at line 129 of file MPEG2TransportStreamIndexFile.cpp.

References closeFid(), False, fCachedIndexRecordNumber, fCachedPCR, fCachedTSPacketNumber, fNumIndexRecords, pcrFromBuf(), readIndexRecord(), rewindToCleanPoint(), True, and tsPacketNumFromBuf().

Referenced by ClientTrickPlayState::updateStateOnPlayChange().

00130                                                                          {
00131   if (tsPacketNumber == 0 || fNumIndexRecords == 0) { // Fast-track a common case:
00132     pcr = 0.0f;
00133     indexRecordNumber = 0;
00134     return;
00135   }
00136 
00137   // If "tsPacketNumber" is the same as the one that we last looked up, return its cached result:
00138   if (tsPacketNumber == fCachedTSPacketNumber) {
00139     pcr = fCachedPCR;
00140     indexRecordNumber = fCachedIndexRecordNumber;
00141     return;
00142   }
00143 
00144   // Search for the pair of neighboring index records whose TS packet #s span "tsPacketNumber".
00145   // Use the 'regula-falsi' method.
00146   Boolean success = False;
00147   unsigned long ixFound = 0;
00148   do {
00149     unsigned long ixLeft = 0, ixRight = fNumIndexRecords-1;
00150     unsigned long tsLeft = 0, tsRight;
00151     if (!readIndexRecord(ixRight)) break;
00152     tsRight = tsPacketNumFromBuf();
00153     if (tsPacketNumber > tsRight) tsPacketNumber = tsRight;
00154         // handle "tsPacketNumber" too large by seeking to the last frame of the file
00155 
00156     while (ixRight-ixLeft > 1 && tsLeft < tsPacketNumber && tsPacketNumber <= tsRight) {
00157       unsigned long ixNew = ixLeft
00158         + (unsigned long)(((tsPacketNumber-tsLeft)/(tsRight-tsLeft))*(ixRight-ixLeft));
00159       if (ixNew == ixLeft || ixNew == ixRight) {
00160         // Use bisection instead:
00161         ixNew = (ixLeft+ixRight)/2;
00162       }
00163       if (!readIndexRecord(ixNew)) break;
00164       unsigned long tsNew = tsPacketNumFromBuf();
00165       if (tsNew < tsPacketNumber) {
00166         tsLeft = tsNew;
00167         ixLeft = ixNew;
00168       } else {
00169         tsRight = tsNew;
00170         ixRight = ixNew;
00171       }
00172     }
00173     if (ixRight-ixLeft > 1 || tsPacketNumber <= tsLeft || tsPacketNumber > tsRight) break; // bad PCR values in index file?
00174 
00175     ixFound = ixRight;
00176     if (reverseToPreviousCleanPoint) {
00177       // "Rewind' until we reach the start of a Video Sequence or GOP header:
00178       success = rewindToCleanPoint(ixFound);
00179     } else {
00180       success = True;
00181     }
00182   } while (0);
00183 
00184   if (success && readIndexRecord(ixFound)) {
00185     // Return (and cache) information from record "ixFound":
00186     pcr = fCachedPCR = pcrFromBuf();
00187     fCachedTSPacketNumber = tsPacketNumFromBuf();
00188     if (reverseToPreviousCleanPoint) tsPacketNumber = fCachedTSPacketNumber;
00189     indexRecordNumber = fCachedIndexRecordNumber = ixFound;
00190   } else {
00191     // An error occurred: Return the default values, for tsPacketNumber == 0:
00192     pcr = 0.0f;
00193     indexRecordNumber = 0;
00194   }
00195   closeFid();
00196 }

Boolean MPEG2TransportStreamIndexFile::readIndexRecordValues ( unsigned long  indexRecordNum,
unsigned long &  transportPacketNum,
u_int8_t &  offset,
u_int8_t &  size,
float &  pcr,
u_int8_t &  recordType 
)

Definition at line 199 of file MPEG2TransportStreamIndexFile.cpp.

References False, offsetFromBuf(), pcrFromBuf(), readIndexRecord(), recordTypeFromBuf(), sizeFromBuf(), True, and tsPacketNumFromBuf().

Referenced by MPEG2TransportStreamTrickModeFilter::doGetNextFrame(), and ClientTrickPlayState::updateStateOnPlayChange().

00201                                                                           {
00202   if (!readIndexRecord(indexRecordNum)) return False;
00203 
00204   transportPacketNum = tsPacketNumFromBuf();
00205   offset = offsetFromBuf();
00206   size = sizeFromBuf();
00207   pcr = pcrFromBuf();
00208   recordType = recordTypeFromBuf();
00209   return True;
00210 }

float MPEG2TransportStreamIndexFile::getPlayingDuration (  ) 

Definition at line 212 of file MPEG2TransportStreamIndexFile.cpp.

References fNumIndexRecords, pcrFromBuf(), and readOneIndexRecord().

Referenced by createNew(), and MPEG2TransportFileServerMediaSubsession::MPEG2TransportFileServerMediaSubsession().

00212                                                         {
00213   if (fNumIndexRecords == 0 || !readOneIndexRecord(fNumIndexRecords-1)) return 0.0f;
00214 
00215   return pcrFromBuf();
00216 }

void MPEG2TransportStreamIndexFile::stopReading (  )  [inline]

Definition at line 60 of file MPEG2TransportStreamIndexFile.hh.

References closeFid().

Referenced by MPEG2TransportStreamTrickModeFilter::doStopGettingFrames(), and MPEG2TransportStreamTrickModeFilter::onSourceClosure1().

00060 { closeFid(); }

int MPEG2TransportStreamIndexFile::mpegVersion (  ) 

Definition at line 218 of file MPEG2TransportStreamIndexFile.cpp.

References fMPEGVersion, readOneIndexRecord(), recordTypeFromBuf(), and setMPEGVersionFromRecordType().

Referenced by main(), and ClientTrickPlayState::updateStateOnScaleChange().

00218                                                {
00219   if (fMPEGVersion != 0) return fMPEGVersion; // we already know it
00220 
00221   // Read the first index record, and figure out the MPEG version from its type:
00222   if (!readOneIndexRecord(0)) return 0; // unknown; perhaps the indecx file is empty?   
00223 
00224   setMPEGVersionFromRecordType(recordTypeFromBuf());
00225   return fMPEGVersion;
00226 }

Boolean MPEG2TransportStreamIndexFile::openFid (  )  [private]

Definition at line 228 of file MPEG2TransportStreamIndexFile.cpp.

References Medium::envir(), fCurrentIndexRecordNum, fFid, fFileName, NULL, and OpenInputFile().

Referenced by seekToIndexRecord().

00228                                                {
00229   if (fFid == NULL && fFileName != NULL) {
00230     if ((fFid = OpenInputFile(envir(), fFileName)) != NULL) {
00231       fCurrentIndexRecordNum = 0;
00232     }
00233   }
00234 
00235   return fFid != NULL;
00236 }

Boolean MPEG2TransportStreamIndexFile::seekToIndexRecord ( unsigned long  indexRecordNumber  )  [private]

Definition at line 238 of file MPEG2TransportStreamIndexFile.cpp.

References False, fCurrentIndexRecordNum, fFid, INDEX_RECORD_SIZE, openFid(), SeekFile64(), and True.

Referenced by readIndexRecord().

00238                                                                                         {
00239   if (!openFid()) return False;
00240 
00241   if (indexRecordNumber == fCurrentIndexRecordNum) return True; // we're already there
00242 
00243   if (SeekFile64(fFid, (int64_t)(indexRecordNumber*INDEX_RECORD_SIZE), SEEK_SET) != 0) return False;
00244   fCurrentIndexRecordNum = indexRecordNumber;
00245   return True;
00246 }

Boolean MPEG2TransportStreamIndexFile::readIndexRecord ( unsigned long  indexRecordNum  )  [private]

Definition at line 248 of file MPEG2TransportStreamIndexFile.cpp.

References False, fBuf, fCurrentIndexRecordNum, fFid, INDEX_RECORD_SIZE, seekToIndexRecord(), and True.

Referenced by lookupPCRFromTSPacketNum(), lookupTSPacketNumFromNPT(), readIndexRecordValues(), readOneIndexRecord(), and rewindToCleanPoint().

00248                                                                                    {
00249   do {
00250     if (!seekToIndexRecord(indexRecordNum)) break;
00251     if (fread(fBuf, INDEX_RECORD_SIZE, 1, fFid) != 1) break;
00252     ++fCurrentIndexRecordNum;
00253 
00254     return True;
00255   } while (0);
00256 
00257   return False; // an error occurred
00258 }

Boolean MPEG2TransportStreamIndexFile::readOneIndexRecord ( unsigned long  indexRecordNum  )  [private]

Definition at line 260 of file MPEG2TransportStreamIndexFile.cpp.

References closeFid(), and readIndexRecord().

Referenced by getPlayingDuration(), and mpegVersion().

00260                                                                                       {
00261   Boolean result = readIndexRecord(indexRecordNum);
00262   closeFid();
00263 
00264   return result;
00265 }

void MPEG2TransportStreamIndexFile::closeFid (  )  [private]

Definition at line 267 of file MPEG2TransportStreamIndexFile.cpp.

References CloseInputFile(), fFid, and NULL.

Referenced by lookupPCRFromTSPacketNum(), lookupTSPacketNumFromNPT(), readOneIndexRecord(), stopReading(), and ~MPEG2TransportStreamIndexFile().

00267                                              {
00268   if (fFid != NULL) {
00269     CloseInputFile(fFid);
00270     fFid = NULL;
00271   }
00272 }

u_int8_t MPEG2TransportStreamIndexFile::recordTypeFromBuf (  )  [inline, private]

Definition at line 75 of file MPEG2TransportStreamIndexFile.hh.

References fBuf.

Referenced by mpegVersion(), readIndexRecordValues(), and rewindToCleanPoint().

00075 { return fBuf[0]; }

u_int8_t MPEG2TransportStreamIndexFile::offsetFromBuf (  )  [inline, private]

Definition at line 76 of file MPEG2TransportStreamIndexFile.hh.

References fBuf.

Referenced by readIndexRecordValues().

00076 { return fBuf[1]; }

u_int8_t MPEG2TransportStreamIndexFile::sizeFromBuf (  )  [inline, private]

Definition at line 77 of file MPEG2TransportStreamIndexFile.hh.

References fBuf.

Referenced by readIndexRecordValues().

00077 { return fBuf[2]; }

float MPEG2TransportStreamIndexFile::pcrFromBuf (  )  [private]

Definition at line 274 of file MPEG2TransportStreamIndexFile.cpp.

References fBuf.

Referenced by getPlayingDuration(), lookupPCRFromTSPacketNum(), lookupTSPacketNumFromNPT(), and readIndexRecordValues().

00274                                                 {
00275   unsigned pcr_int = (fBuf[5]<<16) | (fBuf[4]<<8) | fBuf[3];
00276   u_int8_t pcr_frac = fBuf[6];
00277   return pcr_int + pcr_frac/256.0f;
00278 }

unsigned long MPEG2TransportStreamIndexFile::tsPacketNumFromBuf (  )  [private]

Definition at line 280 of file MPEG2TransportStreamIndexFile.cpp.

References fBuf.

Referenced by lookupPCRFromTSPacketNum(), lookupTSPacketNumFromNPT(), and readIndexRecordValues().

00280                                                                 {
00281   return (fBuf[10]<<24) | (fBuf[9]<<16) | (fBuf[8]<<8) | fBuf[7];
00282 }

void MPEG2TransportStreamIndexFile::setMPEGVersionFromRecordType ( u_int8_t  recordType  )  [private]

Definition at line 284 of file MPEG2TransportStreamIndexFile.cpp.

References fMPEGVersion.

Referenced by mpegVersion(), and rewindToCleanPoint().

00284                                                                                     {
00285   if (fMPEGVersion != 0) return; // we already know it
00286  
00287   u_int8_t const recordTypeWithoutStartBit = recordType&~0x80;
00288   if (recordTypeWithoutStartBit >= 1 && recordTypeWithoutStartBit <= 4) fMPEGVersion = 2;
00289   else if (recordTypeWithoutStartBit >= 5 && recordTypeWithoutStartBit <= 10) fMPEGVersion = 5;
00290       // represents H.264
00291   else if (recordTypeWithoutStartBit >= 11 && recordTypeWithoutStartBit <= 16) fMPEGVersion = 6;
00292       // represents H.265
00293 }

Boolean MPEG2TransportStreamIndexFile::rewindToCleanPoint ( unsigned long &  ixFound  )  [private]

Definition at line 295 of file MPEG2TransportStreamIndexFile.cpp.

References False, fMPEGVersion, readIndexRecord(), recordTypeFromBuf(), setMPEGVersionFromRecordType(), and True.

Referenced by lookupPCRFromTSPacketNum(), and lookupTSPacketNumFromNPT().

00295                                                                                {
00296   Boolean success = False; // until we learn otherwise
00297 
00298   while (ixFound > 0) {
00299     if (!readIndexRecord(ixFound)) break;
00300 
00301     u_int8_t recordType = recordTypeFromBuf();
00302     setMPEGVersionFromRecordType(recordType);
00303 
00304     // A 'clean point' is the start of a 'frame' from which a decoder can cleanly resume
00305     // handling the stream.  For H.264, this is a SPS.  For H.265, this is a VPS.
00306     // For MPEG-2, this is a Video Sequence Header, or a GOP. 
00307 
00308     if ((recordType&0x80) != 0) { // This is the start of a 'frame'
00309       recordType &=~ 0x80; // remove the 'start of frame' bit
00310       if (fMPEGVersion == 5) { // H.264
00311         if (recordType == 5/*SPS*/) {
00312           success = True;
00313           break;
00314         }
00315       } else if (fMPEGVersion == 6) { // H.265
00316         if (recordType == 11/*VPS*/) {
00317           success = True;
00318           break;
00319         }
00320       } else { // MPEG-1, 2, or 4
00321         if (recordType == 1/*VSH*/) {
00322           success = True;
00323           break;
00324         } else if (recordType == 2/*GOP*/) {
00325           // Hack: If the preceding record is for a Video Sequence Header, then use it instead:
00326           unsigned long newIxFound = ixFound;
00327 
00328           while (--newIxFound > 0) {
00329             if (!readIndexRecord(newIxFound)) break;
00330             recordType = recordTypeFromBuf();
00331             if ((recordType&0x7F) != 1) break; // not a Video Sequence Header
00332             if ((recordType&0x80) != 0) { // this is the start of the VSH; use it
00333               ixFound = newIxFound;
00334               break;
00335             }
00336           }
00337         }
00338         success = True;
00339         break;
00340       }
00341     }
00342 
00343     // Keep checking, from the previous record:
00344     --ixFound;
00345   }
00346   if (ixFound == 0) success = True; // use record 0 anyway
00347 
00348   return success;
00349 }

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

Definition at line 41 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().

00042                                                          {
00043   resultMedium = MediaLookupTable::ourMedia(env)->lookup(mediumName);
00044   if (resultMedium == NULL) {
00045     env.setResultMsg("Medium ", mediumName, " does not exist");
00046     return False;
00047   }
00048 
00049   return True;
00050 }

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

Definition at line 52 of file Media.cpp.

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

Referenced by afterPlaying(), Medium::close(), closeMediaSinks(), OnDemandServerMediaSubsession::closeStreamSource(), continueAfterClientCreation0(), continueAfterTEARDOWN(), WAVAudioFileSource::createNew(), QuickTimeFileSink::createNew(), QCELPAudioRTPSource::createNew(), MP3FileSource::createNew(), AVIFileSink::createNew(), AMRAudioRTPSource::createNew(), WAVAudioFileServerMediaSubsession::createNewStreamSource(), MPEG1or2DemuxedServerMediaSubsession::createNewStreamSource(), MediaSubsession::deInitiate(), ServerMediaSession::deleteAllSubsessions(), RTSPServerSupportingHTTPStreaming::RTSPClientConnectionSupportingHTTPStreaming::handleHTTPCmd_StreamingGET(), MPEG1or2ProgramStreamFileDuration(), MPEG1or2Demux::noteElementaryStreamDeletion(), ByteStreamMultiFileSource::onSourceClosure1(), StreamState::reclaim(), registerResponseHandler(), RTSPServer::removeServerMediaSession(), ProxyServerMediaSession::resetDESCRIBEState(), OnDemandServerMediaSubsession::sdpLines(), shutdownStream(), subsessionAfterPlaying(), ClientTrickPlayState::updateStateOnScaleChange(), AMRDeinterleaver::~AMRDeinterleaver(), ByteStreamMultiFileSource::~ByteStreamMultiFileSource(), DarwinInjector::~DarwinInjector(), FramedFilter::~FramedFilter(), H264or5VideoRTPSink::~H264or5VideoRTPSink(), InputESSourceRecord::~InputESSourceRecord(), MatroskaFileParser::~MatroskaFileParser(), MatroskaFileServerDemux::~MatroskaFileServerDemux(), MPEG1or2Demux::~MPEG1or2Demux(), MPEG1or2FileServerDemux::~MPEG1or2FileServerDemux(), MPEG2TransportFileServerMediaSubsession::~MPEG2TransportFileServerMediaSubsession(), MPEG2TransportStreamFromPESSource::~MPEG2TransportStreamFromPESSource(), OggFileParser::~OggFileParser(), OggFileServerDemux::~OggFileServerDemux(), ProxyServerMediaSession::~ProxyServerMediaSession(), RTSPServerSupportingHTTPStreaming::RTSPClientConnectionSupportingHTTPStreaming::~RTSPClientConnectionSupportingHTTPStreaming(), ServerMediaSubsession::~ServerMediaSubsession(), StreamClientState::~StreamClientState(), StreamReplicator::~StreamReplicator(), and T140TextRTPSink::~T140TextRTPSink().

00052                                                           {
00053   MediaLookupTable::ourMedia(env)->remove(name);
00054 }

void Medium::close ( Medium medium  )  [static, inherited]

Definition at line 56 of file Media.cpp.

References Medium::close(), Medium::envir(), Medium::name(), and NULL.

00056                                  {
00057   if (medium == NULL) return;
00058 
00059   close(medium->envir(), medium->name());
00060 }

UsageEnvironment& Medium::envir (  )  const [inline, inherited]

Definition at line 59 of file Media.hh.

References Medium::fEnviron.

Referenced by QuickTimeFileSink::addArbitraryString(), FileSink::addData(), RTCPInstance::addStreamSocket(), MPEG2IFrameIndexFromTransportStream::addToTail(), StreamParser::afterGettingBytes1(), DummySink::afterGettingFrame(), TCPStreamSink::afterGettingFrame(), T140IdleFilter::afterGettingFrame(), FileSink::afterGettingFrame(), MultiFramedRTPSink::afterGettingFrame1(), InputESSourceRecord::afterGettingFrame1(), MPEG2TransportStreamFramer::afterGettingFrame1(), MPEG2IFrameIndexFromTransportStream::afterGettingFrame1(), H264or5VideoStreamDiscreteFramer::afterGettingFrame1(), BasicUDPSink::afterGettingFrame1(), MPEG4VideoFileServerMediaSubsession::afterPlayingDummy1(), H265VideoFileServerMediaSubsession::afterPlayingDummy1(), H264VideoFileServerMediaSubsession::afterPlayingDummy1(), MPEG4VideoStreamParser::analyzeVOLHeader(), announceStream(), RTSPServer::RTSPClientConnection::changeClientInputSocket(), MPEG4VideoFileServerMediaSubsession::checkForAuxSDPLine1(), H265VideoFileServerMediaSubsession::checkForAuxSDPLine1(), H264VideoFileServerMediaSubsession::checkForAuxSDPLine1(), Medium::close(), ProxyServerMediaSubsession::closeStreamSource(), MPEG2IFrameIndexFromTransportStream::compactParseBuffer(), RTSPClient::connectionHandler1(), RTSPClient::connectToServer(), ProxyServerMediaSession::continueAfterDESCRIBE(), ProxyRTSPClient::continueAfterLivenessCommand(), ProxyRTSPClient::continueAfterSETUP(), T140TextRTPSink::continuePlaying(), QuickTimeFileSink::continuePlaying(), H264or5VideoRTPSink::continuePlaying(), AVIFileSink::continuePlaying(), ProxyServerMediaSubsession::createNewRTPSink(), MPEG4VideoFileServerMediaSubsession::createNewRTPSink(), MPEG2TransportUDPServerMediaSubsession::createNewRTPSink(), MPEG2TransportFileServerMediaSubsession::createNewRTPSink(), MPEG1or2VideoFileServerMediaSubsession::createNewRTPSink(), MPEG1or2DemuxedServerMediaSubsession::createNewRTPSink(), MP3AudioFileServerMediaSubsession::createNewRTPSink(), H265VideoFileServerMediaSubsession::createNewRTPSink(), H264VideoFileServerMediaSubsession::createNewRTPSink(), H263plusVideoFileServerMediaSubsession::createNewRTPSink(), DVVideoFileServerMediaSubsession::createNewRTPSink(), AMRAudioFileServerMediaSubsession::createNewRTPSink(), ADTSAudioFileServerMediaSubsession::createNewRTPSink(), AC3AudioFileServerMediaSubsession::createNewRTPSink(), HandlerServerForREGISTERCommand::createNewRTSPClient(), ProxyServerMediaSubsession::createNewStreamSource(), MPEG4VideoFileServerMediaSubsession::createNewStreamSource(), MPEG2TransportUDPServerMediaSubsession::createNewStreamSource(), MPEG2TransportFileServerMediaSubsession::createNewStreamSource(), MPEG1or2VideoFileServerMediaSubsession::createNewStreamSource(), MPEG1or2DemuxedServerMediaSubsession::createNewStreamSource(), MP3AudioFileServerMediaSubsession::createNewStreamSource(), H265VideoFileServerMediaSubsession::createNewStreamSource(), H264VideoFileServerMediaSubsession::createNewStreamSource(), H263plusVideoFileServerMediaSubsession::createNewStreamSource(), DVVideoFileServerMediaSubsession::createNewStreamSource(), AMRAudioFileServerMediaSubsession::createNewStreamSource(), ADTSAudioFileServerMediaSubsession::createNewStreamSource(), AC3AudioFileServerMediaSubsession::createNewStreamSource(), OggFile::createRTPSinkForTrackNumber(), MatroskaFile::createRTPSinkForTrackNumber(), MatroskaFile::createSourceForStreaming(), AMRDeinterleavingBuffer::deliverIncomingFrame(), MPEG2IFrameIndexFromTransportStream::deliverIndexRecord(), SegmentQueue::dequeue(), DeviceSource::DeviceSource(), WAVAudioFileSource::doGetNextFrame(), T140IdleFilter::doGetNextFrame(), MPEG2TransportStreamMultiplexor::doGetNextFrame(), MPEG2IFrameIndexFromTransportStream::doGetNextFrame(), MP3FileSource::doGetNextFrame(), H264or5Fragmenter::doGetNextFrame(), ByteStreamMultiFileSource::doGetNextFrame(), ByteStreamFileSource::doGetNextFrame(), BasicUDPSource::doGetNextFrame(), AMRAudioFileSource::doGetNextFrame(), ADTSAudioFileSource::doGetNextFrame(), MultiFramedRTPSource::doGetNextFrame1(), MP3FileSource::doGetNextFrame1(), ADUFromMP3Source::doGetNextFrame1(), SIPClient::doInviteStateMachine(), WAVAudioFileSource::doReadFromFile(), ByteStreamFileSource::doReadFromFile(), MPEG1or2VideoRTPSink::doSpecialFrameHandling(), MP3ADURTPSink::doSpecialFrameHandling(), H263plusVideoRTPSink::doSpecialFrameHandling(), WAVAudioFileSource::doStopGettingFrames(), T140IdleFilter::doStopGettingFrames(), MultiFramedRTPSource::doStopGettingFrames(), FramedSource::doStopGettingFrames(), ByteStreamFileSource::doStopGettingFrames(), BasicUDPSource::doStopGettingFrames(), SegmentQueue::enqueueNewSegment(), StreamParser::ensureValidBytes1(), MediaSubsession::env(), SubsessionIOState::envir(), RTSPServer::RTSPClientSession::envir(), RTSPServer::RTSPClientConnection::envir(), RTPInterface::envir(), AVISubsessionIOState::envir(), ServerMediaSession::generateSDPDescription(), RTPSource::getAttributes(), MP3FileSource::getAttributes(), MP3ADUTranscoder::getAttributes(), MediaSource::getAttributes(), MPEG4VideoFileServerMediaSubsession::getAuxSDPLine(), H265VideoFileServerMediaSubsession::getAuxSDPLine(), H264VideoFileServerMediaSubsession::getAuxSDPLine(), getMPEG1or2TimeCode(), FramedSource::getNextFrame(), getOptions(), DVVideoStreamFramer::getProfile(), SIPClient::getResponse(), SIPClient::getResponseCode(), getSDPDescription(), OnDemandServerMediaSubsession::getStreamParameters(), RTSPClient::handleAlternativeRequestByte1(), RTSPServer::RTSPClientConnection::handleCmd_REGISTER(), RTSPClient::handleGET_PARAMETERResponse(), RTSPServerSupportingHTTPStreaming::RTSPClientConnectionSupportingHTTPStreaming::handleHTTPCmd_StreamingGET(), RTSPClient::handleIncomingRequest(), RTSPClient::handlePLAYResponse(), RTSPClient::handleRequestError(), RTSPClient::handleResponseBytes(), RTSPClient::handleSETUPResponse(), RTSPServerWithREGISTERProxying::implementCmd_REGISTER(), RTSPServer::incomingConnectionHandler(), RTSPClient::incomingDataHandler1(), RTCPInstance::incomingReportHandler1(), MP3FileSource::initializeStream(), MediaSession::initializeWithSDP(), MediaSession::initiateByMediaType(), SIPClient::invite1(), DynamicRTSPServer::lookupServerMediaSession(), MatroskaDemux::MatroskaDemux(), MatroskaFile::MatroskaFile(), MPEG4GenericRTPSource::MPEG4GenericRTPSource(), MultiFramedRTPSource::networkReadHandler1(), OggDemux::newDemuxedTrack(), OggDemux::newDemuxedTrackByTrackNumber(), MatroskaDemux::newDemuxedTrackByTrackNumber(), MPEG1or2FileServerDemux::newElementaryStream(), MPEG1or2Demux::newElementaryStream(), MPEG4GenericBufferedPacket::nextEnclosedFrameSize(), AMRBufferedPacket::nextEnclosedFrameSize(), OggDemux::OggDemux(), OggFile::OggFile(), T140IdleFilter::onSourceClosure(), MediaSink::onSourceClosure(), RTSPClient::openConnection(), openFid(), MPEG2IFrameIndexFromTransportStream::parseFrame(), AC3AudioStreamParser::parseFrame(), MPEGProgramStreamParser::parsePackHeader(), MPEGProgramStreamParser::parsePESPacket(), SIPClient::parseResponseCode(), MediaSession::parseSDPLine(), MPEG1or2VideoStreamParser::parseSlice(), MatroskaFileParser::parseStartOfFile(), MPEGProgramStreamParser::parseSystemHeader(), MPEG4VideoStreamParser::parseVideoObjectLayer(), MPEG4VideoStreamParser::parseVideoObjectPlane(), MPEG4VideoStreamParser::parseVisualObject(), TCPStreamSink::processBuffer(), SIPClient::processURL(), AC3AudioStreamParser::readAndSaveAFrame(), MPEG1or2Demux::registerReadInterest(), RTCPInstance::reschedule(), RTSPClient::resendCommand(), ProxyRTSPClient::reset(), RTSPClient::resetTCPSockets(), RTSPClient::responseHandlerForHTTP_GET1(), RTSPClient::RTSPClient(), RTSPServer::rtspURLPrefix(), RTCPInstance::schedule(), ProxyRTSPClient::scheduleDESCRIBECommand(), ProxyRTSPClient::scheduleLivenessCommand(), OnDemandServerMediaSubsession::sdpLines(), SIPClient::sendACK(), SIPClient::sendBYE(), RTSPClient::sendDummyUDPPackets(), SIPClient::sendINVITE(), MultiFramedRTPSink::sendPacketIfNecessary(), SIPClient::sendRequest(), RTSPClient::sendRequest(), DarwinInjector::setDestination(), RTSPClient::setRequestFields(), RTSPClient::setupHTTPTunneling1(), setupNextSubsession(), RTSPServer::setUpTunnelingOverHTTP(), QuickTimeFileSink::setWord(), AVIFileSink::setWord(), QuickTimeFileSink::setWord64(), shutdownStream(), SIPClient::SIPClient(), TCPStreamSink::socketWritableHandler1(), AMRAudioRTPSink::sourceIsCompatibleWithUs(), QuickTimeFileSink::startPlaying(), StreamState::startPlaying(), MediaSink::startPlaying(), AVIFileSink::startPlaying(), startPlayingSession(), PassiveServerMediaSubsession::startStream(), MediaSink::stopPlaying(), ProxyServerMediaSubsession::subsessionByeHandler(), tearDownSession(), SIPClient::timerAHandler(), SIPClient::timerBHandler(), SIPClient::timerDHandler(), ClientTrickPlayState::updateStateOnScaleChange(), MPEG2TransportStreamFramer::updateTSPacketDurationEstimate(), BasicUDPSource::~BasicUDPSource(), ByteStreamFileSource::~ByteStreamFileSource(), DeviceSource::~DeviceSource(), ProxyServerMediaSession::~ProxyServerMediaSession(), ProxyServerMediaSubsession::~ProxyServerMediaSubsession(), RTSPClient::~RTSPClient(), RTSPServer::~RTSPServer(), StreamClientState::~StreamClientState(), T140IdleFilter::~T140IdleFilter(), TCPStreamSink::~TCPStreamSink(), and WAVAudioFileSource::~WAVAudioFileSource().

00059 {return fEnviron;}

char const* Medium::name (  )  const [inline, inherited]

Definition at line 61 of file Media.hh.

References Medium::fMediumName.

Referenced by QuickTimeFileSink::addAtom_hdlr2(), Medium::close(), MP3ADUTranscoder::createNew(), MP3FromADUSource::createNew(), ADUFromMP3Source::createNew(), and MP3FileSource::initializeStream().

00061 {return fMediumName;}

Boolean Medium::isSource (  )  const [virtual, inherited]

Reimplemented in MediaSource.

Definition at line 62 of file Media.cpp.

References False.

Referenced by MediaSource::lookupByName().

00062                                {
00063   return False; // default implementation
00064 }

Boolean Medium::isSink (  )  const [virtual, inherited]

Reimplemented in MediaSink.

Definition at line 66 of file Media.cpp.

References False.

Referenced by MediaSink::lookupByName().

00066                              {
00067   return False; // default implementation
00068 }

Boolean Medium::isRTCPInstance (  )  const [virtual, inherited]

Reimplemented in RTCPInstance.

Definition at line 70 of file Media.cpp.

References False.

Referenced by RTCPInstance::lookupByName().

00070                                      {
00071   return False; // default implementation
00072 }

Boolean Medium::isRTSPClient (  )  const [virtual, inherited]

Reimplemented in RTSPClient.

Definition at line 74 of file Media.cpp.

References False.

Referenced by RTSPClient::lookupByName().

00074                                    {
00075   return False; // default implementation
00076 }

Boolean Medium::isRTSPServer (  )  const [virtual, inherited]

Reimplemented in RTSPServer.

Definition at line 78 of file Media.cpp.

References False.

Referenced by RTSPServer::lookupByName().

00078                                    {
00079   return False; // default implementation
00080 }

Boolean Medium::isMediaSession (  )  const [virtual, inherited]

Reimplemented in MediaSession.

Definition at line 82 of file Media.cpp.

References False.

Referenced by MediaSession::lookupByName().

00082                                      {
00083   return False; // default implementation
00084 }

Boolean Medium::isServerMediaSession (  )  const [virtual, inherited]

Reimplemented in ServerMediaSession.

Definition at line 86 of file Media.cpp.

References False.

Referenced by ServerMediaSession::lookupByName().

00086                                            {
00087   return False; // default implementation
00088 }

Boolean Medium::isDarwinInjector (  )  const [virtual, inherited]

Reimplemented in DarwinInjector.

Definition at line 90 of file Media.cpp.

References False.

Referenced by DarwinInjector::lookupByName().

00090                                        {
00091   return False; // default implementation
00092 }

TaskToken& Medium::nextTask (  )  [inline, protected, inherited]

Definition at line 78 of file Media.hh.

References Medium::fNextTask.

Referenced by BasicUDPSink::afterGettingFrame1(), MPEG4VideoFileServerMediaSubsession::afterPlayingDummy1(), H265VideoFileServerMediaSubsession::afterPlayingDummy1(), H264VideoFileServerMediaSubsession::afterPlayingDummy1(), MPEG4VideoFileServerMediaSubsession::checkForAuxSDPLine1(), H265VideoFileServerMediaSubsession::checkForAuxSDPLine1(), H264VideoFileServerMediaSubsession::checkForAuxSDPLine1(), MP3FileSource::doGetNextFrame(), AMRAudioFileSource::doGetNextFrame(), ADTSAudioFileSource::doGetNextFrame(), MultiFramedRTPSource::doGetNextFrame1(), WAVAudioFileSource::doReadFromFile(), ByteStreamFileSource::doReadFromFile(), WAVAudioFileSource::doStopGettingFrames(), MultiFramedRTPSource::doStopGettingFrames(), FramedSource::doStopGettingFrames(), ByteStreamFileSource::doStopGettingFrames(), MediaSink::onSourceClosure(), RTCPInstance::reschedule(), RTCPInstance::schedule(), MultiFramedRTPSink::sendPacketIfNecessary(), and MediaSink::stopPlaying().

00078                         {
00079         return fNextTask;
00080   }


Friends And Related Function Documentation

friend class MediaLookupTable [friend, inherited]

Definition at line 74 of file Media.hh.


Field Documentation

char* MPEG2TransportStreamIndexFile::fFileName [private]

Definition at line 86 of file MPEG2TransportStreamIndexFile.hh.

Referenced by openFid(), and ~MPEG2TransportStreamIndexFile().

FILE* MPEG2TransportStreamIndexFile::fFid [private]

Definition at line 87 of file MPEG2TransportStreamIndexFile.hh.

Referenced by closeFid(), openFid(), readIndexRecord(), and seekToIndexRecord().

int MPEG2TransportStreamIndexFile::fMPEGVersion [private]

Definition at line 88 of file MPEG2TransportStreamIndexFile.hh.

Referenced by mpegVersion(), rewindToCleanPoint(), and setMPEGVersionFromRecordType().

unsigned long MPEG2TransportStreamIndexFile::fCurrentIndexRecordNum [private]

Definition at line 89 of file MPEG2TransportStreamIndexFile.hh.

Referenced by openFid(), readIndexRecord(), and seekToIndexRecord().

float MPEG2TransportStreamIndexFile::fCachedPCR [private]

Definition at line 90 of file MPEG2TransportStreamIndexFile.hh.

Referenced by lookupPCRFromTSPacketNum(), and lookupTSPacketNumFromNPT().

unsigned long MPEG2TransportStreamIndexFile::fCachedTSPacketNumber [private]

Definition at line 91 of file MPEG2TransportStreamIndexFile.hh.

Referenced by lookupPCRFromTSPacketNum(), and lookupTSPacketNumFromNPT().

unsigned long MPEG2TransportStreamIndexFile::fCachedIndexRecordNumber [private]

Definition at line 91 of file MPEG2TransportStreamIndexFile.hh.

Referenced by lookupPCRFromTSPacketNum(), and lookupTSPacketNumFromNPT().

unsigned long MPEG2TransportStreamIndexFile::fNumIndexRecords [private]

Definition at line 92 of file MPEG2TransportStreamIndexFile.hh.

Referenced by getPlayingDuration(), lookupPCRFromTSPacketNum(), and lookupTSPacketNumFromNPT().

unsigned char MPEG2TransportStreamIndexFile::fBuf[INDEX_RECORD_SIZE] [private]

Definition at line 93 of file MPEG2TransportStreamIndexFile.hh.

Referenced by offsetFromBuf(), pcrFromBuf(), readIndexRecord(), recordTypeFromBuf(), sizeFromBuf(), and tsPacketNumFromBuf().


The documentation for this class was generated from the following files:
Generated on Wed Apr 23 16:16:45 2014 for live by  doxygen 1.5.2