/usr/include/liveMedia/T140TextRTPSink.hh is in liblivemedia-dev 2018.02.18-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | /**********
This library is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version. (See <http://www.gnu.org/copyleft/lesser.html>.)
This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
more details.
You should have received a copy of the GNU Lesser General Public License
along with this library; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
**********/
// "liveMedia"
// Copyright (c) 1996-2018 Live Networks, Inc. All rights reserved.
// RTP sink for T.140 text (RFC 2793)
// C++ header
#ifndef _T140_TEXT_RTP_SINK_HH
#define _T140_TEXT_RTP_SINK_HH
#ifndef _TEXT_RTP_SINK_HH
#include "TextRTPSink.hh"
#endif
#ifndef _FRAMED_FILTER_HH
#include "FramedFilter.hh"
#endif
class T140IdleFilter;
class T140TextRTPSink: public TextRTPSink {
public:
static T140TextRTPSink* createNew(UsageEnvironment& env, Groupsock* RTPgs, unsigned char rtpPayloadFormat);
protected:
T140TextRTPSink(UsageEnvironment& env, Groupsock* RTPgs, unsigned char rtpPayloadFormat);
// called only by createNew()
virtual ~T140TextRTPSink();
protected: // redefined virtual functions:
virtual Boolean continuePlaying();
virtual void doSpecialFrameHandling(unsigned fragmentationOffset,
unsigned char* frameStart,
unsigned numBytesInFrame,
struct timeval framePresentationTime,
unsigned numRemainingBytes);
virtual Boolean frameCanAppearAfterPacketStart(unsigned char const* frameStart,
unsigned numBytesInFrame) const;
protected:
T140IdleFilter* fOurIdleFilter;
Boolean fAreInIdlePeriod;
};
////////// T140IdleFilter definition //////////
// Because the T.140 text RTP payload format specification recommends that (empty) RTP packets be sent during 'idle periods'
// when no new text is available, we implement "T140TextRTPSink" using a separate "T140IdleFilter" class - sitting in front
// - that delivers, to the "T140TextRTPSink", a continuous sequence of (possibly) empty frames.
// (Note: This class should be used only by "T140TextRTPSink", or a subclass.)
class T140IdleFilter: public FramedFilter {
public:
T140IdleFilter(UsageEnvironment& env, FramedSource* inputSource);
virtual ~T140IdleFilter();
private: // redefined virtual functions:
virtual void doGetNextFrame();
virtual void doStopGettingFrames();
private:
static void afterGettingFrame(void* clientData, unsigned frameSize,
unsigned numTruncatedBytes,
struct timeval presentationTime,
unsigned durationInMicroseconds);
void afterGettingFrame(unsigned frameSize,
unsigned numTruncatedBytes,
struct timeval presentationTime,
unsigned durationInMicroseconds);
static void handleIdleTimeout(void* clientData);
void handleIdleTimeout();
void deliverFromBuffer();
void deliverEmptyFrame();
static void onSourceClosure(void* clientData);
void onSourceClosure();
private:
TaskToken fIdleTimerTask;
unsigned fBufferSize, fNumBufferedBytes;
char* fBuffer;
unsigned fBufferedNumTruncatedBytes; // a count of truncated bytes from the upstream
struct timeval fBufferedDataPresentationTime;
unsigned fBufferedDataDurationInMicroseconds;
};
#endif
|