MPEG2TransportFileServerMediaSubsession Class Reference

#include <MPEG2TransportFileServerMediaSubsession.hh>

Inheritance diagram for MPEG2TransportFileServerMediaSubsession:

Inheritance graph
[legend]
Collaboration diagram for MPEG2TransportFileServerMediaSubsession:

Collaboration graph
[legend]

Public Member Functions

unsigned trackNumber () const
char const * trackId ()
void setServerAddressAndPortForSDP (netAddressBits addressBits, portNumBits portBits)
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 MPEG2TransportFileServerMediaSubsessioncreateNew (UsageEnvironment &env, char const *dataFileName, char const *indexFileName, Boolean reuseFirstSource)
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

 MPEG2TransportFileServerMediaSubsession (UsageEnvironment &env, char const *fileName, MPEG2TransportStreamIndexFile *indexFile, Boolean reuseFirstSource)
virtual ~MPEG2TransportFileServerMediaSubsession ()
virtual char const * sdpLines ()
virtual void getStreamParameters (unsigned clientSessionId, netAddressBits clientAddress, Port const &clientRTPPort, Port const &clientRTCPPort, int tcpSocketNum, unsigned char rtpChannelId, unsigned char rtcpChannelId, netAddressBits &destinationAddress, u_int8_t &destinationTTL, Boolean &isMulticast, Port &serverRTPPort, Port &serverRTCPPort, void *&streamToken)
virtual char const * getAuxSDPLine (RTPSink *rtpSink, FramedSource *inputSource)
virtual void seekStreamSource (FramedSource *inputSource, float seekNPT)
virtual void setStreamSourceScale (FramedSource *inputSource, float scale)
virtual void closeStreamSource (FramedSource *inputSource)
char const * rangeSDPLine () const
TaskTokennextTask ()

Protected Attributes

char const * fFileName
u_int64_t fFileSize
ServerMediaSessionfParentSession
netAddressBits fServerAddressForSDP
portNumBits fPortNumForSDP

Private Member Functions

virtual void startStream (unsigned clientSessionId, void *streamToken, TaskFunc *rtcpRRHandler, void *rtcpRRHandlerClientData, unsigned short &rtpSeqNum, unsigned &rtpTimestamp)
virtual void pauseStream (unsigned clientSessionId, void *streamToken)
virtual void seekStream (unsigned clientSessionId, void *streamToken, float seekNPT)
virtual void setStreamScale (unsigned clientSessionId, void *streamToken, float scale)
virtual void deleteStream (unsigned clientSessionId, void *&streamToken)
virtual FramedSourcecreateNewStreamSource (unsigned clientSessionId, unsigned &estBitrate)
virtual RTPSinkcreateNewRTPSink (Groupsock *rtpGroupsock, unsigned char rtpPayloadTypeIfDynamic, FramedSource *inputSource)
virtual void testScaleFactor (float &scale)
virtual float duration () const
ClientTrickPlayStatelookupClient (unsigned clientSessionId)

Private Attributes

MPEG2TransportStreamIndexFilefIndexFile
float fDuration
HashTablefClientSessionHashTable

Detailed Description

Definition at line 34 of file MPEG2TransportFileServerMediaSubsession.hh.


Constructor & Destructor Documentation

MPEG2TransportFileServerMediaSubsession::MPEG2TransportFileServerMediaSubsession ( UsageEnvironment env,
char const *  fileName,
MPEG2TransportStreamIndexFile indexFile,
Boolean  reuseFirstSource 
) [protected]

Definition at line 86 of file MPEG2TransportFileServerMediaSubsession.cpp.

References HashTable::create(), fClientSessionHashTable, fDuration, fIndexFile, MPEG2TransportStreamIndexFile::getPlayingDuration(), NULL, and ONE_WORD_HASH_KEYS.

Referenced by createNew().

00090   : FileServerMediaSubsession(env, fileName, reuseFirstSource),
00091     fIndexFile(indexFile), fDuration(0.0), fClientSessionHashTable(NULL) {
00092   if (fIndexFile != NULL) { // we support 'trick play'
00093     fDuration = fIndexFile->getPlayingDuration();
00094     fClientSessionHashTable = HashTable::create(ONE_WORD_HASH_KEYS);
00095   }
00096 }

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

Definition at line 99 of file MPEG2TransportFileServerMediaSubsession.cpp.

References Medium::close(), fClientSessionHashTable, fIndexFile, NULL, and HashTable::RemoveNext().

00099                                            {
00100   if (fIndexFile != NULL) { // we support 'trick play'
00101     Medium::close(fIndexFile);
00102 
00103     // Clean out the client session hash table:
00104     while (1) {
00105       ClientTrickPlayState* client
00106         = (ClientTrickPlayState*)(fClientSessionHashTable->RemoveNext());
00107       if (client == NULL) break;
00108       delete client;
00109     }
00110     delete fClientSessionHashTable;
00111   }
00112 }


Member Function Documentation

MPEG2TransportFileServerMediaSubsession * MPEG2TransportFileServerMediaSubsession::createNew ( UsageEnvironment env,
char const *  dataFileName,
char const *  indexFileName,
Boolean  reuseFirstSource 
) [static]

Definition at line 71 of file MPEG2TransportFileServerMediaSubsession.cpp.

References MPEG2TransportStreamIndexFile::createNew(), env, MPEG2TransportFileServerMediaSubsession(), and NULL.

Referenced by createNewSMS().

00074                                                                              {
00075   if (indexFileName != NULL && reuseFirstSource) {
00076     // It makes no sense to support trick play if all clients use the same source.  Fix this:
00077     env << "MPEG2TransportFileServerMediaSubsession::createNew(): ignoring the index file name, because \"reuseFirstSource\" is set\n";
00078     indexFileName = NULL;
00079   }
00080   MPEG2TransportStreamIndexFile* indexFile = MPEG2TransportStreamIndexFile::createNew(env, indexFileName);
00081   return new MPEG2TransportFileServerMediaSubsession(env, fileName, indexFile,
00082                                                      reuseFirstSource);
00083 }

void MPEG2TransportFileServerMediaSubsession::startStream ( unsigned  clientSessionId,
void *  streamToken,
TaskFunc rtcpRRHandler,
void *  rtcpRRHandlerClientData,
unsigned short &  rtpSeqNum,
unsigned &  rtpTimestamp 
) [private, virtual]

Reimplemented from OnDemandServerMediaSubsession.

Definition at line 119 of file MPEG2TransportFileServerMediaSubsession.cpp.

References ClientTrickPlayState::areChangingScale(), fIndexFile, lookupClient(), NULL, OnDemandServerMediaSubsession::pauseStream(), OnDemandServerMediaSubsession::startStream(), True, ClientTrickPlayState::updateStateOnPlayChange(), and ClientTrickPlayState::updateStateOnScaleChange().

00121                                       {
00122   if (fIndexFile != NULL) { // we support 'trick play'
00123     ClientTrickPlayState* client = lookupClient(clientSessionId);
00124     if (client != NULL && client->areChangingScale()) {
00125       // First, handle this like a "PAUSE", except that we back up to the previous VSH
00126       client->updateStateOnPlayChange(True);
00127       OnDemandServerMediaSubsession::pauseStream(clientSessionId, streamToken);
00128 
00129       // Then, adjust for the change of scale:
00130       client->updateStateOnScaleChange();
00131     }
00132   }
00133 
00134   // Call the original, default version of this routine:
00135   OnDemandServerMediaSubsession::startStream(clientSessionId, streamToken,
00136                                              rtcpRRHandler, rtcpRRHandlerClientData,
00137                                              rtpSeqNum, rtpTimestamp);
00138 }

void MPEG2TransportFileServerMediaSubsession::pauseStream ( unsigned  clientSessionId,
void *  streamToken 
) [private, virtual]

Reimplemented from OnDemandServerMediaSubsession.

Definition at line 141 of file MPEG2TransportFileServerMediaSubsession.cpp.

References False, fIndexFile, lookupClient(), NULL, OnDemandServerMediaSubsession::pauseStream(), and ClientTrickPlayState::updateStateOnPlayChange().

00141                                                          {
00142   if (fIndexFile != NULL) { // we support 'trick play'
00143     ClientTrickPlayState* client = lookupClient(clientSessionId);
00144     if (client != NULL) {
00145       client->updateStateOnPlayChange(False);
00146     }
00147   }
00148 
00149   // Call the original, default version of this routine:
00150   OnDemandServerMediaSubsession::pauseStream(clientSessionId, streamToken);
00151 }

void MPEG2TransportFileServerMediaSubsession::seekStream ( unsigned  clientSessionId,
void *  streamToken,
float  seekNPT 
) [private, virtual]

Reimplemented from OnDemandServerMediaSubsession.

Definition at line 154 of file MPEG2TransportFileServerMediaSubsession.cpp.

References fIndexFile, lookupClient(), NULL, OnDemandServerMediaSubsession::seekStream(), and ClientTrickPlayState::updateStateFromNPT().

00154                                                                        {
00155   if (fIndexFile != NULL) { // we support 'trick play'
00156     ClientTrickPlayState* client = lookupClient(clientSessionId);
00157     if (client != NULL) {
00158       client->updateStateFromNPT(seekNPT);
00159     }
00160   }
00161 
00162   // Call the original, default version of this routine:
00163   OnDemandServerMediaSubsession::seekStream(clientSessionId, streamToken, seekNPT);
00164 }

void MPEG2TransportFileServerMediaSubsession::setStreamScale ( unsigned  clientSessionId,
void *  streamToken,
float  scale 
) [private, virtual]

Reimplemented from OnDemandServerMediaSubsession.

Definition at line 167 of file MPEG2TransportFileServerMediaSubsession.cpp.

References fIndexFile, lookupClient(), NULL, ClientTrickPlayState::setNextScale(), and OnDemandServerMediaSubsession::setStreamScale().

00167                                                                          {
00168   if (fIndexFile != NULL) { // we support 'trick play'
00169     ClientTrickPlayState* client = lookupClient(clientSessionId);
00170     if (client != NULL) {
00171       client->setNextScale(scale); // scale won't take effect until the next "PLAY"
00172     }
00173   }
00174 
00175   // Call the original, default version of this routine:
00176   OnDemandServerMediaSubsession::setStreamScale(clientSessionId, streamToken, scale);
00177 }

void MPEG2TransportFileServerMediaSubsession::deleteStream ( unsigned  clientSessionId,
void *&  streamToken 
) [private, virtual]

Reimplemented from OnDemandServerMediaSubsession.

Definition at line 180 of file MPEG2TransportFileServerMediaSubsession.cpp.

References OnDemandServerMediaSubsession::deleteStream(), False, fIndexFile, lookupClient(), NULL, and ClientTrickPlayState::updateStateOnPlayChange().

00180                                                            {
00181   if (fIndexFile != NULL) { // we support 'trick play'
00182     ClientTrickPlayState* client = lookupClient(clientSessionId);
00183     if (client != NULL) {
00184       client->updateStateOnPlayChange(False);
00185     }
00186   }
00187 
00188   // Call the original, default version of this routine:
00189   OnDemandServerMediaSubsession::deleteStream(clientSessionId, streamToken);
00190 }

FramedSource * MPEG2TransportFileServerMediaSubsession::createNewStreamSource ( unsigned  clientSessionId,
unsigned &  estBitrate 
) [private, virtual]

Implements OnDemandServerMediaSubsession.

Definition at line 193 of file MPEG2TransportFileServerMediaSubsession.cpp.

References HashTable::Add(), MPEG2TransportStreamFramer::createNew(), ByteStreamFileSource::createNew(), Medium::envir(), fClientSessionHashTable, FileServerMediaSubsession::fFileName, FileServerMediaSubsession::fFileSize, ByteStreamFileSource::fileSize(), fIndexFile, lookupClient(), NULL, ClientTrickPlayState::setSource(), TRANSPORT_PACKET_SIZE, and TRANSPORT_PACKETS_PER_NETWORK_PACKET.

00193                                                                       {
00194   estBitrate = 5000; // kbps, estimate
00195 
00196   // Create the video source:
00197   unsigned const inputDataChunkSize
00198     = TRANSPORT_PACKETS_PER_NETWORK_PACKET*TRANSPORT_PACKET_SIZE;
00199   ByteStreamFileSource* fileSource
00200     = ByteStreamFileSource::createNew(envir(), fFileName, inputDataChunkSize);
00201   if (fileSource == NULL) return NULL;
00202   fFileSize = fileSource->fileSize();
00203 
00204   // Create a framer for the Transport Stream:
00205   MPEG2TransportStreamFramer* framer
00206     = MPEG2TransportStreamFramer::createNew(envir(), fileSource);
00207 
00208   if (fIndexFile != NULL) { // we support 'trick play'
00209     // Keep state for this client (if we don't already have it):
00210     ClientTrickPlayState* client = lookupClient(clientSessionId);
00211     if (client == NULL) {
00212       client = new ClientTrickPlayState(fIndexFile);
00213       fClientSessionHashTable->Add((char const*)clientSessionId, client);
00214     }
00215     client->setSource(framer);
00216   }
00217 
00218   return framer;
00219 }

RTPSink * MPEG2TransportFileServerMediaSubsession::createNewRTPSink ( Groupsock rtpGroupsock,
unsigned char  rtpPayloadTypeIfDynamic,
FramedSource inputSource 
) [private, virtual]

Implements OnDemandServerMediaSubsession.

Definition at line 222 of file MPEG2TransportFileServerMediaSubsession.cpp.

References SimpleRTPSink::createNew(), Medium::envir(), False, and True.

00224                                                   {
00225   return SimpleRTPSink::createNew(envir(), rtpGroupsock,
00226                                   33, 90000, "video", "MP2T",
00227                                   1, True, False /*no 'M' bit*/);
00228 }

void MPEG2TransportFileServerMediaSubsession::testScaleFactor ( float &  scale  )  [private, virtual]

Reimplemented from ServerMediaSubsession.

Definition at line 230 of file MPEG2TransportFileServerMediaSubsession.cpp.

References fDuration, fIndexFile, and NULL.

00230                                                                           {
00231   if (fIndexFile != NULL && fDuration > 0.0) {
00232     // We support any integral scale, other than 0
00233     int iScale = scale < 0.0 ? (int)(scale - 0.5f) : (int)(scale + 0.5f); // round
00234     if (iScale == 0) iScale = 1;
00235     scale = (float)iScale;
00236   } else {
00237     scale = 1.0f;
00238   }
00239 }

float MPEG2TransportFileServerMediaSubsession::duration (  )  const [private, virtual]

Reimplemented from ServerMediaSubsession.

Definition at line 241 of file MPEG2TransportFileServerMediaSubsession.cpp.

References fDuration.

00241                                                               {
00242   return fDuration;
00243 }

ClientTrickPlayState * MPEG2TransportFileServerMediaSubsession::lookupClient ( unsigned  clientSessionId  )  [private]

Definition at line 246 of file MPEG2TransportFileServerMediaSubsession.cpp.

References fClientSessionHashTable, and HashTable::Lookup().

Referenced by createNewStreamSource(), deleteStream(), pauseStream(), seekStream(), setStreamScale(), and startStream().

00246                                        {
00247   return (ClientTrickPlayState*)(fClientSessionHashTable->Lookup((char const*)clientSessionId));
00248 }

char const * OnDemandServerMediaSubsession::sdpLines (  )  [protected, virtual, inherited]

Implements ServerMediaSubsession.

Definition at line 74 of file OnDemandServerMediaSubsession.cpp.

References Medium::close(), OnDemandServerMediaSubsession::closeStreamSource(), OnDemandServerMediaSubsession::createNewRTPSink(), OnDemandServerMediaSubsession::createNewStreamSource(), Medium::envir(), OnDemandServerMediaSubsession::fSDPLines, NULL, OnDemandServerMediaSubsession::setSDPLinesFromRTPSink(), and ServerMediaSubsession::trackNumber().

Referenced by OnDemandServerMediaSubsession::setSDPLinesFromRTPSink().

00074                                         {
00075   if (fSDPLines == NULL) {
00076     // We need to construct a set of SDP lines that describe this
00077     // subsession (as a unicast stream).  To do so, we first create
00078     // dummy (unused) source and "RTPSink" objects,
00079     // whose parameters we use for the SDP lines:
00080     unsigned estBitrate; // unused
00081     FramedSource* inputSource = createNewStreamSource(0, estBitrate);
00082     if (inputSource == NULL) return NULL; // file not found
00083 
00084     struct in_addr dummyAddr;
00085     dummyAddr.s_addr = 0;
00086     Groupsock dummyGroupsock(envir(), dummyAddr, 0, 0);
00087     unsigned char rtpPayloadType = 96 + trackNumber()-1; // if dynamic
00088     RTPSink* dummyRTPSink
00089       = createNewRTPSink(&dummyGroupsock, rtpPayloadType, inputSource);
00090 
00091     setSDPLinesFromRTPSink(dummyRTPSink, inputSource);
00092     Medium::close(dummyRTPSink);
00093     closeStreamSource(inputSource);
00094   }
00095 
00096   return fSDPLines;
00097 }

void OnDemandServerMediaSubsession::getStreamParameters ( unsigned  clientSessionId,
netAddressBits  clientAddress,
Port const &  clientRTPPort,
Port const &  clientRTCPPort,
int  tcpSocketNum,
unsigned char  rtpChannelId,
unsigned char  rtcpChannelId,
netAddressBits destinationAddress,
u_int8_t &  destinationTTL,
Boolean isMulticast,
Port serverRTPPort,
Port serverRTCPPort,
void *&  streamToken 
) [protected, virtual, inherited]

Implements ServerMediaSubsession.

Definition at line 145 of file OnDemandServerMediaSubsession.cpp.

References HashTable::Add(), BasicUDPSink::createNew(), OnDemandServerMediaSubsession::createNewRTPSink(), OnDemandServerMediaSubsession::createNewStreamSource(), Medium::envir(), False, OnDemandServerMediaSubsession::fDestinationsHashTable, OnDemandServerMediaSubsession::fInitialPortNum, OnDemandServerMediaSubsession::fLastStreamToken, OnDemandServerMediaSubsession::fReuseFirstSource, NULL, Port::num(), Groupsock::removeAllDestinations(), Socket::socketNum(), OnDemandServerMediaSubsession::StreamState, and ServerMediaSubsession::trackNumber().

00157                                           {
00158   if (destinationAddress == 0) destinationAddress = clientAddress;
00159   struct in_addr destinationAddr; destinationAddr.s_addr = destinationAddress;
00160   isMulticast = False;
00161 
00162   if (fLastStreamToken != NULL && fReuseFirstSource) {
00163     // Special case: Rather than creating a new 'StreamState',
00164     // we reuse the one that we've already created:
00165     serverRTPPort = ((StreamState*)fLastStreamToken)->serverRTPPort();
00166     serverRTCPPort = ((StreamState*)fLastStreamToken)->serverRTCPPort();
00167     ++((StreamState*)fLastStreamToken)->referenceCount();
00168     streamToken = fLastStreamToken;
00169   } else {
00170     // Normal case: Create a new media source:
00171     unsigned streamBitrate;
00172     FramedSource* mediaSource
00173       = createNewStreamSource(clientSessionId, streamBitrate);
00174 
00175     // Create 'groupsock' and 'sink' objects for the destination,
00176     // using previously unused server port numbers:
00177     RTPSink* rtpSink;
00178     BasicUDPSink* udpSink;
00179     Groupsock* rtpGroupsock;
00180     Groupsock* rtcpGroupsock;
00181     portNumBits serverPortNum;
00182     if (clientRTCPPort.num() == 0) {
00183       // We're streaming raw UDP (not RTP). Create a single groupsock:
00184       NoReuse dummy; // ensures that we skip over ports that are already in use
00185       for (serverPortNum = fInitialPortNum; ; ++serverPortNum) {
00186         struct in_addr dummyAddr; dummyAddr.s_addr = 0;
00187 
00188         serverRTPPort = serverPortNum;
00189         rtpGroupsock = new Groupsock(envir(), dummyAddr, serverRTPPort, 255);
00190         if (rtpGroupsock->socketNum() >= 0) break; // success
00191       }
00192 
00193       rtcpGroupsock = NULL;
00194       rtpSink = NULL;
00195       udpSink = BasicUDPSink::createNew(envir(), rtpGroupsock);
00196     } else {
00197       // Normal case: We're streaming RTP (over UDP or TCP).  Create a pair of
00198       // groupsocks (RTP and RTCP), with adjacent port numbers (RTP port number even):
00199       NoReuse dummy; // ensures that we skip over ports that are already in use
00200       for (portNumBits serverPortNum = fInitialPortNum; ; serverPortNum += 2) {
00201         struct in_addr dummyAddr; dummyAddr.s_addr = 0;
00202 
00203         serverRTPPort = serverPortNum;
00204         rtpGroupsock = new Groupsock(envir(), dummyAddr, serverRTPPort, 255);
00205         if (rtpGroupsock->socketNum() < 0) {
00206           delete rtpGroupsock;
00207           continue; // try again
00208         }
00209 
00210         serverRTCPPort = serverPortNum+1;
00211         rtcpGroupsock = new Groupsock(envir(), dummyAddr, serverRTCPPort, 255);
00212         if (rtcpGroupsock->socketNum() < 0) {
00213           delete rtpGroupsock;
00214           delete rtcpGroupsock;
00215           continue; // try again
00216         }
00217 
00218         break; // success
00219       }
00220 
00221       unsigned char rtpPayloadType = 96 + trackNumber()-1; // if dynamic
00222       rtpSink = createNewRTPSink(rtpGroupsock, rtpPayloadType, mediaSource);
00223       udpSink = NULL;
00224     }
00225 
00226     // Turn off the destinations for each groupsock.  They'll get set later
00227     // (unless TCP is used instead):
00228     if (rtpGroupsock != NULL) rtpGroupsock->removeAllDestinations();
00229     if (rtcpGroupsock != NULL) rtcpGroupsock->removeAllDestinations();
00230 
00231     // Set up the state of the stream.  The stream will get started later:
00232     streamToken = fLastStreamToken
00233       = new StreamState(*this, serverRTPPort, serverRTCPPort, rtpSink, udpSink,
00234                         streamBitrate, mediaSource,
00235                         rtpGroupsock, rtcpGroupsock);
00236   }
00237 
00238   // Record these destinations as being for this client session id:
00239   Destinations* destinations;
00240   if (tcpSocketNum < 0) { // UDP
00241     destinations = new Destinations(destinationAddr, clientRTPPort, clientRTCPPort);
00242   } else { // TCP
00243     destinations = new Destinations(tcpSocketNum, rtpChannelId, rtcpChannelId);
00244   }
00245   fDestinationsHashTable->Add((char const*)clientSessionId, destinations);
00246 }

char const * OnDemandServerMediaSubsession::getAuxSDPLine ( RTPSink rtpSink,
FramedSource inputSource 
) [protected, virtual, inherited]

Reimplemented in MPEG4VideoFileServerMediaSubsession.

Definition at line 330 of file OnDemandServerMediaSubsession.cpp.

References RTPSink::auxSDPLine(), and NULL.

Referenced by OnDemandServerMediaSubsession::setSDPLinesFromRTPSink().

00330                                                                {
00331   // Default implementation:
00332   return rtpSink == NULL ? NULL : rtpSink->auxSDPLine();
00333 }

void OnDemandServerMediaSubsession::seekStreamSource ( FramedSource inputSource,
float  seekNPT 
) [protected, virtual, inherited]

Reimplemented in MP3AudioFileServerMediaSubsession, MPEG1or2DemuxedServerMediaSubsession, and WAVAudioFileServerMediaSubsession.

Definition at line 335 of file OnDemandServerMediaSubsession.cpp.

Referenced by OnDemandServerMediaSubsession::seekStream().

00336                                                                         {
00337   // Default implementation: Do nothing
00338 }

void OnDemandServerMediaSubsession::setStreamSourceScale ( FramedSource inputSource,
float  scale 
) [protected, virtual, inherited]

Reimplemented in MP3AudioFileServerMediaSubsession, and WAVAudioFileServerMediaSubsession.

Definition at line 341 of file OnDemandServerMediaSubsession.cpp.

Referenced by OnDemandServerMediaSubsession::setStreamScale().

00341                                                                      {
00342   // Default implementation: Do nothing
00343 }

void OnDemandServerMediaSubsession::closeStreamSource ( FramedSource inputSource  )  [protected, virtual, inherited]

Definition at line 345 of file OnDemandServerMediaSubsession.cpp.

References Medium::close().

Referenced by StreamState::reclaim(), and OnDemandServerMediaSubsession::sdpLines().

00345                                                                                {
00346   Medium::close(inputSource);
00347 }

unsigned ServerMediaSubsession::trackNumber (  )  const [inline, inherited]

Definition at line 115 of file ServerMediaSession.hh.

References ServerMediaSubsession::fTrackNumber.

Referenced by OnDemandServerMediaSubsession::getStreamParameters(), and OnDemandServerMediaSubsession::sdpLines().

00115 { return fTrackNumber; }

char const * ServerMediaSubsession::trackId (  )  [inherited]

Definition at line 326 of file ServerMediaSession.cpp.

References ServerMediaSubsession::fTrackId, ServerMediaSubsession::fTrackNumber, NULL, and strDup().

Referenced by PassiveServerMediaSubsession::sdpLines(), and OnDemandServerMediaSubsession::setSDPLinesFromRTPSink().

00326                                            {
00327   if (fTrackNumber == 0) return NULL; // not yet in a ServerMediaSession
00328 
00329   if (fTrackId == NULL) {
00330     char buf[100];
00331     sprintf(buf, "track%d", fTrackNumber);
00332     fTrackId = strDup(buf);
00333   }
00334   return fTrackId;
00335 }

void ServerMediaSubsession::setServerAddressAndPortForSDP ( netAddressBits  addressBits,
portNumBits  portBits 
) [inherited]

Definition at line 364 of file ServerMediaSession.cpp.

References ServerMediaSubsession::fPortNumForSDP, and ServerMediaSubsession::fServerAddressForSDP.

00365                                                                                 {
00366   fServerAddressForSDP = addressBits;
00367   fPortNumForSDP = portBits;
00368 }

char const * ServerMediaSubsession::rangeSDPLine (  )  const [protected, inherited]

Definition at line 371 of file ServerMediaSession.cpp.

References ServerMediaSubsession::duration(), ServerMediaSession::duration(), ServerMediaSubsession::fParentSession, NULL, and strDup().

Referenced by PassiveServerMediaSubsession::sdpLines(), and OnDemandServerMediaSubsession::setSDPLinesFromRTPSink().

00371                                           {
00372   if (fParentSession == NULL) return NULL;
00373 
00374   // If all of our parent's subsessions have the same duration
00375   // (as indicated by "fParentSession->duration() >= 0"), there's no "a=range:" line:
00376   if (fParentSession->duration() >= 0.0) return strDup("");
00377 
00378   // Use our own duration for a "a=range:" line:
00379   float ourDuration = duration();
00380   if (ourDuration == 0.0) {
00381     return strDup("a=range:npt=0-\r\n");
00382   } else {
00383     char buf[100];
00384     sprintf(buf, "a=range:npt=0-%.3f\r\n", ourDuration);
00385     return strDup(buf);
00386   }
00387 }

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 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(), DarwinInjector::~DarwinInjector(), FramedFilter::~FramedFilter(), H264VideoRTPSink::~H264VideoRTPSink(), InputESSourceRecord::~InputESSourceRecord(), MPEG1or2Demux::~MPEG1or2Demux(), MPEG1or2FileServerDemux::~MPEG1or2FileServerDemux(), ~MPEG2TransportFileServerMediaSubsession(), MPEG2TransportStreamFromPESSource::~MPEG2TransportStreamFromPESSource(), ServerMediaSession::~ServerMediaSession(), and ServerMediaSubsession::~ServerMediaSubsession().

00076                                                           {
00077   MediaLookupTable::ourMedia(env)->remove(name);
00078 }

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

Definition at line 80 of file Media.cpp.

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

00080                                  {
00081   if (medium == NULL) return;
00082 
00083   close(medium->envir(), medium->name());
00084 }

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

Definition at line 59 of file Media.hh.

References Medium::fEnviron.

Referenced by QuickTimeFileSink::addArbitraryString(), FileSink::addData(), MPEG2IFrameIndexFromTransportStream::addToTail(), StreamParser::afterGettingBytes(), MultiFramedRTPSink::afterGettingFrame1(), InputESSourceRecord::afterGettingFrame1(), MPEG2TransportStreamFramer::afterGettingFrame1(), MPEG2IFrameIndexFromTransportStream::afterGettingFrame1(), HTTPSink::afterGettingFrame1(), BasicUDPSink::afterGettingFrame1(), MPEG4VideoFileServerMediaSubsession::afterPlayingDummy1(), MPEG4VideoStreamParser::analyzeVOLHeader(), RTSPClient::announceSDPDescription(), announceStream(), MPEG4VideoFileServerMediaSubsession::checkForAuxSDPLine1(), Medium::close(), MPEG2IFrameIndexFromTransportStream::compactParseBuffer(), QuickTimeFileSink::continuePlaying(), HTTPSink::continuePlaying(), H264VideoRTPSink::continuePlaying(), AVIFileSink::continuePlaying(), MPEG4VideoFileServerMediaSubsession::createNewRTPSink()</