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-2020 Live Networks, Inc. All rights reserved.
18// RTP sink for Raw video
19// C++ header
20
21#ifndef _RAW_VIDEO_RTP_SINK_HH
22#define _RAW_VIDEO_RTP_SINK_HH
23
24#ifndef _VIDEO_RTP_SINK_HH
25#include "VideoRTPSink.hh"
26#endif
27
28////////// FrameParameters //////////
29
30struct FrameParameters {
31 u_int16_t pGroupSize;
32 u_int16_t nbOfPixelInPGroup;
33 u_int32_t scanLineSize ;
34 u_int32_t frameSize;
35 u_int16_t scanLineIterationStep;
36};
37
38
39class RawVideoRTPSink: public VideoRTPSink {
40public:
41 static RawVideoRTPSink*
42 createNew(UsageEnvironment& env, Groupsock* RTPgs, u_int8_t rtpPayloadFormat,
43 // The following headers provide the 'configuration' information, for the SDP description:
44 unsigned height, unsigned width, unsigned depth,
45 char const* sampling, char const* colorimetry = "BT709-2");
46
47protected:
48 RawVideoRTPSink(UsageEnvironment& env, Groupsock* RTPgs,
49 u_int8_t rtpPayloadFormat,
50 unsigned height, unsigned width, unsigned depth,
51 char const* sampling, char const* colorimetry = "BT709-2");
52 // called only by createNew()
53
54 virtual ~RawVideoRTPSink();
55
56private: // redefined virtual functions:
57 virtual char const* auxSDPLine(); // for the "a=fmtp:" SDP line
58
59 virtual void doSpecialFrameHandling(unsigned fragmentationOffset,
60 unsigned char* frameStart,
61 unsigned numBytesInFrame,
62 struct timeval framePresentationTime,
63 unsigned numRemainingBytes);
64 virtual Boolean frameCanAppearAfterPacketStart(unsigned char const* frameStart,
65 unsigned numBytesInFrame) const;
66 virtual unsigned specialHeaderSize() const;
67 virtual unsigned computeOverflowForNewFrame(unsigned newFrameSize) const;
68
69private:
70 char* fFmtpSDPLine;
71 char* fSampling;
72 unsigned fWidth;
73 unsigned fHeight;
74 unsigned fDepth;
75 char* fColorimetry;
76 unsigned fLineindex;
77 FrameParameters fFrameParameters;
78
79 unsigned getNbLineInPacket(unsigned fragOffset, unsigned*& lengths, unsigned*& offsets) const;
80 // return the number of lines, their lengths and offsets from the fragmentation offset of the whole frame.
81 // call delete[] on lengths and offsets after use of the function
82 void setFrameParameters();
83};
84
85#endif
86