MPEG1or2DemuxedServerMediaSubsession.hh 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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 'ServerMediaSubsession' object that creates new, unicast, "RTPSink"s
  17. // on demand, from a MPEG-1 or 2 demuxer.
  18. // C++ header
  19. #ifndef _MPEG_1OR2_DEMUXED_SERVER_MEDIA_SUBSESSION_HH
  20. #define _MPEG_1OR2_DEMUXED_SERVER_MEDIA_SUBSESSION_HH
  21. #ifndef _ON_DEMAND_SERVER_MEDIA_SUBSESSION_HH
  22. #include "OnDemandServerMediaSubsession.hh"
  23. #endif
  24. #ifndef _MPEG_1OR2_FILE_SERVER_DEMUX_HH
  25. #include "MPEG1or2FileServerDemux.hh"
  26. #endif
  27. class MPEG1or2DemuxedServerMediaSubsession: public OnDemandServerMediaSubsession{
  28. public:
  29. static MPEG1or2DemuxedServerMediaSubsession*
  30. createNew(MPEG1or2FileServerDemux& demux, u_int8_t streamIdTag,
  31. Boolean reuseFirstSource,
  32. Boolean iFramesOnly = False, double vshPeriod = 5.0);
  33. // The last two parameters are relevant for video streams only
  34. private:
  35. MPEG1or2DemuxedServerMediaSubsession(MPEG1or2FileServerDemux& demux,
  36. u_int8_t streamIdTag, Boolean reuseFirstSource,
  37. Boolean iFramesOnly, double vshPeriod);
  38. // called only by createNew();
  39. virtual ~MPEG1or2DemuxedServerMediaSubsession();
  40. private: // redefined virtual functions
  41. virtual void seekStreamSource(FramedSource* inputSource, double& seekNPT, double streamDuration, u_int64_t& numBytes);
  42. virtual FramedSource* createNewStreamSource(unsigned clientSessionId,
  43. unsigned& estBitrate);
  44. virtual RTPSink* createNewRTPSink(Groupsock* rtpGroupsock,
  45. unsigned char rtpPayloadTypeIfDynamic,
  46. FramedSource* inputSource);
  47. virtual float duration() const;
  48. private:
  49. MPEG1or2FileServerDemux& fOurDemux;
  50. u_int8_t fStreamIdTag;
  51. Boolean fIFramesOnly; // for video streams
  52. double fVSHPeriod; // for video streams
  53. };
  54. #endif