Go to the documentation of this file.
1 /**********
2 This library is free software; you can redistribute it and/or modify it under
3 the terms of the GNU Lesser General Public License as published by the
4 Free Software Foundation; either version 3 of the License, or (at your
5 option) any later version. (See <>.)
7 This library is distributed in the hope that it will be useful, but WITHOUT
8 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
9 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
10 more details.
12 You should have received a copy of the GNU Lesser General Public License
13 along with this library; if not, write to the Free Software Foundation, Inc.,
14 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15 **********/
16 // "liveMedia"
17 // Copyright (c) 1996-2022 Live Networks, Inc. All rights reserved.
18 // A simple RTP sink that packs frames into each outgoing
19 // packet, without any fragmentation or special headers.
20 // C++ header
22 #ifndef _SIMPLE_RTP_SINK_HH
23 #define _SIMPLE_RTP_SINK_HH
26 #include "MultiFramedRTPSink.hh"
27 #endif
30 public:
31  static SimpleRTPSink*
33  unsigned char rtpPayloadFormat,
34  unsigned rtpTimestampFrequency,
35  char const* sdpMediaTypeString,
36  char const* rtpPayloadFormatName,
37  unsigned numChannels = 1,
38  Boolean allowMultipleFramesPerPacket = True,
39  Boolean doNormalMBitRule = True);
40  // "doNormalMBitRule" means: If the medium (i.e., "sdpMediaTypeString") is other than "audio", set the RTP "M" bit
41  // on each outgoing packet iff it contains the last (or only) fragment of a frame.
42  // Otherwise (i.e., if "doNormalMBitRule" is False, or the medium is "audio"), leave the "M" bit unset.
44  void setMBitOnNextPacket() { fSetMBitOnNextPacket = True; } // hack for optionally setting the RTP 'M' bit from outside the class
46 protected:
48  unsigned char rtpPayloadFormat,
49  unsigned rtpTimestampFrequency,
50  char const* sdpMediaTypeString,
51  char const* rtpPayloadFormatName,
52  unsigned numChannels,
53  Boolean allowMultipleFramesPerPacket,
54  Boolean doNormalMBitRule);
55  // called only by createNew()
57  virtual ~SimpleRTPSink();
59 protected: // redefined virtual functions
60  virtual void doSpecialFrameHandling(unsigned fragmentationOffset,
61  unsigned char* frameStart,
62  unsigned numBytesInFrame,
63  struct timeval framePresentationTime,
64  unsigned numRemainingBytes);
65  virtual
66  Boolean frameCanAppearAfterPacketStart(unsigned char const* frameStart,
67  unsigned numBytesInFrame) const;
68  virtual char const* sdpMediaType() const;
70 private:
71  char const* fSDPMediaTypeString;
74 };
76 #endif
const Boolean True
Definition: Boolean.hh:31
unsigned char Boolean
Definition: Boolean.hh:25
unsigned rtpTimestampFrequency() const
Definition: RTPSink.hh:46
unsigned numChannels() const
Definition: RTPSink.hh:52
char const * rtpPayloadFormatName() const
Definition: RTPSink.hh:50
SimpleRTPSink(UsageEnvironment &env, Groupsock *RTPgs, unsigned char rtpPayloadFormat, unsigned rtpTimestampFrequency, char const *sdpMediaTypeString, char const *rtpPayloadFormatName, unsigned numChannels, Boolean allowMultipleFramesPerPacket, Boolean doNormalMBitRule)
Boolean fSetMBitOnNextPacket
static SimpleRTPSink * createNew(UsageEnvironment &env, Groupsock *RTPgs, unsigned char rtpPayloadFormat, unsigned rtpTimestampFrequency, char const *sdpMediaTypeString, char const *rtpPayloadFormatName, unsigned numChannels=1, Boolean allowMultipleFramesPerPacket=True, Boolean doNormalMBitRule=True)
char const * fSDPMediaTypeString
void setMBitOnNextPacket()
virtual Boolean frameCanAppearAfterPacketStart(unsigned char const *frameStart, unsigned numBytesInFrame) const
virtual char const * sdpMediaType() const
virtual ~SimpleRTPSink()
Boolean fAllowMultipleFramesPerPacket
virtual void doSpecialFrameHandling(unsigned fragmentationOffset, unsigned char *frameStart, unsigned numBytesInFrame, struct timeval framePresentationTime, unsigned numRemainingBytes)
Boolean fSetMBitOnLastFrames