#include <MediaSession.hh>
Collaboration diagram for MediaSubsession:

Definition at line 142 of file MediaSession.hh.
| MediaSubsession::MediaSubsession | ( | MediaSession & | parent | ) | [protected] |
Definition at line 529 of file MediaSession.cpp.
References False, and rtpInfo.
00530 : serverPortNum(0), sink(NULL), miscPtr(NULL), 00531 fParent(parent), fNext(NULL), 00532 fConnectionEndpointName(NULL), 00533 fClientPortNum(0), fRTPPayloadFormat(0xFF), 00534 fSavedSDPLines(NULL), fMediumName(NULL), fCodecName(NULL), fProtocolName(NULL), 00535 fRTPTimestampFrequency(0), fControlPath(NULL), 00536 fSourceFilterAddr(parent.sourceFilterAddr()), fBandwidth(0), 00537 fAuxiliarydatasizelength(0), fConstantduration(0), fConstantsize(0), 00538 fCRC(0), fCtsdeltalength(0), fDe_interleavebuffersize(0), fDtsdeltalength(0), 00539 fIndexdeltalength(0), fIndexlength(0), fInterleaving(0), fMaxdisplacement(0), 00540 fObjecttype(0), fOctetalign(0), fProfile_level_id(0), fRobustsorting(0), 00541 fSizelength(0), fStreamstateindication(0), fStreamtype(0), 00542 fCpresent(False), fRandomaccessindication(False), 00543 fConfig(NULL), fMode(NULL), fSpropParameterSets(NULL), fEmphasis(NULL), fChannelOrder(NULL), 00544 fPlayStartTime(0.0), fPlayEndTime(0.0), 00545 fVideoWidth(0), fVideoHeight(0), fVideoFPS(0), fNumChannels(1), fScale(1.0f), fNPT_PTS_Offset(0.0f), 00546 fRTPSocket(NULL), fRTCPSocket(NULL), 00547 fRTPSource(NULL), fRTCPInstance(NULL), fReadSource(NULL), 00548 fSessionId(NULL) { 00549 rtpInfo.seqNum = 0; rtpInfo.timestamp = 0; rtpInfo.infoIsNew = False; 00550 }
| MediaSubsession::~MediaSubsession | ( | ) | [protected, virtual] |
Definition at line 552 of file MediaSession.cpp.
References deInitiate(), fChannelOrder, fCodecName, fConfig, fConnectionEndpointName, fControlPath, fEmphasis, fMediumName, fMode, fNext, fProtocolName, fSavedSDPLines, fSessionId, and fSpropParameterSets.
00552 { 00553 deInitiate(); 00554 00555 delete[] fConnectionEndpointName; delete[] fSavedSDPLines; 00556 delete[] fMediumName; delete[] fCodecName; delete[] fProtocolName; 00557 delete[] fControlPath; 00558 delete[] fConfig; delete[] fMode; delete[] fSpropParameterSets; delete[] fEmphasis; delete[] fChannelOrder; 00559 delete[] fSessionId; 00560 00561 delete fNext; 00562 }
| MediaSession& MediaSubsession::parentSession | ( | ) | [inline] |
Definition at line 144 of file MediaSession.hh.
References fParent.
Referenced by connectionEndpointAddress(), RTSPClient::constructSubsessionURL(), and subsessionAfterPlaying().
00144 { return fParent; }
| MediaSession const& MediaSubsession::parentSession | ( | ) | const [inline] |
| unsigned short MediaSubsession::clientPortNum | ( | ) | const [inline] |
Definition at line 147 of file MediaSession.hh.
References fClientPortNum.
Referenced by continueAfterDESCRIBE(), continueAfterSETUP(), RTSPClient::sendRequest(), setupNextSubsession(), and setupStreams().
00147 { return fClientPortNum; }
| unsigned char MediaSubsession::rtpPayloadFormat | ( | ) | const [inline] |
Definition at line 148 of file MediaSession.hh.
References fRTPPayloadFormat.
00148 { return fRTPPayloadFormat; }
| char const* MediaSubsession::savedSDPLines | ( | ) | const [inline] |
Definition at line 149 of file MediaSession.hh.
References fSavedSDPLines.
Referenced by QuickTimeFileSink::addAtom_hdlr2().
00149 { return fSavedSDPLines; }
| char const* MediaSubsession::mediumName | ( | ) | const [inline] |
Definition at line 150 of file MediaSession.hh.
References fMediumName.
Referenced by QuickTimeFileSink::addAtom_hdlr2(), DummySink::afterGettingFrame(), continueAfterDESCRIBE(), continueAfterSETUP(), createSourceObjects(), QuickTimeFileSink::onRTCPBye(), AVIFileSink::onRTCPBye(), operator<<(), printQOSData(), AVISubsessionIOState::setAVIstate(), SubsessionIOState::setQTstate(), setupStreams(), subsessionByeHandler(), SubsessionIOState::useFrameForHinting(), and while().
00150 { return fMediumName; }
| char const* MediaSubsession::codecName | ( | ) | const [inline] |
Definition at line 151 of file MediaSession.hh.
References fCodecName.
Referenced by QuickTimeFileSink::addAtom_hdlr2(), DummySink::afterGettingFrame(), continueAfterDESCRIBE(), continueAfterSETUP(), createSourceObjects(), QuickTimeFileSink::onRTCPBye(), AVIFileSink::onRTCPBye(), operator<<(), parseSDPAttribute_rtpmap(), printQOSData(), AVISubsessionIOState::setAVIstate(), SubsessionIOState::setQTstate(), setupStreams(), subsessionByeHandler(), and SubsessionIOState::useFrameForHinting().
00151 { return fCodecName; }
| char const* MediaSubsession::protocolName | ( | ) | const [inline] |
Definition at line 152 of file MediaSession.hh.
References fProtocolName.
Referenced by RTSPClient::sendRequest().
00152 { return fProtocolName; }
| char const* MediaSubsession::controlPath | ( | ) | const [inline] |
Definition at line 153 of file MediaSession.hh.
References fControlPath.
Referenced by RTSPClient::constructSubsessionURL(), and parseSDPAttribute_control().
00153 { return fControlPath; }
| Boolean MediaSubsession::isSSM | ( | ) | const [inline] |
Definition at line 154 of file MediaSession.hh.
References fSourceFilterAddr.
Referenced by initiate(), and setDestinations().
00154 { return fSourceFilterAddr.s_addr != 0; }
| unsigned short MediaSubsession::videoWidth | ( | ) | const [inline] |
Definition at line 156 of file MediaSession.hh.
References fVideoWidth.
Referenced by AVIFileSink::AVIFileSink(), createSourceObjects(), and QuickTimeFileSink::QuickTimeFileSink().
00156 { return fVideoWidth; }
| unsigned short MediaSubsession::videoHeight | ( | ) | const [inline] |
Definition at line 157 of file MediaSession.hh.
References fVideoHeight.
Referenced by AVIFileSink::AVIFileSink(), createSourceObjects(), and QuickTimeFileSink::QuickTimeFileSink().
00157 { return fVideoHeight; }
| unsigned MediaSubsession::videoFPS | ( | ) | const [inline] |
Definition at line 158 of file MediaSession.hh.
References fVideoFPS.
Referenced by AVIFileSink::AVIFileSink(), and QuickTimeFileSink::QuickTimeFileSink().
00158 { return fVideoFPS; }
| unsigned MediaSubsession::numChannels | ( | ) | const [inline] |
Definition at line 159 of file MediaSession.hh.
References fNumChannels.
Referenced by QuickTimeFileSink::addAtom_hdlr2(), parseSDPAttribute_rtpmap(), AVISubsessionIOState::setAVIstate(), and while().
00159 { return fNumChannels; }
| float& MediaSubsession::scale | ( | ) | [inline] |
Definition at line 160 of file MediaSession.hh.
References fScale.
Referenced by getNormalPlayTime(), RTSPClient::handlePLAYResponse(), and RTSPClient::sendRequest().
00160 { return fScale; }
| RTPSource* MediaSubsession::rtpSource | ( | ) | [inline] |
Definition at line 162 of file MediaSession.hh.
References fRTPSource.
Referenced by QuickTimeFileSink::addAtom_hdlr2(), DummySink::afterGettingFrame(), SubsessionIOState::afterGettingFrame(), AVISubsessionIOState::afterGettingFrame(), beginQOSMeasurement(), checkForPacketArrival(), checkInterPacketGaps(), continueAfterDESCRIBE(), getNormalPlayTime(), RTSPClient::handleSETUPResponse(), printQOSData(), SubsessionIOState::syncOK(), SubsessionIOState::useFrame(), and SubsessionIOState::useFrameForHinting().
00162 { return fRTPSource; }
| RTCPInstance* MediaSubsession::rtcpInstance | ( | ) | [inline] |
Definition at line 163 of file MediaSession.hh.
References fRTCPInstance.
Referenced by AVIFileSink::AVIFileSink(), RTSPClient::handleSETUPResponse(), QuickTimeFileSink::QuickTimeFileSink(), setupStreams(), and shutdownStream().
00163 { return fRTCPInstance; }
| unsigned MediaSubsession::rtpTimestampFrequency | ( | ) | const [inline] |
Definition at line 164 of file MediaSession.hh.
References fRTPTimestampFrequency.
Referenced by QuickTimeFileSink::addAtom_hdlr2(), parseSDPAttribute_rtpmap(), QuickTimeFileSink::QuickTimeFileSink(), AVISubsessionIOState::setAVIstate(), SubsessionIOState::setQTstate(), and SubsessionIOState::useFrameForHinting().
00164 { return fRTPTimestampFrequency; }
| FramedSource* MediaSubsession::readSource | ( | ) | [inline] |
Definition at line 165 of file MediaSession.hh.
References fReadSource.
Referenced by AVIFileSink::AVIFileSink(), AVISubsessionIOState::AVISubsessionIOState(), QuickTimeFileSink::continuePlaying(), AVIFileSink::continuePlaying(), MediaSession::initiateByMediaType(), QuickTimeFileSink::QuickTimeFileSink(), setupStreams(), and SubsessionIOState::SubsessionIOState().
00165 { return fReadSource; }
| double MediaSubsession::playStartTime | ( | ) | const |
Definition at line 564 of file MediaSession.cpp.
References fParent, fPlayStartTime, and MediaSession::playStartTime().
Referenced by getNormalPlayTime(), and parseSDPAttribute_range().
00564 { 00565 if (fPlayStartTime > 0) return fPlayStartTime; 00566 00567 return fParent.playStartTime(); 00568 }
| double MediaSubsession::playEndTime | ( | ) | const |
Definition at line 570 of file MediaSession.cpp.
References fParent, fPlayEndTime, and MediaSession::playEndTime().
Referenced by parseSDPAttribute_range().
00570 { 00571 if (fPlayEndTime > 0) return fPlayEndTime; 00572 00573 return fParent.playEndTime(); 00574 }
| double& MediaSubsession::_playStartTime | ( | ) | [inline] |
Definition at line 172 of file MediaSession.hh.
References fPlayStartTime.
Referenced by RTSPClient::handlePLAYResponse().
00172 { return fPlayStartTime; }
| double& MediaSubsession::_playEndTime | ( | ) | [inline] |
Definition at line 173 of file MediaSession.hh.
References fPlayEndTime.
Referenced by RTSPClient::handlePLAYResponse().
00173 { return fPlayEndTime; }
| Boolean MediaSubsession::initiate | ( | int | useSpecialRTPoffset = -1 |
) |
Definition at line 576 of file MediaSession.cpp.
References HashTable::Add(), Groupsock::changeDestinationParameters(), Medium::close(), MediaSession::CNAME(), connectionEndpointAddress(), HashTable::create(), RTCPInstance::createNew(), createSourceObjects(), env(), False, fBandwidth, fClientPortNum, fCodecName, fParent, fReadSource, fRTCPInstance, fRTCPSocket, fRTPSocket, fRTPSource, fSourceFilterAddr, getSourcePort(), increaseReceiveBufferTo(), isSSM(), NULL, Port::num(), ONE_WORD_HASH_KEYS, HashTable::RemoveNext(), UsageEnvironment::setResultMsg(), socketHashTable(), Socket::socketNum(), and True.
Referenced by continueAfterDESCRIBE(), MediaSession::initiateByMediaType(), DarwinInjector::setDestination(), and setupNextSubsession().
00576 { 00577 if (fReadSource != NULL) return True; // has already been initiated 00578 00579 do { 00580 if (fCodecName == NULL) { 00581 env().setResultMsg("Codec is unspecified"); 00582 break; 00583 } 00584 00585 // Create RTP and RTCP 'Groupsocks' on which to receive incoming data. 00586 // (Groupsocks will work even for unicast addresses) 00587 struct in_addr tempAddr; 00588 tempAddr.s_addr = connectionEndpointAddress(); 00589 // This could get changed later, as a result of a RTSP "SETUP" 00590 00591 if (fClientPortNum != 0) { 00592 // The sockets' port numbers were specified for us. Use these: 00593 fClientPortNum = fClientPortNum&~1; // even 00594 if (isSSM()) { 00595 fRTPSocket = new Groupsock(env(), tempAddr, fSourceFilterAddr, fClientPortNum); 00596 } else { 00597 fRTPSocket = new Groupsock(env(), tempAddr, fClientPortNum, 255); 00598 } 00599 if (fRTPSocket == NULL) { 00600 env().setResultMsg("Failed to create RTP socket"); 00601 break; 00602 } 00603 00604 // Set our RTCP port to be the RTP port +1 00605 portNumBits const rtcpPortNum = fClientPortNum|1; 00606 if (isSSM()) { 00607 fRTCPSocket = new Groupsock(env(), tempAddr, fSourceFilterAddr, rtcpPortNum); 00608 } else { 00609 fRTCPSocket = new Groupsock(env(), tempAddr, rtcpPortNum, 255); 00610 } 00611 if (fRTCPSocket == NULL) { 00612 char tmpBuf[100]; 00613 sprintf(tmpBuf, "Failed to create RTCP socket (port %d)", rtcpPortNum); 00614 env().setResultMsg(tmpBuf); 00615 break; 00616 } 00617 } else { 00618 // Port numbers were not specified in advance, so we use ephemeral port numbers. 00619 // Create sockets until we get a port-number pair (even: RTP; even+1: RTCP). 00620 // We need to make sure that we don't keep trying to use the same bad port numbers over and over again. 00621 // so we store bad sockets in a table, and delete them all when we're done. 00622 HashTable* socketHashTable = HashTable::create(ONE_WORD_HASH_KEYS); 00623 if (socketHashTable == NULL) break; 00624 Boolean success = False; 00625 NoReuse dummy(env()); // ensures that our new ephemeral port number won't be one that's already in use 00626 00627 while (1) { 00628 // Create a new socket: 00629 if (isSSM()) { 00630 fRTPSocket = new Groupsock(env(), tempAddr, fSourceFilterAddr, 0); 00631 } else { 00632 fRTPSocket = new Groupsock(env(), tempAddr, 0, 255); 00633 } 00634 if (fRTPSocket == NULL) { 00635 env().setResultMsg("MediaSession::initiate(): unable to create RTP and RTCP sockets"); 00636 break; 00637 } 00638 00639 // Get the client port number, and check whether it's even (for RTP): 00640 Port clientPort(0); 00641 if (!getSourcePort(env(), fRTPSocket->socketNum(), clientPort)) { 00642 break; 00643 } 00644 fClientPortNum = ntohs(clientPort.num()); 00645 if ((fClientPortNum&1) != 0) { // it's odd 00646 // Record this socket in our table, and keep trying: 00647 unsigned key = (unsigned)fClientPortNum; 00648 Groupsock* existing = (Groupsock*)socketHashTable->Add((char const*)key, fRTPSocket); 00649 delete existing; // in case it wasn't NULL 00650 continue; 00651 } 00652 00653 // Make sure we can use the next (i.e., odd) port number, for RTCP: 00654 portNumBits rtcpPortNum = fClientPortNum|1; 00655 if (isSSM()) { 00656 fRTCPSocket = new Groupsock(env(), tempAddr, fSourceFilterAddr, rtcpPortNum); 00657 } else { 00658 fRTCPSocket = new Groupsock(env(), tempAddr, rtcpPortNum, 255); 00659 } 00660 if (fRTCPSocket != NULL && fRTCPSocket->socketNum() >= 0) { 00661 // Success! Use these two sockets. 00662 success = True; 00663 break; 00664 } else { 00665 // We couldn't create the RTCP socket (perhaps that port number's already in use elsewhere?). 00666 delete fRTCPSocket; 00667 00668 // Record the first socket in our table, and keep trying: 00669 unsigned key = (unsigned)fClientPortNum; 00670 Groupsock* existing = (Groupsock*)socketHashTable->Add((char const*)key, fRTPSocket); 00671 delete existing; // in case it wasn't NULL 00672 continue; 00673 } 00674 } 00675 00676 // Clean up the socket hash table (and contents): 00677 Groupsock* oldGS; 00678 while ((oldGS = (Groupsock*)socketHashTable->RemoveNext()) != NULL) { 00679 delete oldGS; 00680 } 00681 delete socketHashTable; 00682 00683 if (!success) break; // a fatal error occurred trying to create the RTP and RTCP sockets; we can't continue 00684 } 00685 00686 // Try to use a big receive buffer for RTP - at least 0.1 second of 00687 // specified bandwidth and at least 50 KB 00688 unsigned rtpBufSize = fBandwidth * 25 / 2; // 1 kbps * 0.1 s = 12.5 bytes 00689 if (rtpBufSize < 50 * 1024) 00690 rtpBufSize = 50 * 1024; 00691 increaseReceiveBufferTo(env(), fRTPSocket->socketNum(), rtpBufSize); 00692 00693 // ASSERT: fRTPSocket != NULL && fRTCPSocket != NULL 00694 if (isSSM()) { 00695 // Special case for RTCP SSM: Send RTCP packets back to the source via unicast: 00696 fRTCPSocket->changeDestinationParameters(fSourceFilterAddr,0,~0); 00697 } 00698 00699 // Create "fRTPSource" and "fReadSource": 00700 if (!createSourceObjects(useSpecialRTPoffset)) break; 00701 00702 if (fReadSource == NULL) { 00703 env().setResultMsg("Failed to create read source"); 00704 break; 00705 } 00706 00707 // Finally, create our RTCP instance. (It starts running automatically) 00708 if (fRTPSource != NULL) { 00709 // If bandwidth is specified, use it and add 5% for RTCP overhead. 00710 // Otherwise make a guess at 500 kbps. 00711 unsigned totSessionBandwidth 00712 = fBandwidth ? fBandwidth + fBandwidth / 20 : 500; 00713 fRTCPInstance = RTCPInstance::createNew(env(), fRTCPSocket, 00714 totSessionBandwidth, 00715 (unsigned char const*) 00716 fParent.CNAME(), 00717 NULL /* we're a client */, 00718 fRTPSource); 00719 if (fRTCPInstance == NULL) { 00720 env().setResultMsg("Failed to create RTCP instance"); 00721 break; 00722 } 00723 } 00724 00725 return True; 00726 } while (0); 00727 00728 delete fRTPSocket; fRTPSocket = NULL; 00729 delete fRTCPSocket; fRTCPSocket = NULL; 00730 Medium::close(fRTCPInstance); fRTCPInstance = NULL; 00731 Medium::close(fReadSource); fReadSource = fRTPSource = NULL; 00732 fClientPortNum = 0; 00733 return False; 00734 }
| void MediaSubsession::deInitiate | ( | ) |
Definition at line 736 of file MediaSession.cpp.
References Medium::close(), fReadSource, fRTCPInstance, fRTCPSocket, fRTPSocket, fRTPSource, and NULL.
Referenced by MediaSession::initiateByMediaType(), and ~MediaSubsession().
00736 { 00737 Medium::close(fRTCPInstance); 00738 fRTCPInstance = NULL; 00739 00740 Medium::close(fReadSource); // this is assumed to also close fRTPSource 00741 fReadSource = NULL; fRTPSource = NULL; 00742 00743 delete fRTCPSocket; delete fRTPSocket; 00744 fRTCPSocket = fRTPSocket = NULL; 00745 }
| Boolean MediaSubsession::setClientPortNum | ( | unsigned short | portNum | ) |
Definition at line 747 of file MediaSession.cpp.
References env(), False, fClientPortNum, fReadSource, NULL, UsageEnvironment::setResultMsg(), and True.
Referenced by continueAfterDESCRIBE().
00747 { 00748 if (fReadSource != NULL) { 00749 env().setResultMsg("A read source has already been created"); 00750 return False; 00751 } 00752 00753 fClientPortNum = portNum; 00754 return True; 00755 }
| char*& MediaSubsession::connectionEndpointName | ( | ) | [inline] |
Definition at line 186 of file MediaSession.hh.
References fConnectionEndpointName.
Referenced by connectionEndpointAddress(), RTSPClient::handleSETUPResponse(), and parseSDPLine_c().
00186 { return fConnectionEndpointName; }
| char const* MediaSubsession::connectionEndpointName | ( | ) | const [inline] |
Definition at line 187 of file MediaSession.hh.
References fConnectionEndpointName.
00187 { 00188 return fConnectionEndpointName; 00189 }
| unsigned MediaSubsession::fmtp_auxiliarydatasizelength | ( | ) | const [inline] |
Definition at line 192 of file MediaSession.hh.
References fAuxiliarydatasizelength.
00192 { return fAuxiliarydatasizelength; }
| unsigned MediaSubsession::fmtp_constantduration | ( | ) | const [inline] |
Definition at line 193 of file MediaSession.hh.
References fConstantduration.
00193 { return fConstantduration; }
| unsigned MediaSubsession::fmtp_constantsize | ( | ) | const [inline] |
Definition at line 194 of file MediaSession.hh.
References fConstantsize.
00194 { return fConstantsize; }
| unsigned MediaSubsession::fmtp_crc | ( | ) | const [inline] |
| unsigned MediaSubsession::fmtp_ctsdeltalength | ( | ) | const [inline] |
Definition at line 196 of file MediaSession.hh.
References fCtsdeltalength.
00196 { return fCtsdeltalength; }
| unsigned MediaSubsession::fmtp_de_interleavebuffersize | ( | ) | const [inline] |
Definition at line 197 of file MediaSession.hh.
References fDe_interleavebuffersize.
00197 { return fDe_interleavebuffersize; }
| unsigned MediaSubsession::fmtp_dtsdeltalength | ( | ) | const [inline] |
Definition at line 198 of file MediaSession.hh.
References fDtsdeltalength.
00198 { return fDtsdeltalength; }
| unsigned MediaSubsession::fmtp_indexdeltalength | ( | ) | const [inline] |
Definition at line 199 of file MediaSession.hh.
References fIndexdeltalength.
00199 { return fIndexdeltalength; }
| unsigned MediaSubsession::fmtp_indexlength | ( | ) | const [inline] |
Definition at line 200 of file MediaSession.hh.
References fIndexlength.
Referenced by SubsessionIOState::useFrameForHinting().
00200 { return fIndexlength; }
| unsigned MediaSubsession::fmtp_interleaving | ( | ) | const [inline] |
Definition at line 201 of file MediaSession.hh.
References fInterleaving.
00201 { return fInterleaving; }
| unsigned MediaSubsession::fmtp_maxdisplacement | ( | ) | const [inline] |
Definition at line 202 of file MediaSession.hh.
References fMaxdisplacement.
00202 { return fMaxdisplacement; }
| unsigned MediaSubsession::fmtp_objecttype | ( | ) | const [inline] |
Definition at line 203 of file MediaSession.hh.
References fObjecttype.
00203 { return fObjecttype; }
| unsigned MediaSubsession::fmtp_octetalign | ( | ) | const [inline] |
Definition at line 204 of file MediaSession.hh.
References fOctetalign.
00204 { return fOctetalign; }
| unsigned MediaSubsession::fmtp_profile_level_id | ( | ) | const [inline] |
Definition at line 205 of file MediaSession.hh.
References fProfile_level_id.
00205 { return fProfile_level_id; }
| unsigned MediaSubsession::fmtp_robustsorting | ( | ) | const [inline] |
Definition at line 206 of file MediaSession.hh.
References fRobustsorting.
00206 { return fRobustsorting; }
| unsigned MediaSubsession::fmtp_sizelength | ( | ) | const [inline] |
Definition at line 207 of file MediaSession.hh.
References fSizelength.
Referenced by SubsessionIOState::useFrameForHinting().
00207 { return fSizelength; }
| unsigned MediaSubsession::fmtp_streamstateindication | ( | ) | const [inline] |
Definition at line 208 of file MediaSession.hh.
References fStreamstateindication.
00208 { return fStreamstateindication; }
| unsigned MediaSubsession::fmtp_streamtype | ( | ) | const [inline] |
Definition at line 209 of file MediaSession.hh.
References fStreamtype.
00209 { return fStreamtype; }
| Boolean MediaSubsession::fmtp_cpresent | ( | ) | const [inline] |
| Boolean MediaSubsession::fmtp_randomaccessindication | ( | ) | const [inline] |
Definition at line 211 of file MediaSession.hh.
References fRandomaccessindication.
00211 { return fRandomaccessindication; }
| char const* MediaSubsession::fmtp_config | ( | ) | const [inline] |
Definition at line 212 of file MediaSession.hh.
References fConfig.
Referenced by QuickTimeFileSink::addAtom_hdlr2(), fmtp_configuration(), SubsessionIOState::setQTstate(), and setupStreams().
00212 { return fConfig; }
| char const* MediaSubsession::fmtp_configuration | ( | ) | const [inline] |
Definition at line 213 of file MediaSession.hh.
References fmtp_config().
00213 { return fmtp_config(); }
| char const* MediaSubsession::fmtp_mode | ( | ) | const [inline] |
| char const* MediaSubsession::fmtp_spropparametersets | ( | ) | const [inline] |
Definition at line 215 of file MediaSession.hh.
References fSpropParameterSets.
Referenced by QuickTimeFileSink::addAtom_hdlr2(), and setupStreams().
00215 { return fSpropParameterSets; }
| char const* MediaSubsession::fmtp_emphasis | ( | ) | const [inline] |
| char const* MediaSubsession::fmtp_channelorder | ( | ) | const [inline] |
Definition at line 217 of file MediaSession.hh.
References fChannelOrder.
00217 { return fChannelOrder; }
| netAddressBits MediaSubsession::connectionEndpointAddress | ( | ) | const |
Definition at line 757 of file MediaSession.cpp.
References MediaSession::connectionEndpointName(), connectionEndpointName(), NetAddress::data(), NetAddressList::firstAddress(), NULL, NetAddressList::numAddresses(), and parentSession().
Referenced by RTSPClient::handleSETUPResponse(), initiate(), RTSPClient::sendRequest(), and setDestinations().
00757 { 00758 do { 00759 // Get the endpoint name from with us, or our parent session: 00760 char const* endpointString = connectionEndpointName(); 00761 if (endpointString == NULL) { 00762 endpointString = parentSession().connectionEndpointName(); 00763 } 00764 if (endpointString == NULL) break; 00765 00766 // Now, convert this name to an address, if we can: 00767 NetAddressList addresses(endpointString); 00768 if (addresses.numAddresses() == 0) break; 00769 00770 return *(netAddressBits*)(addresses.firstAddress()->data()); 00771 } while (0); 00772 00773 // No address known: 00774 return 0; 00775 }
| void MediaSubsession::setDestinations | ( | netAddressBits | defaultDestAddress | ) |
Definition at line 777 of file MediaSession.cpp.
References Groupsock::changeDestinationParameters(), connectionEndpointAddress(), fRTCPSocket, fRTPSocket, isSSM(), NULL, and serverPortNum.
Referenced by RTSPClient::handleSETUPResponse().
00777 { 00778 // Get the destination address from the connection endpoint name 00779 // (This will be 0 if it's not known, in which case we use the default) 00780 netAddressBits destAddress = connectionEndpointAddress(); 00781 if (destAddress == 0) destAddress = defaultDestAddress; 00782 struct in_addr destAddr; destAddr.s_addr = destAddress; 00783 00784 // The destination TTL remains unchanged: 00785 int destTTL = ~0; // means: don't change 00786 00787 if (fRTPSocket != NULL) { 00788 Port destPort(serverPortNum); 00789 fRTPSocket->changeDestinationParameters(destAddr, destPort, destTTL); 00790 } 00791 if (fRTCPSocket != NULL && !isSSM()) { 00792 // Note: For SSM sessions, the dest address for RTCP was already set. 00793 Port destPort(serverPortNum+1); 00794 fRTCPSocket-> 00795 changeDestinationParameters(destAddr, destPort, destTTL); 00796 } 00797 }
| char const* MediaSubsession::sessionId | ( | ) | const [inline] |
Definition at line 226 of file MediaSession.hh.
References fSessionId.
Referenced by RTSPClient::sendRequest().
00226 { return fSessionId; }
| void MediaSubsession::setSessionId | ( | char const * | sessionId | ) |
Definition at line 799 of file MediaSession.cpp.
References fSessionId, and strDup().
Referenced by RTSPClient::handleSETUPResponse(), and setupSubsession().
00799 { 00800 delete[] fSessionId; 00801 fSessionId = strDup(sessionId); 00802 }
| double MediaSubsession::getNormalPlayTime | ( | struct timeval const & | presentationTime | ) |
Definition at line 804 of file MediaSession.cpp.
References RTPSource::curPacketRTPTimestamp(), False, fNPT_PTS_Offset, NULL, playStartTime(), rtpInfo, rtpSource(), scale(), and seqNumLT().
00804 { 00805 if (rtpSource() == NULL || rtpSource()->timestampFrequency() == 0) return 0.0; // no RTP source, or bad freq! 00806 00807 // First, check whether our "RTPSource" object has already been synchronized using RTCP. 00808 // If it hasn't, then - as a special case - we need to use the RTP timestamp to compute the NPT. 00809 if (!rtpSource()->hasBeenSynchronizedUsingRTCP()) { 00810 if (!rtpInfo.infoIsNew) return 0.0; // the "rtpInfo" structure has not been filled in 00811 u_int32_t timestampOffset = rtpSource()->curPacketRTPTimestamp() - rtpInfo.timestamp; 00812 double nptOffset = (timestampOffset/(double)(rtpSource()->timestampFrequency()))*scale(); 00813 double npt = playStartTime() + nptOffset; 00814 00815 return npt; 00816 } else { 00817 // Common case: We have been synchronized using RTCP. This means that the "presentationTime" parameter 00818 // will be accurate, and so we should use this to compute the NPT. 00819 double ptsDouble = (double)(presentationTime.tv_sec + presentationTime.tv_usec/1000000.0); 00820 00821 if (rtpInfo.infoIsNew) { 00822 // This is the first time we've been called with a synchronized presentation time since the "rtpInfo" 00823 // structure was last filled in. Use this "presentationTime" to compute "fNPT_PTS_Offset": 00824 if (seqNumLT(rtpSource()->curPacketRTPSeqNum(), rtpInfo.seqNum)) return -0.1; // sanity check; ignore old packets 00825 u_int32_t timestampOffset = rtpSource()->curPacketRTPTimestamp() - rtpInfo.timestamp; 00826 double nptOffset = (timestampOffset/(double)(rtpSource()->timestampFrequency()))*scale(); 00827 double npt = playStartTime() + nptOffset; 00828 fNPT_PTS_Offset = npt - ptsDouble*scale(); 00829 rtpInfo.infoIsNew = False; // for next time 00830 00831 return npt; 00832 } else { 00833 // Use the precomputed "fNPT_PTS_Offset" to compute the NPT from the PTS: 00834 if (fNPT_PTS_Offset == 0.0) return 0.0; // error: The "rtpInfo" structure was apparently never filled in 00835 return (double)(ptsDouble*scale() + fNPT_PTS_Offset); 00836 } 00837 } 00838 }
| UsageEnvironment& MediaSubsession::env | ( | ) | [inline, protected] |
Definition at line 258 of file MediaSession.hh.
References Medium::envir(), and fParent.
Referenced by createSourceObjects(), initiate(), and setClientPortNum().
| void MediaSubsession::setNext | ( | MediaSubsession * | next | ) | [inline, protected] |
Definition at line 259 of file MediaSession.hh.
References fNext, and MediaSubsessionIterator::next().
Referenced by MediaSession::initializeWithSDP().
00259 { fNext = next; }
| Boolean MediaSubsession::parseSDPLine_c | ( | char const * | sdpLine | ) | [protected] |
Definition at line 840 of file MediaSession.cpp.
References connectionEndpointName(), False, fConnectionEndpointName, NULL, parseCLine(), and True.
Referenced by MediaSession::initializeWithSDP().
00840 { 00841 // Check for "c=IN IP4 <connection-endpoint>" 00842 // or "c=IN IP4 <connection-endpoint>/<ttl+numAddresses>" 00843 // (Later, do something with <ttl+numAddresses> also #####) 00844 char* connectionEndpointName = parseCLine(sdpLine); 00845 if (connectionEndpointName != NULL) { 00846 delete[] fConnectionEndpointName; 00847 fConnectionEndpointName = connectionEndpointName; 00848 return True; 00849 } 00850 00851 return False; 00852 }
| Boolean MediaSubsession::parseSDPLine_b | ( | char const * | sdpLine | ) | [protected] |
Definition at line 854 of file MediaSession.cpp.
References fBandwidth.
Referenced by MediaSession::initializeWithSDP().
00854 { 00855 // Check for "b=<bwtype>:<bandwidth>" line 00856 // RTP applications are expected to use bwtype="AS" 00857 return sscanf(sdpLine, "b=AS:%u", &fBandwidth) == 1; 00858 }
| Boolean MediaSubsession::parseSDPAttribute_rtpmap | ( | char const * | sdpLine | ) | [protected] |
Definition at line 860 of file MediaSession.cpp.
References codecName(), False, fCodecName, fNumChannels, fRTPPayloadFormat, fRTPTimestampFrequency, numChannels(), rtpTimestampFrequency(), strDup(), strDupSize(), and True.
Referenced by MediaSession::initializeWithSDP().
00860 { 00861 // Check for a "a=rtpmap:<fmt> <codec>/<freq>" line: 00862 // (Also check without the "/<freq>"; RealNetworks omits this) 00863 // Also check for a trailing "/<numChannels>". 00864 Boolean parseSuccess = False; 00865 00866 unsigned rtpmapPayloadFormat; 00867 char* codecName = strDupSize(sdpLine); // ensures we have enough space 00868 unsigned rtpTimestampFrequency = 0; 00869 unsigned numChannels = 1; 00870 if (sscanf(sdpLine, "a=rtpmap: %u %[^/]/%u/%u", 00871 &rtpmapPayloadFormat, codecName, &rtpTimestampFrequency, 00872 &numChannels) == 4 00873 || sscanf(sdpLine, "a=rtpmap: %u %[^/]/%u", 00874 &rtpmapPayloadFormat, codecName, &rtpTimestampFrequency) == 3 00875 || sscanf(sdpLine, "a=rtpmap: %u %s", 00876 &rtpmapPayloadFormat, codecName) == 2) { 00877 parseSuccess = True; 00878 if (rtpmapPayloadFormat == fRTPPayloadFormat) { 00879 // This "rtpmap" matches our payload format, so set our 00880 // codec name and timestamp frequency: 00881 // (First, make sure the codec name is upper case) 00882 { 00883 Locale l("POSIX"); 00884 for (char* p = codecName; *p != '\0'; ++p) *p = toupper(*p); 00885 } 00886 delete[] fCodecName; fCodecName = strDup(codecName); 00887 fRTPTimestampFrequency = rtpTimestampFrequency; 00888 fNumChannels = numChannels; 00889 } 00890 } 00891 delete[] codecName; 00892 00893 return parseSuccess; 00894 }
| Boolean MediaSubsession::parseSDPAttribute_control | ( | char const * | sdpLine | ) | [protected] |
Definition at line 896 of file MediaSession.cpp.
References controlPath(), False, fControlPath, strDup(), strDupSize(), and True.
Referenced by MediaSession::initializeWithSDP().
00896 { 00897 // Check for a "a=control:<control-path>" line: 00898 Boolean parseSuccess = False; 00899 00900 char* controlPath = strDupSize(sdpLine); // ensures we have enough space 00901 if (sscanf(sdpLine, "a=control: %s", controlPath) == 1) { 00902 parseSuccess = True; 00903 delete[] fControlPath; fControlPath = strDup(controlPath); 00904 } 00905 delete[] controlPath; 00906 00907 return parseSuccess; 00908 }
| Boolean MediaSubsession::parseSDPAttribute_range | ( | char const * | sdpLine | ) | [protected] |
Definition at line 910 of file MediaSession.cpp.
References False, fParent, fPlayEndTime, fPlayStartTime, parseRangeAttribute(), MediaSession::playEndTime(), playEndTime(), MediaSession::playStartTime(), playStartTime(), and True.
Referenced by MediaSession::initializeWithSDP().
00910 { 00911 // Check for a "a=range:npt=<startTime>-<endTime>" line: 00912 // (Later handle other kinds of "a=range" attributes also???#####) 00913 Boolean parseSuccess = False; 00914 00915 double playStartTime; 00916 double playEndTime; 00917 if (parseRangeAttribute(sdpLine, playStartTime, playEndTime)) { 00918 parseSuccess = True; 00919 if (playStartTime > fPlayStartTime) { 00920 fPlayStartTime = playStartTime; 00921 if (playStartTime > fParent.playStartTime()) { 00922 fParent.playStartTime() = playStartTime; 00923 } 00924 } 00925 if (playEndTime > fPlayEndTime) { 00926 fPlayEndTime = playEndTime; 00927 if (playEndTime > fParent.playEndTime()) { 00928 fParent.playEndTime() = playEndTime; 00929 } 00930 } 00931 } 00932 00933 return parseSuccess; 00934 }
| Boolean MediaSubsession::parseSDPAttribute_fmtp | ( | char const * | sdpLine | ) | [protected] |
Definition at line 936 of file MediaSession.cpp.
References False, fAuxiliarydatasizelength, fChannelOrder, fConfig, fConstantduration, fConstantsize, fCpresent, fCRC, fCtsdeltalength, fDe_interleavebuffersize, fDtsdeltalength, fEmphasis, fIndexdeltalength, fIndexlength, fInterleaving, fMaxdisplacement, fMode, fObjecttype, fOctetalign, fProfile_level_id, fRandomaccessindication, fRobustsorting, fSizelength, fSpropParameterSets, fStreamstateindication, fStreamtype, strDup(), strDupSize(), and True.
Referenced by MediaSession::initializeWithSDP().
00936 { 00937 // Check for a "a=fmtp:" line: 00938 // TEMP: We check only for a handful of expected parameter names ##### 00939 // Later: (i) check that payload format number matches; ##### 00940 // (ii) look for other parameters also (generalize?) ##### 00941 do { 00942 if (strncmp(sdpLine, "a=fmtp:", 7) != 0) break; sdpLine += 7; 00943 while (isdigit(*sdpLine)) ++sdpLine; 00944 00945 // The remaining "sdpLine" should be a sequence of 00946 // <name>=<value>; 00947 // parameter assignments. Look at each of these. 00948 // First, convert the line to lower-case, to ease comparison: 00949 char* const lineCopy = strDup(sdpLine); char* line = lineCopy; 00950 { 00951 Locale l("POSIX"); 00952 for (char* c = line; *c != '\0'; ++c) *c = tolower(*c); 00953 } 00954 while (*line != '\0' && *line != '\r' && *line != '\n') { 00955 unsigned u; 00956 char* valueStr = strDupSize(line); 00957 if (sscanf(line, " auxiliarydatasizelength = %u", &u) == 1) { 00958 fAuxiliarydatasizelength = u; 00959 } else if (sscanf(line, " constantduration = %u", &u) == 1) { 00960 fConstantduration = u; 00961 } else if (sscanf(line, " constantsize; = %u", &u) == 1) { 00962 fConstantsize = u; 00963 } else if (sscanf(line, " crc = %u", &u) == 1) { 00964 fCRC = u; 00965 } else if (sscanf(line, " ctsdeltalength = %u", &u) == 1) { 00966 fCtsdeltalength = u; 00967 } else if (sscanf(line, " de-interleavebuffersize = %u", &u) == 1) { 00968 fDe_interleavebuffersize = u; 00969 } else if (sscanf(line, " dtsdeltalength = %u", &u) == 1) { 00970 fDtsdeltalength = u; 00971 } else if (sscanf(line, " indexdeltalength = %u", &u) == 1) { 00972 fIndexdeltalength = u; 00973 } else if (sscanf(line, " indexlength = %u", &u) == 1) { 00974 fIndexlength = u; 00975 } else if (sscanf(line, " interleaving = %u", &u) == 1) { 00976 fInterleaving = u; 00977 } else if (sscanf(line, " maxdisplacement = %u", &u) == 1) { 00978 fMaxdisplacement = u; 00979 } else if (sscanf(line, " objecttype = %u", &u) == 1) { 00980 fObjecttype = u; 00981 } else if (sscanf(line, " octet-align = %u", &u) == 1) { 00982 fOctetalign = u; 00983 } else if (sscanf(line, " profile-level-id = %x", &u) == 1) { 00984 // Note that the "profile-level-id" parameter is assumed to be hexadecimal 00985 fProfile_level_id = u; 00986 } else if (sscanf(line, " robust-sorting = %u", &u) == 1) { 00987 fRobustsorting = u; 00988 } else if (sscanf(line, " sizelength = %u", &u) == 1) { 00989 fSizelength = u; 00990 } else if (sscanf(line, " streamstateindication = %u", &u) == 1) { 00991 fStreamstateindication = u; 00992 } else if (sscanf(line, " streamtype = %u", &u) == 1) { 00993 fStreamtype = u; 00994 } else if (sscanf(line, " cpresent = %u", &u) == 1) { 00995 fCpresent = u != 0; 00996 } else if (sscanf(line, " randomaccessindication = %u", &u) == 1) { 00997 fRandomaccessindication = u != 0; 00998 } else if (sscanf(sdpLine, " config = %[^; \t\r\n]", valueStr) == 1 || 00999 sscanf(sdpLine, " configuration = %[^; \t\r\n]", valueStr) == 1) { 01000 // Note: We used "sdpLine" here, because the value may be case-sensitive (if it's Base-64). 01001 delete[] fConfig; fConfig = strDup(valueStr); 01002 } else if (sscanf(line, " mode = %[^; \t\r\n]", valueStr) == 1) { 01003 delete[] fMode; fMode = strDup(valueStr); 01004 } else if (sscanf(sdpLine, " sprop-parameter-sets = %[^; \t\r\n]", valueStr) == 1) { 01005 // Note: We used "sdpLine" here, because the value is case-sensitive. 01006 delete[] fSpropParameterSets; fSpropParameterSets = strDup(valueStr); 01007 } else if (sscanf(line, " emphasis = %[^; \t\r\n]", valueStr) == 1) { 01008 delete[] fEmphasis; fEmphasis = strDup(valueStr); 01009 } else if (sscanf(sdpLine, " channel-order = %[^; \t\r\n]", valueStr) == 1) { 01010 // Note: We used "sdpLine" here, because the value is case-sensitive. 01011 delete[] fChannelOrder; fChannelOrder = strDup(valueStr); 01012 } else { 01013 // Some of the above parameters are Boolean. Check whether the parameter 01014 // names appear alone, without a "= 1" at the end: 01015 if (sscanf(line, " %[^; \t\r\n]", valueStr) == 1) { 01016 if (strcmp(valueStr, "octet-align") == 0) { 01017 fOctetalign = 1; 01018 } else if (strcmp(valueStr, "cpresent") == 0) { 01019 fCpresent = True; 01020 } else if (strcmp(valueStr, "crc") == 0) { 01021 fCRC = 1; 01022 } else if (strcmp(valueStr, "robust-sorting") == 0) { 01023 fRobustsorting = 1; 01024 } else if (strcmp(valueStr, "randomaccessindication") == 0) { 01025 fRandomaccessindication = True; 01026 } 01027 } 01028 } 01029 delete[] valueStr; 01030 01031 // Move to the next parameter assignment string: 01032 while (*line != '\0' && *line != '\r' && *line != '\n' 01033 && *line != ';') ++line; 01034 while (*line == ';') ++line; 01035 01036 // Do the same with sdpLine; needed for finding case sensitive values: 01037 while (*sdpLine != '\0' && *sdpLine != '\r' && *sdpLine != '\n' 01038 && *sdpLine != ';') ++sdpLine; 01039 while (*sdpLine == ';') ++sdpLine; 01040 } 01041 delete[] lineCopy; 01042 return True; 01043 } while (0); 01044 01045 return False; 01046 }
| Boolean MediaSubsession::parseSDPAttribute_source_filter | ( | char const * | sdpLine | ) | [protected] |
Definition at line 1049 of file MediaSession.cpp.
References fSourceFilterAddr, and parseSourceFilterAttribute().
Referenced by MediaSession::initializeWithSDP().
01049 { 01050 return parseSourceFilterAttribute(sdpLine, fSourceFilterAddr); 01051 }
| Boolean MediaSubsession::parseSDPAttribute_x_dimensions | ( | char const * | sdpLine | ) | [protected] |
Definition at line 1053 of file MediaSession.cpp.
References False, fVideoHeight, fVideoWidth, and True.
Referenced by MediaSession::initializeWithSDP().
01053 { 01054 // Check for a "a=x-dimensions:<width>,<height>" line: 01055 Boolean parseSuccess = False; 01056 01057 int width, height; 01058 if (sscanf(sdpLine, "a=x-dimensions:%d,%d", &width, &height) == 2) { 01059 parseSuccess = True; 01060 fVideoWidth = (unsigned short)width; 01061 fVideoHeight = (unsigned short)height; 01062 } 01063 01064 return parseSuccess; 01065 }
| Boolean MediaSubsession::parseSDPAttribute_framerate | ( | char const * | sdpLine | ) | [protected] |
Definition at line 1067 of file MediaSession.cpp.
References False, fVideoFPS, and True.
Referenced by MediaSession::initializeWithSDP().
01067 { 01068 // Check for a "a=framerate: <fps>" or "a=x-framerate: <fps>" line: 01069 Boolean parseSuccess = False; 01070 01071 float frate; 01072 int rate; 01073 if (sscanf(sdpLine, "a=framerate: %f", &frate) == 1 || sscanf(sdpLine, "a=framerate:%f", &frate) == 1) { 01074 parseSuccess = True; 01075 fVideoFPS = (unsigned)frate; 01076 } else if (sscanf(sdpLine, "a=x-framerate: %d", &rate) == 1) { 01077 parseSuccess = True; 01078 fVideoFPS = (unsigned)rate; 01079 } 01080 01081 return parseSuccess; 01082 }
| Boolean MediaSubsession::createSourceObjects | ( | int | useSpecialRTPoffset | ) | [protected, virtual] |
Definition at line 1084 of file MediaSession.cpp.
References codecName(), QuickTimeGenericRTPSource::createNew(), JPEGVideoRTPSource::createNew(), DVVideoRTPSource::createNew(), H264VideoRTPSource::createNew(), H263plusVideoRTPSource::createNew(), H261VideoRTPSource::createNew(), MPEG1or2VideoRTPSource::createNew(), MPEG4GenericRTPSource::createNew(), MPEG4ESVideoRTPSource::createNew(), AC3AudioRTPSource::createNew(), VP8VideoRTPSource::createNew(), VorbisAudioRTPSource::createNew(), MPEG4LATMAudioRTPSource::createNew(), SimpleRTPSource::createNew(), MP3FromADUSource::createNew(), MP3ADUdeinterleaver::createNew(), MP3ADURTPSource::createNew(), MPEG1or2AudioRTPSource::createNew(), AMRAudioRTPSource::createNew(), QCELPAudioRTPSource::createNew(), MPEG2TransportStreamFramer::createNew(), BasicUDPSource::createNew(), env(), False, fCodecName, fCRC, fIndexdeltalength, fIndexlength, fInterleaving, fMediumName, fMode, fNumChannels, fOctetalign, fProtocolName, fReadSource, fRobustsorting, fRTPPayloadFormat, fRTPSocket, fRTPSource, fRTPTimestampFrequency, fSizelength, mediumName(), NULL, UsageEnvironment::setResultMsg(), True, videoHeight(), and videoWidth().
Referenced by initiate().
01084 { 01085 do { 01086 // First, check "fProtocolName" 01087 if (strcmp(fProtocolName, "UDP") == 0) { 01088 // A UDP-packetized stream (*not* a RTP stream) 01089 fReadSource = BasicUDPSource::createNew(env(), fRTPSocket); 01090 fRTPSource = NULL; // Note! 01091 01092 if (strcmp(fCodecName, "MP2T") == 0) { // MPEG-2 Transport Stream 01093 fReadSource = MPEG2TransportStreamFramer::createNew(env(), fReadSource); 01094 // this sets "durationInMicroseconds" correctly, based on the PCR values 01095 } 01096 } else { 01097 // Check "fCodecName" against the set of codecs that we support, 01098 // and create our RTP source accordingly 01099 // (Later make this code more efficient, as this set grows #####) 01100 // (Also, add more fmts that can be implemented by SimpleRTPSource#####) 01101 Boolean createSimpleRTPSource = False; // by default; can be changed below 01102 Boolean doNormalMBitRule = False; // default behavior if "createSimpleRTPSource" is True 01103 if (strcmp(fCodecName, "QCELP") == 0) { // QCELP audio 01104 fReadSource = 01105 QCELPAudioRTPSource::createNew(env(), fRTPSocket, fRTPSource, 01106 fRTPPayloadFormat, 01107 fRTPTimestampFrequency); 01108 // Note that fReadSource will differ from fRTPSource in this case 01109 } else if (strcmp(fCodecName, "AMR") == 0) { // AMR audio (narrowband) 01110 fReadSource = 01111 AMRAudioRTPSource::createNew(env(), fRTPSocket, fRTPSource, 01112 fRTPPayloadFormat, 0 /*isWideband*/, 01113 fNumChannels, fOctetalign, fInterleaving, 01114 fRobustsorting, fCRC); 01115 // Note that fReadSource will differ from fRTPSource in this case 01116 } else if (strcmp(fCodecName, "AMR-WB") == 0) { // AMR audio (wideband) 01117 fReadSource = 01118 AMRAudioRTPSource::createNew(env(), fRTPSocket, fRTPSource, 01119 fRTPPayloadFormat, 1 /*isWideband*/, 01120 fNumChannels, fOctetalign, fInterleaving, 01121 fRobustsorting, fCRC); 01122 // Note that fReadSource will differ from fRTPSource in this case 01123 } else if (strcmp(fCodecName, "MPA") == 0) { // MPEG-1 or 2 audio 01124 fReadSource = fRTPSource 01125 = MPEG1or2AudioRTPSource::createNew(env(), fRTPSocket, 01126 fRTPPayloadFormat, 01127 fRTPTimestampFrequency); 01128 } else if (strcmp(fCodecName, "MPA-ROBUST") == 0) { // robust MP3 audio 01129 fRTPSource 01130 = MP3ADURTPSource::createNew(env(), fRTPSocket, fRTPPayloadFormat, 01131 fRTPTimestampFrequency); 01132 if (fRTPSource == NULL) break; 01133 01134 // Add a filter that deinterleaves the ADUs after depacketizing them: 01135 MP3ADUdeinterleaver* deinterleaver 01136 = MP3ADUdeinterleaver::createNew(env(), fRTPSource); 01137 if (deinterleaver == NULL) break; 01138 01139 // Add another filter that converts these ADUs to MP3 frames: 01140 fReadSource = MP3FromADUSource::createNew(env(), deinterleaver); 01141 } else if (strcmp(fCodecName, "X-MP3-DRAFT-00") == 0) { 01142 // a non-standard variant of "MPA-ROBUST" used by RealNetworks 01143 // (one 'ADU'ized MP3 frame per packet; no headers) 01144 fRTPSource 01145 = SimpleRTPSource::createNew(env(), fRTPSocket, fRTPPayloadFormat, 01146 fRTPTimestampFrequency, 01147 "audio/MPA-ROBUST" /*hack*/); 01148 if (fRTPSource == NULL) break; 01149 01150 // Add a filter that converts these ADUs to MP3 frames: 01151 fReadSource = MP3FromADUSource::createNew(env(), fRTPSource, 01152 False /*no ADU header*/); 01153 } else if (strcmp(fCodecName, "MP4A-LATM") == 0) { // MPEG-4 LATM audio 01154 fReadSource = fRTPSource 01155 = MPEG4LATMAudioRTPSource::createNew(env(), fRTPSocket, 01156 fRTPPayloadFormat, 01157 fRTPTimestampFrequency); 01158 } else if (strcmp(fCodecName, "VORBIS") == 0) { // Vorbis audio 01159 fReadSource = fRTPSource 01160 = VorbisAudioRTPSource::createNew(env(), fRTPSocket, 01161 fRTPPayloadFormat, 01162 fRTPTimestampFrequency); 01163 } else if (strcmp(fCodecName, "VP8") == 0) { // VP8 video 01164 fReadSource = fRTPSource 01165 = VP8VideoRTPSource::createNew(env(), fRTPSocket, 01166 fRTPPayloadFormat, 01167 fRTPTimestampFrequency); 01168 } else if (strcmp(fCodecName, "AC3") == 0 || strcmp(fCodecName, "EAC3") == 0) { // AC3 audio 01169 fReadSource = fRTPSource 01170 = AC3AudioRTPSource::createNew(env(), fRTPSocket, 01171 fRTPPayloadFormat, 01172 fRTPTimestampFrequency); 01173 } else if (strcmp(fCodecName, "MP4V-ES") == 0) { // MPEG-4 Elementary Stream video 01174 fReadSource = fRTPSource 01175 = MPEG4ESVideoRTPSource::createNew(env(), fRTPSocket, 01176 fRTPPayloadFormat, 01177 fRTPTimestampFrequency); 01178 } else if (strcmp(fCodecName, "MPEG4-GENERIC") == 0) { 01179 fReadSource = fRTPSource 01180 = MPEG4GenericRTPSource::createNew(env(), fRTPSocket, 01181 fRTPPayloadFormat, 01182 fRTPTimestampFrequency, 01183 fMediumName, fMode, 01184 fSizelength, fIndexlength, 01185 fIndexdeltalength); 01186 } else if (strcmp(fCodecName, "MPV") == 0) { // MPEG-1 or 2 video 01187 fReadSource = fRTPSource 01188 = MPEG1or2VideoRTPSource::createNew(env(), fRTPSocket, 01189 fRTPPayloadFormat, 01190 fRTPTimestampFrequency); 01191 } else if (strcmp(fCodecName, "MP2T") == 0) { // MPEG-2 Transport Stream 01192 fRTPSource = SimpleRTPSource::createNew(env(), fRTPSocket, fRTPPayloadFormat, 01193 fRTPTimestampFrequency, "video/MP2T", 01194 0, False); 01195 fReadSource = MPEG2TransportStreamFramer::createNew(env(), fRTPSource); 01196 // this sets "durationInMicroseconds" correctly, based on the PCR values 01197 } else if (strcmp(fCodecName, "H261") == 0) { // H.261 01198 fReadSource = fRTPSource 01199 = H261VideoRTPSource::createNew(env(), fRTPSocket, 01200 fRTPPayloadFormat, 01201 fRTPTimestampFrequency); 01202 } else if (strcmp(fCodecName, "H263-1998") == 0 || 01203 strcmp(fCodecName, "H263-2000") == 0) { // H.263+ 01204 fReadSource = fRTPSource 01205 = H263plusVideoRTPSource::createNew(env(), fRTPSocket, 01206 fRTPPayloadFormat, 01207 fRTPTimestampFrequency); 01208 } else if (strcmp(fCodecName, "H264") == 0) { 01209 fReadSource = fRTPSource 01210 = H264VideoRTPSource::createNew(env(), fRTPSocket, 01211 fRTPPayloadFormat, 01212 fRTPTimestampFrequency); 01213 } else if (strcmp(fCodecName, "DV") == 0) { 01214 fReadSource = fRTPSource 01215 = DVVideoRTPSource::createNew(env(), fRTPSocket, 01216 fRTPPayloadFormat, 01217 fRTPTimestampFrequency); 01218 } else if (strcmp(fCodecName, "JPEG") == 0) { // motion JPEG 01219 fReadSource = fRTPSource 01220 = JPEGVideoRTPSource::createNew(env(), fRTPSocket, 01221 fRTPPayloadFormat, 01222 fRTPTimestampFrequency, 01223 videoWidth(), 01224 videoHeight()); 01225 } else if (strcmp(fCodecName, "X-QT") == 0 01226 || strcmp(fCodecName, "X-QUICKTIME") == 0) { 01227 // Generic QuickTime streams, as defined in 01228 // <http://developer.apple.com/quicktime/icefloe/dispatch026.html> 01229 char* mimeType 01230 = new char[strlen(mediumName()) + strlen(codecName()) + 2] ; 01231 sprintf(mimeType, "%s/%s", mediumName(), codecName()); 01232 fReadSource = fRTPSource 01233 = QuickTimeGenericRTPSource::createNew(env(), fRTPSocket, 01234 fRTPPayloadFormat, 01235 fRTPTimestampFrequency, 01236 mimeType); 01237 delete[] mimeType; 01238 } else if ( strcmp(fCodecName, "PCMU") == 0 // PCM u-law audio 01239 || strcmp(fCodecName, "GSM") == 0 // GSM audio 01240 || strcmp(fCodecName, "DVI4") == 0 // DVI4 (IMA ADPCM) audio 01241 || strcmp(fCodecName, "PCMA") == 0 // PCM a-law audio 01242 || strcmp(fCodecName, "MP1S") == 0 // MPEG-1 System Stream 01243 || strcmp(fCodecName, "MP2P") == 0 // MPEG-2 Program Stream 01244 || strcmp(fCodecName, "L8") == 0 // 8-bit linear audio 01245 || strcmp(fCodecName, "L16") == 0 // 16-bit linear audio 01246 || strcmp(fCodecName, "L20") == 0 // 20-bit linear audio (RFC 3190) 01247 || strcmp(fCodecName, "L24") == 0 // 24-bit linear audio (RFC 3190) 01248 || strcmp(fCodecName, "G726-16") == 0 // G.726, 16 kbps 01249 || strcmp(fCodecName, "G726-24") == 0 // G.726, 24 kbps 01250 || strcmp(fCodecName, "G726-32") == 0 // G.726, 32 kbps 01251 || strcmp(fCodecName, "G726-40") == 0 // G.726, 40 kbps 01252 || strcmp(fCodecName, "SPEEX") == 0 // SPEEX audio 01253 || strcmp(fCodecName, "T140") == 0 // T.140 text (RFC 4103) 01254 || strcmp(fCodecName, "DAT12") == 0 // 12-bit nonlinear audio (RFC 3190) 01255 ) { 01256 createSimpleRTPSource = True; 01257 useSpecialRTPoffset = 0; 01258 } else if (useSpecialRTPoffset >= 0) { 01259 // We don't know this RTP payload format, but try to receive 01260 // it using a 'SimpleRTPSource' with the specified header offset: 01261 createSimpleRTPSource = True; 01262 } else { 01263 env().setResultMsg("RTP payload format unknown or not supported"); 01264 break; 01265 } 01266 01267 if (createSimpleRTPSource) { 01268 char* mimeType 01269 = new char[strlen(mediumName()) + strlen(codecName()) + 2] ; 01270 sprintf(mimeType, "%s/%s", mediumName(), codecName()); 01271 fReadSource = fRTPSource 01272 = SimpleRTPSource::createNew(env(), fRTPSocket, fRTPPayloadFormat, 01273 fRTPTimestampFrequency, mimeType, 01274 (unsigned)useSpecialRTPoffset, 01275 doNormalMBitRule); 01276 delete[] mimeType; 01277 } 01278 } 01279 01280 return True; 01281 } while (0); 01282 01283 return False; // an error occurred 01284 }
friend class MediaSession [friend] |
Definition at line 253 of file MediaSession.hh.
friend class MediaSubsessionIterator [friend] |
Definition at line 254 of file MediaSession.hh.
| unsigned short MediaSubsession::serverPortNum |
Definition at line 231 of file MediaSession.hh.
Referenced by RTSPClient::handleSETUPResponse(), MediaSession::initializeWithSDP(), and setDestinations().
| unsigned char MediaSubsession::rtpChannelId |
| unsigned char MediaSubsession::rtcpChannelId |
Definition at line 233 of file MediaSession.hh.
Referenced by closeMediaSinks(), setupStreams(), shutdownStream(), and subsessionAfterPlaying().
| void* MediaSubsession::miscPtr |
Definition at line 234 of file MediaSession.hh.
Referenced by AVIFileSink::AVIFileSink(), QuickTimeFileSink::completeOutputFile(), AVIFileSink::completeOutputFile(), QuickTimeFileSink::continuePlaying(), AVIFileSink::continuePlaying(), QuickTimeFileSink::onSourceClosure1(), AVIFileSink::onSourceClosure1(), QuickTimeFileSink::QuickTimeFileSink(), while(), AVIFileSink::~AVIFileSink(), and QuickTimeFileSink::~QuickTimeFileSink().
| u_int16_t MediaSubsession::seqNum |
| u_int32_t MediaSubsession::timestamp |
| struct { ... } MediaSubsession::rtpInfo |
Referenced by getNormalPlayTime(), RTSPClient::handlePLAYResponse(), and MediaSubsession().
MediaSession& MediaSubsession::fParent [protected] |
Definition at line 276 of file MediaSession.hh.
Referenced by env(), initiate(), parentSession(), parseSDPAttribute_range(), playEndTime(), and playStartTime().
MediaSubsession* MediaSubsession::fNext [protected] |
Definition at line 277 of file MediaSession.hh.
Referenced by ServerMediaSession::duration(), ServerMediaSession::generateSDPDescription(), MediaSubsessionIterator::next(), setNext(), ServerMediaSession::testScaleFactor(), and ~MediaSubsession().
char* MediaSubsession::fConnectionEndpointName [protected] |
Definition at line 280 of file MediaSession.hh.
Referenced by connectionEndpointName(), parseSDPLine_c(), and ~MediaSubsession().
unsigned short MediaSubsession::fClientPortNum [protected] |
Definition at line 281 of file MediaSession.hh.
Referenced by clientPortNum(), MediaSession::initializeWithSDP(), initiate(), and setClientPortNum().
unsigned char MediaSubsession::fRTPPayloadFormat [protected] |
Definition at line 283 of file MediaSession.hh.
Referenced by createSourceObjects(), MediaSession::initializeWithSDP(), parseSDPAttribute_rtpmap(), and rtpPayloadFormat().
char* MediaSubsession::fSavedSDPLines [protected] |
Definition at line 284 of file MediaSession.hh.
Referenced by MediaSession::initializeWithSDP(), savedSDPLines(), and ~MediaSubsession().
char* MediaSubsession::fMediumName [protected] |
Definition at line 285 of file MediaSession.hh.
Referenced by createSourceObjects(), MediaSession::initializeWithSDP(), mediumName(), and ~MediaSubsession().
char* MediaSubsession::fCodecName [protected] |
Definition at line 286 of file MediaSession.hh.
Referenced by codecName(), createSourceObjects(), MediaSession::initializeWithSDP(), initiate(), parseSDPAttribute_rtpmap(), and ~MediaSubsession().
char* MediaSubsession::fProtocolName [protected] |
Definition at line 287 of file MediaSession.hh.
Referenced by createSourceObjects(), MediaSession::initializeWithSDP(), protocolName(), and ~MediaSubsession().
unsigned MediaSubsession::fRTPTimestampFrequency [protected] |
Definition at line 288 of file MediaSession.hh.
Referenced by createSourceObjects(), MediaSession::initializeWithSDP(), parseSDPAttribute_rtpmap(), and rtpTimestampFrequency().
char* MediaSubsession::fControlPath [protected] |
Definition at line 289 of file MediaSession.hh.
Referenced by controlPath(), parseSDPAttribute_control(), and ~MediaSubsession().
struct in_addr MediaSubsession::fSourceFilterAddr [read, protected] |
Definition at line 290 of file MediaSession.hh.
Referenced by initiate(), isSSM(), and parseSDPAttribute_source_filter().
unsigned MediaSubsession::fBandwidth [protected] |
unsigned MediaSubsession::fAuxiliarydatasizelength [protected] |
Definition at line 294 of file MediaSession.hh.
Referenced by fmtp_auxiliarydatasizelength(), and parseSDPAttribute_fmtp().
unsigned MediaSubsession::fConstantduration [protected] |
Definition at line 294 of file MediaSession.hh.
Referenced by fmtp_constantduration(), and parseSDPAttribute_fmtp().
unsigned MediaSubsession::fConstantsize [protected] |
Definition at line 294 of file MediaSession.hh.
Referenced by fmtp_constantsize(), and parseSDPAttribute_fmtp().
unsigned MediaSubsession::fCRC [protected] |
Definition at line 295 of file MediaSession.hh.
Referenced by createSourceObjects(), fmtp_crc(), and parseSDPAttribute_fmtp().
unsigned MediaSubsession::fCtsdeltalength [protected] |
Definition at line 295 of file MediaSession.hh.
Referenced by fmtp_ctsdeltalength(), and parseSDPAttribute_fmtp().
unsigned MediaSubsession::fDe_interleavebuffersize [protected] |
Definition at line 295 of file MediaSession.hh.
Referenced by fmtp_de_interleavebuffersize(), and parseSDPAttribute_fmtp().
unsigned MediaSubsession::fDtsdeltalength [protected] |
Definition at line 295 of file MediaSession.hh.
Referenced by fmtp_dtsdeltalength(), and parseSDPAttribute_fmtp().
unsigned MediaSubsession::fIndexdeltalength [protected] |
Definition at line 296 of file MediaSession.hh.
Referenced by createSourceObjects(), fmtp_indexdeltalength(), and parseSDPAttribute_fmtp().
unsigned MediaSubsession::fIndexlength [protected] |
Definition at line 296 of file MediaSession.hh.
Referenced by createSourceObjects(), fmtp_indexlength(), and parseSDPAttribute_fmtp().
unsigned MediaSubsession::fInterleaving [protected] |
Definition at line 296 of file MediaSession.hh.
Referenced by createSourceObjects(), fmtp_interleaving(), and parseSDPAttribute_fmtp().
unsigned MediaSubsession::fMaxdisplacement [protected] |
Definition at line 297 of file MediaSession.hh.
Referenced by fmtp_maxdisplacement(), and parseSDPAttribute_fmtp().
unsigned MediaSubsession::fObjecttype [protected] |
Definition at line 297 of file MediaSession.hh.
Referenced by fmtp_objecttype(), and parseSDPAttribute_fmtp().
unsigned MediaSubsession::fOctetalign [protected] |
Definition at line 298 of file MediaSession.hh.
Referenced by createSourceObjects(), fmtp_octetalign(), and parseSDPAttribute_fmtp().
unsigned MediaSubsession::fProfile_level_id [protected] |
Definition at line 298 of file MediaSession.hh.
Referenced by fmtp_profile_level_id(), and parseSDPAttribute_fmtp().
unsigned MediaSubsession::fRobustsorting [protected] |
Definition at line 298 of file MediaSession.hh.
Referenced by createSourceObjects(), fmtp_robustsorting(), and parseSDPAttribute_fmtp().
unsigned MediaSubsession::fSizelength [protected] |
Definition at line 299 of file MediaSession.hh.
Referenced by createSourceObjects(), fmtp_sizelength(), and parseSDPAttribute_fmtp().
unsigned MediaSubsession::fStreamstateindication [protected] |
Definition at line 299 of file MediaSession.hh.
Referenced by fmtp_streamstateindication(), and parseSDPAttribute_fmtp().
unsigned MediaSubsession::fStreamtype [protected] |
Definition at line 299 of file MediaSession.hh.
Referenced by fmtp_streamtype(), and parseSDPAttribute_fmtp().
Boolean MediaSubsession::fCpresent [protected] |
Definition at line 300 of file MediaSession.hh.
Referenced by fmtp_cpresent(), and parseSDPAttribute_fmtp().
Boolean MediaSubsession::fRandomaccessindication [protected] |
Definition at line 300 of file MediaSession.hh.
Referenced by fmtp_randomaccessindication(), and parseSDPAttribute_fmtp().
char* MediaSubsession::fConfig [protected] |
Definition at line 301 of file MediaSession.hh.
Referenced by fmtp_config(), parseSDPAttribute_fmtp(), and ~MediaSubsession().
char * MediaSubsession::fMode [protected] |
Definition at line 301 of file MediaSession.hh.
Referenced by createSourceObjects(), fmtp_mode(), parseSDPAttribute_fmtp(), and ~MediaSubsession().
char * MediaSubsession::fSpropParameterSets [protected] |
Definition at line 301 of file MediaSession.hh.
Referenced by fmtp_spropparametersets(), parseSDPAttribute_fmtp(), and ~MediaSubsession().
char * MediaSubsession::fEmphasis [protected] |
Definition at line 301 of file MediaSession.hh.
Referenced by fmtp_emphasis(), parseSDPAttribute_fmtp(), and ~MediaSubsession().
char * MediaSubsession::fChannelOrder [protected] |
Definition at line 301 of file MediaSession.hh.
Referenced by fmtp_channelorder(), parseSDPAttribute_fmtp(), and ~MediaSubsession().
double MediaSubsession::fPlayStartTime [protected] |
Definition at line 303 of file MediaSession.hh.
Referenced by _playStartTime(), parseSDPAttribute_range(), and playStartTime().
double MediaSubsession::fPlayEndTime [protected] |
Definition at line 304 of file MediaSession.hh.
Referenced by _playEndTime(), parseSDPAttribute_range(), and playEndTime().
unsigned short MediaSubsession::fVideoWidth [protected] |
Definition at line 305 of file MediaSession.hh.
Referenced by parseSDPAttribute_x_dimensions(), and videoWidth().
unsigned short MediaSubsession::fVideoHeight [protected] |
Definition at line 305 of file MediaSession.hh.
Referenced by parseSDPAttribute_x_dimensions(), and videoHeight().
unsigned MediaSubsession::fVideoFPS [protected] |
Definition at line 307 of file MediaSession.hh.
Referenced by parseSDPAttribute_framerate(), and videoFPS().
unsigned MediaSubsession::fNumChannels [protected] |
Definition at line 309 of file MediaSession.hh.
Referenced by createSourceObjects(), MediaSession::initializeWithSDP(), numChannels(), and parseSDPAttribute_rtpmap().
float MediaSubsession::fScale [protected] |
double MediaSubsession::fNPT_PTS_Offset [protected] |
Groupsock* MediaSubsession::fRTPSocket [protected] |
Definition at line 315 of file MediaSession.hh.
Referenced by createSourceObjects(), deInitiate(), initiate(), and setDestinations().
Groupsock* MediaSubsession::fRTCPSocket [protected] |
Definition at line 315 of file MediaSession.hh.
Referenced by deInitiate(), initiate(), and setDestinations().
RTPSource* MediaSubsession::fRTPSource [protected] |
Definition at line 316 of file MediaSession.hh.
Referenced by createSourceObjects(), deInitiate(), initiate(), and rtpSource().
RTCPInstance* MediaSubsession::fRTCPInstance [protected] |
Definition at line 316 of file MediaSession.hh.
Referenced by deInitiate(), initiate(), and rtcpInstance().
FramedSource* MediaSubsession::fReadSource [protected] |
Definition at line 317 of file MediaSession.hh.
Referenced by createSourceObjects(), deInitiate(), initiate(), readSource(), and setClientPortNum().
char* MediaSubsession::fSessionId [protected] |
Definition at line 320 of file MediaSession.hh.
Referenced by sessionId(), setSessionId(), and ~MediaSubsession().
1.5.2