MPEG1or2FileServerDemux.hh 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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 server demultiplexer for a MPEG 1 or 2 Program Stream
  17. // C++ header
  18. #ifndef _MPEG_1OR2_FILE_SERVER_DEMUX_HH
  19. #define _MPEG_1OR2_FILE_SERVER_DEMUX_HH
  20. #ifndef _SERVER_MEDIA_SESSION_HH
  21. #include "ServerMediaSession.hh"
  22. #endif
  23. #ifndef _MPEG_1OR2_DEMUXED_ELEMENTARY_STREAM_HH
  24. #include "MPEG1or2DemuxedElementaryStream.hh"
  25. #endif
  26. class MPEG1or2FileServerDemux: public Medium {
  27. public:
  28. static MPEG1or2FileServerDemux*
  29. createNew(UsageEnvironment& env, char const* fileName, Boolean reuseFirstSource);
  30. ServerMediaSubsession* newAudioServerMediaSubsession(); // MPEG-1 or 2 audio
  31. ServerMediaSubsession* newVideoServerMediaSubsession(Boolean iFramesOnly = False,
  32. double vshPeriod = 5.0
  33. /* how often (in seconds) to inject a Video_Sequence_Header,
  34. if one doesn't already appear in the stream */);
  35. ServerMediaSubsession* newAC3AudioServerMediaSubsession(); // AC-3 audio (from VOB)
  36. unsigned fileSize() const { return fFileSize; }
  37. float fileDuration() const { return fFileDuration; }
  38. private:
  39. MPEG1or2FileServerDemux(UsageEnvironment& env, char const* fileName,
  40. Boolean reuseFirstSource);
  41. // called only by createNew();
  42. virtual ~MPEG1or2FileServerDemux();
  43. private:
  44. friend class MPEG1or2DemuxedServerMediaSubsession;
  45. MPEG1or2DemuxedElementaryStream* newElementaryStream(unsigned clientSessionId,
  46. u_int8_t streamIdTag);
  47. private:
  48. char const* fFileName;
  49. unsigned fFileSize;
  50. float fFileDuration;
  51. Boolean fReuseFirstSource;
  52. MPEG1or2Demux* fSession0Demux;
  53. MPEG1or2Demux* fLastCreatedDemux;
  54. unsigned fLastClientSessionId;
  55. };
  56. #endif