MPEG2TransportStreamFromPESSource.hh 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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 a stream of MPEG PES packets to a MPEG-2 Transport Stream
  17. // C++ header
  18. #ifndef _MPEG2_TRANSPORT_STREAM_FROM_PES_SOURCE_HH
  19. #define _MPEG2_TRANSPORT_STREAM_FROM_PES_SOURCE_HH
  20. #ifndef _MPEG2_TRANSPORT_STREAM_MULTIPLEXOR_HH
  21. #include "MPEG2TransportStreamMultiplexor.hh"
  22. #endif
  23. #ifndef _MPEG_1OR2_DEMUXED_ELEMENTARY_STREAM_HH
  24. #include "MPEG1or2DemuxedElementaryStream.hh"
  25. #endif
  26. class MPEG2TransportStreamFromPESSource: public MPEG2TransportStreamMultiplexor {
  27. public:
  28. static MPEG2TransportStreamFromPESSource*
  29. createNew(UsageEnvironment& env, MPEG1or2DemuxedElementaryStream* inputSource);
  30. protected:
  31. MPEG2TransportStreamFromPESSource(UsageEnvironment& env,
  32. MPEG1or2DemuxedElementaryStream* inputSource);
  33. // called only by createNew()
  34. virtual ~MPEG2TransportStreamFromPESSource();
  35. private:
  36. // Redefined virtual functions:
  37. virtual void doStopGettingFrames();
  38. virtual void awaitNewBuffer(unsigned char* oldBuffer);
  39. private:
  40. static void afterGettingFrame(void* clientData, unsigned frameSize,
  41. unsigned numTruncatedBytes,
  42. struct timeval presentationTime,
  43. unsigned durationInMicroseconds);
  44. void afterGettingFrame1(unsigned frameSize,
  45. unsigned numTruncatedBytes,
  46. struct timeval presentationTime,
  47. unsigned durationInMicroseconds);
  48. private:
  49. MPEG1or2DemuxedElementaryStream* fInputSource;
  50. unsigned char* fInputBuffer;
  51. };
  52. #endif