live
T140TextRTPSink.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// RTP sink for T.140 text (RFC 2793)
19// C++ header
20
21#ifndef _T140_TEXT_RTP_SINK_HH
22#define _T140_TEXT_RTP_SINK_HH
23
24#ifndef _TEXT_RTP_SINK_HH
25#include "TextRTPSink.hh"
26#endif
27#ifndef _FRAMED_FILTER_HH
28#include "FramedFilter.hh"
29#endif
30
31class T140IdleFilter;
32
34public:
35 static T140TextRTPSink* createNew(UsageEnvironment& env, Groupsock* RTPgs, unsigned char rtpPayloadFormat);
36
37protected:
38 T140TextRTPSink(UsageEnvironment& env, Groupsock* RTPgs, unsigned char rtpPayloadFormat);
39 // called only by createNew()
40
42
43protected: // redefined virtual functions:
45 virtual void doSpecialFrameHandling(unsigned fragmentationOffset,
46 unsigned char* frameStart,
47 unsigned numBytesInFrame,
48 struct timeval framePresentationTime,
49 unsigned numRemainingBytes);
50 virtual Boolean frameCanAppearAfterPacketStart(unsigned char const* frameStart,
51 unsigned numBytesInFrame) const;
52
53protected:
56};
57
58
60
61// Because the T.140 text RTP payload format specification recommends that (empty) RTP packets be sent during 'idle periods'
62// when no new text is available, we implement "T140TextRTPSink" using a separate "T140IdleFilter" class - sitting in front
63// - that delivers, to the "T140TextRTPSink", a continuous sequence of (possibly) empty frames.
64// (Note: This class should be used only by "T140TextRTPSink", or a subclass.)
65
67public:
69 virtual ~T140IdleFilter();
70
71private: // redefined virtual functions:
72 virtual void doGetNextFrame();
73 virtual void doStopGettingFrames();
74
75private:
76 static void afterGettingFrame(void* clientData, unsigned frameSize,
77 unsigned numTruncatedBytes,
78 struct timeval presentationTime,
79 unsigned durationInMicroseconds);
80 void afterGettingFrame(unsigned frameSize,
81 unsigned numTruncatedBytes,
82 struct timeval presentationTime,
83 unsigned durationInMicroseconds);
84
85 static void handleIdleTimeout(void* clientData);
87
90
91 static void onSourceClosure(void* clientData);
93
94private:
97 char* fBuffer;
98 unsigned fBufferedNumTruncatedBytes; // a count of truncated bytes from the upstream
101};
102
103#endif
unsigned char Boolean
Definition: Boolean.hh:25
void * TaskToken
FramedSource * inputSource() const
Definition: FramedFilter.hh:30
void afterGettingFrame(unsigned frameSize, unsigned numTruncatedBytes, struct timeval presentationTime, unsigned durationInMicroseconds)
void deliverEmptyFrame()
static void onSourceClosure(void *clientData)
virtual ~T140IdleFilter()
TaskToken fIdleTimerTask
static void handleIdleTimeout(void *clientData)
unsigned fBufferedDataDurationInMicroseconds
static void afterGettingFrame(void *clientData, unsigned frameSize, unsigned numTruncatedBytes, struct timeval presentationTime, unsigned durationInMicroseconds)
void handleIdleTimeout()
T140IdleFilter(UsageEnvironment &env, FramedSource *inputSource)
struct timeval fBufferedDataPresentationTime
void onSourceClosure()
unsigned fBufferedNumTruncatedBytes
void deliverFromBuffer()
unsigned fBufferSize
virtual void doStopGettingFrames()
virtual void doGetNextFrame()
unsigned fNumBufferedBytes
virtual Boolean continuePlaying()
virtual Boolean frameCanAppearAfterPacketStart(unsigned char const *frameStart, unsigned numBytesInFrame) const
virtual void doSpecialFrameHandling(unsigned fragmentationOffset, unsigned char *frameStart, unsigned numBytesInFrame, struct timeval framePresentationTime, unsigned numRemainingBytes)
virtual ~T140TextRTPSink()
T140TextRTPSink(UsageEnvironment &env, Groupsock *RTPgs, unsigned char rtpPayloadFormat)
static T140TextRTPSink * createNew(UsageEnvironment &env, Groupsock *RTPgs, unsigned char rtpPayloadFormat)
Boolean fAreInIdlePeriod
T140IdleFilter * fOurIdleFilter