MPEG4GenericRTPSource.hh 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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-2019 Live Networks, Inc. All rights reserved.
  16. // MPEG4-GENERIC ("audio", "video", or "application") RTP stream sources
  17. // C++ header
  18. #ifndef _MPEG4_GENERIC_RTP_SOURCE_HH
  19. #define _MPEG4_GENERIC_RTP_SOURCE_HH
  20. #ifndef _MULTI_FRAMED_RTP_SOURCE_HH
  21. #include "MultiFramedRTPSource.hh"
  22. #endif
  23. class MPEG4GenericRTPSource: public MultiFramedRTPSource {
  24. public:
  25. static MPEG4GenericRTPSource*
  26. createNew(UsageEnvironment& env, Groupsock* RTPgs,
  27. unsigned char rtpPayloadFormat,
  28. unsigned rtpTimestampFrequency,
  29. char const* mediumName,
  30. char const* mode, unsigned sizeLength, unsigned indexLength,
  31. unsigned indexDeltaLength
  32. // add other parameters later
  33. );
  34. // mediumName is "audio", "video", or "application"
  35. // it *cannot* be NULL
  36. protected:
  37. MPEG4GenericRTPSource(UsageEnvironment& env, Groupsock* RTPgs,
  38. unsigned char rtpPayloadFormat,
  39. unsigned rtpTimestampFrequency,
  40. char const* mediumName,
  41. char const* mode,
  42. unsigned sizeLength, unsigned indexLength,
  43. unsigned indexDeltaLength
  44. );
  45. // called only by createNew(), or by subclass constructors
  46. virtual ~MPEG4GenericRTPSource();
  47. protected:
  48. // redefined virtual functions:
  49. virtual Boolean processSpecialHeader(BufferedPacket* packet,
  50. unsigned& resultSpecialHeaderSize);
  51. virtual char const* MIMEtype() const;
  52. private:
  53. char* fMIMEType;
  54. char* fMode;
  55. unsigned fSizeLength, fIndexLength, fIndexDeltaLength;
  56. unsigned fNumAUHeaders; // in the most recently read packet
  57. unsigned fNextAUHeader; // index of the next AU Header to read
  58. struct AUHeader* fAUHeaders;
  59. friend class MPEG4GenericBufferedPacket;
  60. };
  61. // A function that looks up the sampling frequency from an
  62. // "AudioSpecificConfig" string. (0 means 'unknown')
  63. unsigned samplingFrequencyFromAudioSpecificConfig(char const* configStr);
  64. #endif