liveMedia/SimpleRTPSource.cpp

Go to the documentation of this file.
00001 /**********
00002 This library is free software; you can redistribute it and/or modify it under
00003 the terms of the GNU Lesser General Public License as published by the
00004 Free Software Foundation; either version 2.1 of the License, or (at your
00005 option) any later version. (See <http://www.gnu.org/copyleft/lesser.html>.)
00006 
00007 This library is distributed in the hope that it will be useful, but WITHOUT
00008 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00009 FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for
00010 more details.
00011 
00012 You should have received a copy of the GNU Lesser General Public License
00013 along with this library; if not, write to the Free Software Foundation, Inc.,
00014 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
00015 **********/
00016 // "liveMedia"
00017 // Copyright (c) 1996-2014 Live Networks, Inc.  All rights reserved.
00018 // A RTP source for a simple RTP payload format that
00019 //     - doesn't have any special headers following the RTP header
00020 //     - doesn't have any special framing apart from the packet data itself
00021 // Implementation
00022 
00023 #include "SimpleRTPSource.hh"
00024 #include <string.h>
00025 
00026 SimpleRTPSource*
00027 SimpleRTPSource::createNew(UsageEnvironment& env,
00028                            Groupsock* RTPgs,
00029                            unsigned char rtpPayloadFormat,
00030                            unsigned rtpTimestampFrequency,
00031                            char const* mimeTypeString,
00032                            unsigned offset, Boolean doNormalMBitRule) {
00033   return new SimpleRTPSource(env, RTPgs, rtpPayloadFormat,
00034                              rtpTimestampFrequency,
00035                              mimeTypeString, offset, doNormalMBitRule);
00036 }
00037 
00038 SimpleRTPSource
00039 ::SimpleRTPSource(UsageEnvironment& env, Groupsock* RTPgs,
00040                   unsigned char rtpPayloadFormat,
00041                   unsigned rtpTimestampFrequency,
00042                   char const* mimeTypeString,
00043                   unsigned offset, Boolean doNormalMBitRule)
00044   : MultiFramedRTPSource(env, RTPgs,
00045                          rtpPayloadFormat, rtpTimestampFrequency),
00046     fMIMEtypeString(strDup(mimeTypeString)), fOffset(offset) {
00047   fUseMBitForFrameEnd = doNormalMBitRule && strncmp(mimeTypeString, "audio/", 6) != 0;
00048 }
00049 
00050 SimpleRTPSource::~SimpleRTPSource() {
00051   delete[] (char*)fMIMEtypeString;
00052 }
00053 
00054 Boolean SimpleRTPSource
00055 ::processSpecialHeader(BufferedPacket* packet,
00056                        unsigned& resultSpecialHeaderSize) {
00057   fCurrentPacketCompletesFrame
00058     = !fUseMBitForFrameEnd || packet->rtpMarkerBit();
00059 
00060   resultSpecialHeaderSize = fOffset;
00061   return True;
00062 }
00063 
00064 char const* SimpleRTPSource::MIMEtype() const {
00065   if (fMIMEtypeString == NULL) return MultiFramedRTPSource::MIMEtype();
00066 
00067   return fMIMEtypeString;
00068 }

Generated on Tue Mar 25 14:35:36 2014 for live by  doxygen 1.5.2