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 <http://www.gnu.org/copyleft/lesser.html>.)
6 
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.
11 
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-2020 Live Networks, Inc.  All rights reserved.
18 // MPEG4-GENERIC ("audio", "video", or "application") RTP stream sinks
19 // C++ header
20 
21 #ifndef _MPEG4_GENERIC_RTP_SINK_HH
22 #define _MPEG4_GENERIC_RTP_SINK_HH
23 
24 #ifndef _MULTI_FRAMED_RTP_SINK_HH
25 #include "MultiFramedRTPSink.hh"
26 #endif
27 
28 class MPEG4GenericRTPSink: public MultiFramedRTPSink {
29 public:
30   static MPEG4GenericRTPSink*
31   createNew(UsageEnvironment& env, Groupsock* RTPgs,
32 	    u_int8_t rtpPayloadFormat, u_int32_t rtpTimestampFrequency,
33 	    char const* sdpMediaTypeString, char const* mpeg4Mode,
34 	    char const* configString,
35 	    unsigned numChannels = 1);
36 
37 protected:
38   MPEG4GenericRTPSink(UsageEnvironment& env, Groupsock* RTPgs,
39 		      u_int8_t rtpPayloadFormat,
40 		      u_int32_t rtpTimestampFrequency,
41 		      char const* sdpMediaTypeString,
42 		      char const* mpeg4Mode, char const* configString,
43 		      unsigned numChannels);
44 	// called only by createNew()
45 
46   virtual ~MPEG4GenericRTPSink();
47 
48 private: // redefined virtual functions:
49   virtual
50   Boolean frameCanAppearAfterPacketStart(unsigned char const* frameStart,
51 					 unsigned numBytesInFrame) const;
52   virtual void doSpecialFrameHandling(unsigned fragmentationOffset,
53                                       unsigned char* frameStart,
54                                       unsigned numBytesInFrame,
55                                       struct timeval framePresentationTime,
56                                       unsigned numRemainingBytes);
57   virtual unsigned specialHeaderSize() const;
58 
59   virtual char const* sdpMediaType() const;
60 
61   virtual char const* auxSDPLine(); // for the "a=fmtp:" SDP line
62 
63 private:
64   char const* fSDPMediaTypeString;
65   char const* fMPEG4Mode;
66   char const* fConfigString;
67   char* fFmtpSDPLine;
68 };
69 
70 #endif
71