live
SimpleRTPSink.hh
Go to the documentation of this file.
1/**********
2This library is free software; you can redistribute it and/or modify it under
3the terms of the GNU Lesser General Public License as published by the
4Free Software Foundation; either version 3 of the License, or (at your
5option) any later version. (See <http://www.gnu.org/copyleft/lesser.html>.)
6
7This library is distributed in the hope that it will be useful, but WITHOUT
8ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
9FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
10more details.
11
12You should have received a copy of the GNU Lesser General Public License
13along with this library; if not, write to the Free Software Foundation, Inc.,
1451 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15**********/
16// "liveMedia"
17// Copyright (c) 1996-2024 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
21
22#ifndef _SIMPLE_RTP_SINK_HH
23#define _SIMPLE_RTP_SINK_HH
24
25#ifndef _MULTI_FRAMED_RTP_SINK_HH
26#include "MultiFramedRTPSink.hh"
27#endif
28
30public:
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.
43
44 void setMBitOnNextPacket() { fSetMBitOnNextPacket = True; } // hack for optionally setting the RTP 'M' bit from outside the class
45
46protected:
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()
56
57 virtual ~SimpleRTPSink();
58
59protected: // 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;
69
70private:
74};
75
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
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)
SimpleRTPSink(UsageEnvironment &env, Groupsock *RTPgs, unsigned char rtpPayloadFormat, unsigned rtpTimestampFrequency, char const *sdpMediaTypeString, char const *rtpPayloadFormatName, unsigned numChannels, Boolean allowMultipleFramesPerPacket, Boolean doNormalMBitRule)
virtual char const * sdpMediaType() const
Boolean fSetMBitOnNextPacket
char const * fSDPMediaTypeString
void setMBitOnNextPacket()
virtual Boolean frameCanAppearAfterPacketStart(unsigned char const *frameStart, unsigned numBytesInFrame) const
virtual ~SimpleRTPSink()
Boolean fAllowMultipleFramesPerPacket
virtual void doSpecialFrameHandling(unsigned fragmentationOffset, unsigned char *frameStart, unsigned numBytesInFrame, struct timeval framePresentationTime, unsigned numRemainingBytes)
Boolean fSetMBitOnLastFrames