RawVideoRTPSink.hh 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. This library is distributed in the hope that it will be useful, but WITHOUT
  7. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  8. FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
  9. more details.
  10. You should have received a copy of the GNU Lesser General Public License
  11. along with this library; if not, write to the Free Software Foundation, Inc.,
  12. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  13. **********/
  14. // "liveMedia"
  15. // Copyright (c) 1996-2020 Live Networks, Inc. All rights reserved.
  16. // RTP sink for Raw video
  17. // C++ header
  18. #ifndef _RAW_VIDEO_RTP_SINK_HH
  19. #define _RAW_VIDEO_RTP_SINK_HH
  20. #ifndef _VIDEO_RTP_SINK_HH
  21. #include "VideoRTPSink.hh"
  22. #endif
  23. #ifndef _RAW_VIDEO_FRAME_PARAMETERS_HH
  24. #include "RawVideoFrameParameters.hh"
  25. #endif
  26. class RawVideoRTPSink: public VideoRTPSink {
  27. public:
  28. static RawVideoRTPSink*
  29. createNew(UsageEnvironment& env, Groupsock* RTPgs, u_int8_t rtpPayloadFormat,
  30. unsigned width, unsigned height, unsigned depth, // as defined by RFC 4175, sec 6.1
  31. char const* sampling, char const* colorimetry);
  32. protected:
  33. RawVideoRTPSink(UsageEnvironment& env, Groupsock* RTPgs,
  34. u_int8_t rtpPayloadFormat,
  35. unsigned width, unsigned height, unsigned depth,
  36. char const* sampling, char const* colorimetry);
  37. // called only by createNew()
  38. virtual ~RawVideoRTPSink();
  39. private: // redefined virtual functions:
  40. virtual char const* auxSDPLine(); // for the "a=fmtp:" SDP line
  41. virtual void doSpecialFrameHandling(unsigned fragmentationOffset,
  42. unsigned char* frameStart,
  43. unsigned numBytesInFrame,
  44. struct timeval framePresentationTime,
  45. unsigned numRemainingBytes);
  46. virtual Boolean frameCanAppearAfterPacketStart(unsigned char const* frameStart,
  47. unsigned numBytesInFrame) const;
  48. virtual unsigned specialHeaderSize() const;
  49. virtual unsigned computeOverflowForNewFrame(unsigned newFrameSize) const;
  50. private:
  51. char* fFmtpSDPLine;
  52. unsigned fLineIndex;
  53. RawVideoFrameParameters fP;
  54. unsigned getNumLinesInPacket(unsigned fragOffset, u_int16_t*& lengths, u_int16_t*& offsets) const;
  55. // return the number of lines, their lengths and offsets from the fragmentation offset of the whole frame.
  56. // call delete[] on lengths and offsets after use of the function
  57. };
  58. #endif