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

Definition at line 128 of file MediaSession.hh.
| MediaSubsession::MediaSubsession | ( | MediaSession & | parent | ) | [protected] |
Definition at line 536 of file MediaSession.cpp.
References False, and rtpInfo.
00537 : sessionId(NULL), serverPortNum(0), sink(NULL), miscPtr(NULL), 00538 fParent(parent), fNext(NULL), 00539 fConnectionEndpointName(NULL), 00540 fClientPortNum(0), fRTPPayloadFormat(0xFF), 00541 fSavedSDPLines(NULL), fMediumName(NULL), fCodecName(NULL), fProtocolName(NULL), 00542 fRTPTimestampFrequency(0), fControlPath(NULL), 00543 fSourceFilterAddr(parent.sourceFilterAddr()), 00544 fAuxiliarydatasizelength(0), fConstantduration(0), fConstantsize(0), 00545 fCRC(0), fCtsdeltalength(0), fDe_interleavebuffersize(0), fDtsdeltalength(0), 00546 fIndexdeltalength(0), fIndexlength(0), fInterleaving(0), fMaxdisplacement(0), 00547 fObjecttype(0), fOctetalign(0), fProfile_level_id(0), fRobustsorting(0), 00548 fSizelength(0), fStreamstateindication(0), fStreamtype(0), 00549 fCpresent(False), fRandomaccessindication(False), 00550 fConfig(NULL), fMode(NULL), fSpropParameterSets(NULL), 00551 fPlayStartTime(0.0), fPlayEndTime(0.0), 00552 fVideoWidth(0), fVideoHeight(0), fVideoFPS(0), fNumChannels(1), fScale(1.0f), fNPT_PTS_Offset(0.0f), 00553 fRTPSocket(NULL), fRTCPSocket(NULL), 00554 fRTPSource(NULL), fRTCPInstance(NULL), fReadSource(NULL) { 00555 rtpInfo.seqNum = 0; rtpInfo.timestamp = 0; rtpInfo.infoIsNew = False; 00556 #ifdef SUPPORT_REAL_RTSP 00557 RealInitSDPAttributes(this); 00558 #endif 00559 }
| MediaSubsession::~MediaSubsession | ( | ) | [protected, virtual] |
Definition at line 561 of file MediaSession.cpp.
References deInitiate(), fCodecName, fConfig, fConnectionEndpointName, fControlPath, fMediumName, fMode, fNext, fProtocolName, fSavedSDPLines, and fSpropParameterSets.
00561 { 00562 deInitiate(); 00563 00564 delete[] fConnectionEndpointName; delete[] fSavedSDPLines; 00565 delete[] fMediumName; delete[] fCodecName; delete[] fProtocolName; 00566 delete[] fControlPath; delete[] fConfig; delete[] fMode; delete[] fSpropParameterSets; 00567 00568 delete fNext; 00569 #ifdef SUPPORT_REAL_RTSP 00570 RealReclaimSDPAttributes(this); 00571 #endif 00572 }
| MediaSession& MediaSubsession::parentSession | ( | ) | [inline] |
Definition at line 130 of file MediaSession.hh.
References fParent.
Referenced by connectionEndpointAddress(), RTSPClient::constructSubsessionURL(), initiate(), RTSPClient::setupMediaSubsession(), and subsessionAfterPlaying().
00130 { return fParent; }
| MediaSession const& MediaSubsession::parentSession | ( | ) | const [inline] |
| unsigned short MediaSubsession::clientPortNum | ( | ) | const [inline] |
Definition at line 133 of file MediaSession.hh.
References fClientPortNum.
Referenced by main(), RTSPClient::setupMediaSubsession(), and setupStreams().
00133 { return fClientPortNum; }
| unsigned char MediaSubsession::rtpPayloadFormat | ( | ) | const [inline] |
Definition at line 134 of file MediaSession.hh.
References fRTPPayloadFormat.
00134 { return fRTPPayloadFormat; }
| char const* MediaSubsession::savedSDPLines | ( | ) | const [inline] |
Definition at line 135 of file MediaSession.hh.
References fSavedSDPLines.
Referenced by QuickTimeFileSink::addAtom_hdlr2().
00135 { return fSavedSDPLines; }
| char const* MediaSubsession::mediumName | ( | ) | const [inline] |
Definition at line 136 of file MediaSession.hh.
References fMediumName.
Referenced by QuickTimeFileSink::addAtom_hdlr2(), initiate(), main(), QuickTimeFileSink::onRTCPBye(), AVIFileSink::onRTCPBye(), printQOSData(), AVISubsessionIOState::setAVIstate(), SubsessionIOState::setQTstate(), setupStreams(), subsessionByeHandler(), SubsessionIOState::useFrameForHinting(), and while().
00136 { return fMediumName; }
| char const* MediaSubsession::codecName | ( | ) | const [inline] |
Definition at line 137 of file MediaSession.hh.
References fCodecName.
Referenced by QuickTimeFileSink::addAtom_hdlr2(), initiate(), main(), QuickTimeFileSink::onRTCPBye(), AVIFileSink::onRTCPBye(), parseSDPAttribute_rtpmap(), printQOSData(), AVISubsessionIOState::setAVIstate(), SubsessionIOState::setQTstate(), setupStreams(), subsessionByeHandler(), and SubsessionIOState::useFrameForHinting().
00137 { return fCodecName; }
| char const* MediaSubsession::protocolName | ( | ) | const [inline] |
Definition at line 138 of file MediaSession.hh.
References fProtocolName.
Referenced by RTSPClient::setupMediaSubsession().
00138 { return fProtocolName; }
| char const* MediaSubsession::controlPath | ( | ) | const [inline] |
Definition at line 139 of file MediaSession.hh.
References fControlPath.
Referenced by RTSPClient::constructSubsessionURL(), and parseSDPAttribute_control().
00139 { return fControlPath; }
| Boolean MediaSubsession::isSSM | ( | ) | const [inline] |
Definition at line 140 of file MediaSession.hh.
References fSourceFilterAddr.
Referenced by initiate(), and setDestinations().
00140 { return fSourceFilterAddr.s_addr != 0; }
| unsigned short MediaSubsession::videoWidth | ( | ) | const [inline] |
Definition at line 142 of file MediaSession.hh.
References fVideoWidth.
Referenced by AVIFileSink::AVIFileSink(), initiate(), and QuickTimeFileSink::QuickTimeFileSink().
00142 { return fVideoWidth; }
| unsigned short MediaSubsession::videoHeight | ( | ) | const [inline] |
Definition at line 143 of file MediaSession.hh.
References fVideoHeight.
Referenced by AVIFileSink::AVIFileSink(), initiate(), and QuickTimeFileSink::QuickTimeFileSink().
00143 { return fVideoHeight; }
| unsigned MediaSubsession::videoFPS | ( | ) | const [inline] |
Definition at line 144 of file MediaSession.hh.
References fVideoFPS.
Referenced by AVIFileSink::AVIFileSink(), and QuickTimeFileSink::QuickTimeFileSink().
00144 { return fVideoFPS; }
| unsigned MediaSubsession::numChannels | ( | ) | const [inline] |
Definition at line 145 of file MediaSession.hh.
References fNumChannels.
Referenced by QuickTimeFileSink::addAtom_hdlr2(), parseSDPAttribute_rtpmap(), AVISubsessionIOState::setAVIstate(), and while().
00145 { return fNumChannels; }
| float& MediaSubsession::scale | ( | ) | [inline] |
Definition at line 146 of file MediaSession.hh.
References fScale.
Referenced by getNormalPlayTime(), and RTSPClient::playMediaSubsession().
00146 { return fScale; }
| RTPSource* MediaSubsession::rtpSource | ( | ) | [inline] |
Definition at line 148 of file MediaSession.hh.
References fRTPSource.
Referenced by QuickTimeFileSink::addAtom_hdlr2(), SubsessionIOState::afterGettingFrame(), AVISubsessionIOState::afterGettingFrame(), beginQOSMeasurement(), checkForPacketArrival(), checkInterPacketGaps(), getNormalPlayTime(), main(), printQOSData(), RTSPClient::setupMediaSubsession(), SubsessionIOState::syncOK(), SubsessionIOState::useFrame(), and SubsessionIOState::useFrameForHinting().
00148 { return fRTPSource; }
| RTCPInstance* MediaSubsession::rtcpInstance | ( | ) | [inline] |
Definition at line 149 of file MediaSession.hh.
References fRTCPInstance.
Referenced by AVIFileSink::AVIFileSink(), main(), QuickTimeFileSink::QuickTimeFileSink(), and RTSPClient::setupMediaSubsession().
00149 { return fRTCPInstance; }
| unsigned MediaSubsession::rtpTimestampFrequency | ( | ) | const [inline] |
Definition at line 150 of file MediaSession.hh.
References fRTPTimestampFrequency.
Referenced by QuickTimeFileSink::addAtom_hdlr2(), parseSDPAttribute_rtpmap(), QuickTimeFileSink::QuickTimeFileSink(), AVISubsessionIOState::setAVIstate(), SubsessionIOState::setQTstate(), and SubsessionIOState::useFrameForHinting().
00150 { return fRTPTimestampFrequency; }
| FramedSource* MediaSubsession::readSource | ( | ) | [inline] |
Definition at line 151 of file MediaSession.hh.
References fReadSource.
Referenced by AVIFileSink::AVIFileSink(), AVISubsessionIOState::AVISubsessionIOState(), beginQOSMeasurement(), QuickTimeFileSink::continuePlaying(), AVIFileSink::continuePlaying(), MediaSession::initiateByMediaType(), main(), printQOSData(), QuickTimeFileSink::QuickTimeFileSink(), RTSPClient::setupMediaSubsession(), and SubsessionIOState::SubsessionIOState().
00151 { return fReadSource; }
| float MediaSubsession::playStartTime | ( | ) | const |
Definition at line 574 of file MediaSession.cpp.
References fParent, fPlayStartTime, and MediaSession::playStartTime().
Referenced by getNormalPlayTime(), and parseSDPAttribute_range().
00574 { 00575 if (fPlayStartTime > 0) return fPlayStartTime; 00576 00577 return fParent.playStartTime(); 00578 }
| float MediaSubsession::playEndTime | ( | ) | const |
Definition at line 580 of file MediaSession.cpp.
References fParent, fPlayEndTime, and MediaSession::playEndTime().
Referenced by parseSDPAttribute_range().
00580 { 00581 if (fPlayEndTime > 0) return fPlayEndTime; 00582 00583 return fParent.playEndTime(); 00584 }
| float& MediaSubsession::_playStartTime | ( | ) | [inline] |
Definition at line 158 of file MediaSession.hh.
References fPlayStartTime.
Referenced by RTSPClient::playMediaSubsession().
00158 { return fPlayStartTime; }
| float& MediaSubsession::_playEndTime | ( | ) | [inline] |
Definition at line 159 of file MediaSession.hh.
References fPlayEndTime.
Referenced by RTSPClient::playMediaSubsession().
00159 { return fPlayEndTime; }
| Boolean MediaSubsession::initiate | ( | int | useSpecialRTPoffset = -1 |
) |
Definition at line 586 of file MediaSession.cpp.
References Groupsock::changeDestinationParameters(), Medium::close(), MediaSession::CNAME(), codecName(), connectionEndpointAddress(), RTCPInstance::createNew(), QuickTimeGenericRTPSource::createNew(), JPEGVideoRTPSource::createNew(), H264VideoRTPSource::createNew(), H263plusVideoRTPSource::createNew(), H261VideoRTPSource::createNew(), MPEG1or2VideoRTPSource::createNew(), MPEG4GenericRTPSource::createNew(), MPEG4ESVideoRTPSource::createNew(), AC3AudioRTPSource::createNew(), MPEG4LATMAudioRTPSource::createNew(), SimpleRTPSource::createNew(), MP3FromADUSource::createNew(), MP3ADUdeinterleaver::createNew(), MP3ADURTPSource::createNew(), MPEG1or2AudioRTPSource::createNew(), AMRAudioRTPSource::createNew(), QCELPAudioRTPSource::createNew(), MPEG2TransportStreamFramer::createNew(), BasicUDPSource::createNew(), env(), False, fClientPortNum, fCodecName, fCRC, fIndexdeltalength, fIndexlength, fInterleaving, fMediumName, fMode, fNumChannels, fOctetalign, fParent, fProtocolName, fReadSource, fRobustsorting, fRTCPInstance, fRTCPSocket, fRTPPayloadFormat, fRTPSocket, fRTPSource, fRTPTimestampFrequency, fSizelength, fSourceFilterAddr, getSourcePort(), isSSM(), mediumName(), NULL, Port::num(), parentSession(), UsageEnvironment::setResultMsg(), Socket::socketNum(), True, videoHeight(), and videoWidth().
Referenced by MediaSession::initiateByMediaType(), main(), and DarwinInjector::setDestination().
00586 { 00587 if (fReadSource != NULL) return True; // has already been initiated 00588 00589 do { 00590 if (fCodecName == NULL) { 00591 env().setResultMsg("Codec is unspecified"); 00592 break; 00593 } 00594 00595 // Create RTP and RTCP 'Groupsocks' on which to receive incoming data. 00596 // (Groupsocks will work even for unicast addresses) 00597 Groupsock* oldGroupsock = NULL; 00598 Boolean success = False; 00599 struct in_addr tempAddr; 00600 tempAddr.s_addr = connectionEndpointAddress(); 00601 // This could get changed later, as a result of a RTSP "SETUP" 00602 while (1) { 00603 unsigned short rtpPortNum = fClientPortNum&~1; 00604 if (isSSM()) { 00605 fRTPSocket = new Groupsock(env(), tempAddr, fSourceFilterAddr, 00606 rtpPortNum); 00607 } else { 00608 fRTPSocket = new Groupsock(env(), tempAddr, rtpPortNum, 255); 00609 } 00610 if (fRTPSocket == NULL) { 00611 env().setResultMsg("Failed to create RTP socket"); 00612 break; 00613 } 00614 00615 // Get the client port number, to make sure that it's even (for RTP): 00616 Port clientPort(0); 00617 if (!getSourcePort(env(), fRTPSocket->socketNum(), clientPort)) { 00618 break; 00619 } 00620 fClientPortNum = ntohs(clientPort.num()); 00621 00622 // If the port number's not even, try again: 00623 if ((fClientPortNum&1) == 0) { 00624 success = True; 00625 break; 00626 } 00627 // Try again: 00628 delete oldGroupsock; 00629 oldGroupsock = fRTPSocket; 00630 fClientPortNum = 0; 00631 } 00632 delete oldGroupsock; 00633 if (!success) break; 00634 00635 // Set our RTCP port to be the RTP port +1 00636 unsigned short const rtcpPortNum = fClientPortNum|1; 00637 if (isSSM()) { 00638 fRTCPSocket = new Groupsock(env(), tempAddr, fSourceFilterAddr, 00639 rtcpPortNum); 00640 // Also, send RTCP packets back to the source via unicast: 00641 if (fRTCPSocket != NULL) { 00642 fRTCPSocket->changeDestinationParameters(fSourceFilterAddr,0,~0); 00643 } 00644 } else { 00645 fRTCPSocket = new Groupsock(env(), tempAddr, rtcpPortNum, 255); 00646 } 00647 if (fRTCPSocket == NULL) { 00648 char tmpBuf[100]; 00649 sprintf(tmpBuf, "Failed to create RTCP socket (port %d)", 00650 rtcpPortNum); 00651 env().setResultMsg(tmpBuf); 00652 break; 00653 } 00654 00655 // Check "fProtocolName" 00656 if (strcmp(fProtocolName, "UDP") == 0) { 00657 // A UDP-packetized stream (*not* a RTP stream) 00658 fReadSource = BasicUDPSource::createNew(env(), fRTPSocket); 00659 fRTPSource = NULL; // Note! 00660 00661 if (strcmp(fCodecName, "MP2T") == 0) { // MPEG-2 Transport Stream 00662 fReadSource = MPEG2TransportStreamFramer::createNew(env(), fReadSource); 00663 // this sets "durationInMicroseconds" correctly, based on the PCR values 00664 } 00665 } else { 00666 // Check "fCodecName" against the set of codecs that we support, 00667 // and create our RTP source accordingly 00668 // (Later make this code more efficient, as this set grows #####) 00669 // (Also, add more fmts that can be implemented by SimpleRTPSource#####) 00670 Boolean createSimpleRTPSource = False; 00671 Boolean doNormalMBitRule = False; // used if "createSimpleRTPSource" 00672 if (strcmp(fCodecName, "QCELP") == 0) { // QCELP audio 00673 fReadSource = 00674 QCELPAudioRTPSource::createNew(env(), fRTPSocket, fRTPSource, 00675 fRTPPayloadFormat, 00676 fRTPTimestampFrequency); 00677 // Note that fReadSource will differ from fRTPSource in this case 00678 } else if (strcmp(fCodecName, "AMR") == 0) { // AMR audio (narrowband) 00679 fReadSource = 00680 AMRAudioRTPSource::createNew(env(), fRTPSocket, fRTPSource, 00681 fRTPPayloadFormat, 0 /*isWideband*/, 00682 fNumChannels, fOctetalign, fInterleaving, 00683 fRobustsorting, fCRC); 00684 // Note that fReadSource will differ from fRTPSource in this case 00685 } else if (strcmp(fCodecName, "AMR-WB") == 0) { // AMR audio (wideband) 00686 fReadSource = 00687 AMRAudioRTPSource::createNew(env(), fRTPSocket, fRTPSource, 00688 fRTPPayloadFormat, 1 /*isWideband*/, 00689 fNumChannels, fOctetalign, fInterleaving, 00690 fRobustsorting, fCRC); 00691 // Note that fReadSource will differ from fRTPSource in this case 00692 } else if (strcmp(fCodecName, "MPA") == 0) { // MPEG-1 or 2 audio 00693 fReadSource = fRTPSource 00694 = MPEG1or2AudioRTPSource::createNew(env(), fRTPSocket, 00695 fRTPPayloadFormat, 00696 fRTPTimestampFrequency); 00697 } else if (strcmp(fCodecName, "MPA-ROBUST") == 0) { // robust MP3 audio 00698 fRTPSource 00699 = MP3ADURTPSource::createNew(env(), fRTPSocket, fRTPPayloadFormat, 00700 fRTPTimestampFrequency); 00701 if (fRTPSource == NULL) break; 00702 00703 // Add a filter that deinterleaves the ADUs after depacketizing them: 00704 MP3ADUdeinterleaver* deinterleaver 00705 = MP3ADUdeinterleaver::createNew(env(), fRTPSource); 00706 if (deinterleaver == NULL) break; 00707 00708 // Add another filter that converts these ADUs to MP3 frames: 00709 fReadSource = MP3FromADUSource::createNew(env(), deinterleaver); 00710 } else if (strcmp(fCodecName, "X-MP3-DRAFT-00") == 0) { 00711 // a non-standard variant of "MPA-ROBUST" used by RealNetworks 00712 // (one 'ADU'ized MP3 frame per packet; no headers) 00713 fRTPSource 00714 = SimpleRTPSource::createNew(env(), fRTPSocket, fRTPPayloadFormat, 00715 fRTPTimestampFrequency, 00716 "audio/MPA-ROBUST" /*hack*/); 00717 if (fRTPSource == NULL) break; 00718 00719 // Add a filter that converts these ADUs to MP3 frames: 00720 fReadSource = MP3FromADUSource::createNew(env(), fRTPSource, 00721 False /*no ADU header*/); 00722 } else if (strcmp(fCodecName, "MP4A-LATM") == 0) { // MPEG-4 LATM audio 00723 fReadSource = fRTPSource 00724 = MPEG4LATMAudioRTPSource::createNew(env(), fRTPSocket, 00725 fRTPPayloadFormat, 00726 fRTPTimestampFrequency); 00727 } else if (strcmp(fCodecName, "AC3") == 0) { // AC3 audio 00728 fReadSource = fRTPSource 00729 = AC3AudioRTPSource::createNew(env(), fRTPSocket, 00730 fRTPPayloadFormat, 00731 fRTPTimestampFrequency); 00732 } else if (strcmp(fCodecName, "MP4V-ES") == 0) { // MPEG-4 Elem Str vid 00733 fReadSource = fRTPSource 00734 = MPEG4ESVideoRTPSource::createNew(env(), fRTPSocket, 00735 fRTPPayloadFormat, 00736 fRTPTimestampFrequency); 00737 } else if (strcmp(fCodecName, "MPEG4-GENERIC") == 0) { 00738 fReadSource = fRTPSource 00739 = MPEG4GenericRTPSource::createNew(env(), fRTPSocket, 00740 fRTPPayloadFormat, 00741 fRTPTimestampFrequency, 00742 fMediumName, fMode, 00743 fSizelength, fIndexlength, 00744 fIndexdeltalength); 00745 } else if (strcmp(fCodecName, "MPV") == 0) { // MPEG-1 or 2 video 00746 fReadSource = fRTPSource 00747 = MPEG1or2VideoRTPSource::createNew(env(), fRTPSocket, 00748 fRTPPayloadFormat, 00749