MPEG2TransportStreamFromESSource.hh 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. // A filter for converting one or more MPEG Elementary Streams
  17. // to a MPEG-2 Transport Stream
  18. // C++ header
  19. #ifndef _MPEG2_TRANSPORT_STREAM_FROM_ES_SOURCE_HH
  20. #define _MPEG2_TRANSPORT_STREAM_FROM_ES_SOURCE_HH
  21. #ifndef _MPEG2_TRANSPORT_STREAM_MULTIPLEXOR_HH
  22. #include "MPEG2TransportStreamMultiplexor.hh"
  23. #endif
  24. class MPEG2TransportStreamFromESSource: public MPEG2TransportStreamMultiplexor {
  25. public:
  26. static MPEG2TransportStreamFromESSource* createNew(UsageEnvironment& env);
  27. void addNewVideoSource(FramedSource* inputSource, int mpegVersion, int16_t PID = -1);
  28. // Note: For MPEG-4 video, set "mpegVersion" to 4; for H.264 video, set "mpegVersion" to 5;
  29. // for H.265 video, set "mpegVersion" to 6
  30. void addNewAudioSource(FramedSource* inputSource, int mpegVersion, int16_t PID = -1);
  31. // Note: For Opus audio, set "mpegVersion" to 3
  32. // Note: In these functions, if "PID" is not -1, then it (currently, just the low 8 bits)
  33. // is used as the stream's PID. Otherwise (if "PID" is -1) the 'stream_id' is used as
  34. // the PID.
  35. static unsigned maxInputESFrameSize;
  36. protected:
  37. MPEG2TransportStreamFromESSource(UsageEnvironment& env);
  38. // called only by createNew()
  39. virtual ~MPEG2TransportStreamFromESSource();
  40. void addNewInputSource(FramedSource* inputSource,
  41. u_int8_t streamId, int mpegVersion, int16_t PID = -1);
  42. // used to implement addNew*Source() above
  43. private:
  44. // Redefined virtual functions:
  45. virtual void doStopGettingFrames();
  46. virtual void awaitNewBuffer(unsigned char* oldBuffer);
  47. private:
  48. friend class InputESSourceRecord;
  49. class InputESSourceRecord* fInputSources;
  50. unsigned fVideoSourceCounter, fAudioSourceCounter;
  51. Boolean fAwaitingBackgroundDelivery;
  52. };
  53. #endif