MPEG2TransportStreamAccumulator.hh 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. // Collects a stream of incoming MPEG Transport Stream packets into
  17. // a chunk sufficiently large to send in a single outgoing (RTP or UDP) packet.
  18. // C++ header
  19. #ifndef _MPEG2_TRANSPORT_STREAM_ACCUMULATOR_HH
  20. #define _MPEG_TRANSPORT_STREAM_ACCUMULATOR_HH
  21. #ifndef _FRAMED_FILTER_HH
  22. #include "FramedFilter.hh"
  23. #endif
  24. class MPEG2TransportStreamAccumulator: public FramedFilter {
  25. public:
  26. static MPEG2TransportStreamAccumulator* createNew(UsageEnvironment& env,
  27. FramedSource* inputSource,
  28. unsigned maxPacketSize = 1456);
  29. protected:
  30. MPEG2TransportStreamAccumulator(UsageEnvironment& env,
  31. FramedSource* inputSource, unsigned maxPacketSize);
  32. // called only by createNew()
  33. virtual ~MPEG2TransportStreamAccumulator();
  34. private:
  35. // redefined virtual functions:
  36. virtual void doGetNextFrame();
  37. private:
  38. static void afterGettingFrame(void* clientData, unsigned frameSize,
  39. unsigned numTruncatedBytes,
  40. struct timeval presentationTime,
  41. unsigned durationInMicroseconds);
  42. void afterGettingFrame1(unsigned frameSize,
  43. unsigned numTruncatedBytes,
  44. struct timeval presentationTime,
  45. unsigned durationInMicroseconds);
  46. private:
  47. unsigned const fDesiredPacketSize;
  48. unsigned fNumBytesGathered;
  49. };
  50. #endif
  51. #ifndef _MP3_TRANSCODER_HH
  52. #define _MP3_TRANSCODER_HH
  53. #ifndef _MP3_ADU_HH
  54. #include "MP3ADU.hh"
  55. #endif
  56. #ifndef _MP3_ADU_TRANSCODER_HH
  57. #include "MP3ADUTranscoder.hh"
  58. #endif
  59. class MP3Transcoder: public MP3FromADUSource {
  60. public:
  61. static MP3Transcoder* createNew(UsageEnvironment& env,
  62. unsigned outBitrate /* in kbps */,
  63. FramedSource* inputSource);
  64. protected:
  65. MP3Transcoder(UsageEnvironment& env,
  66. MP3ADUTranscoder* aduTranscoder);
  67. // called only by createNew()
  68. virtual ~MP3Transcoder();
  69. };
  70. #endif