MP3AudioFileServerMediaSubsession.hh 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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 an MP3 audio file.
  18. // (Actually, any MPEG-1 or MPEG-2 audio file should work.)
  19. // C++ header
  20. #ifndef _MP3_AUDIO_FILE_SERVER_MEDIA_SUBSESSION_HH
  21. #define _MP3_AUDIO_FILE_SERVER_MEDIA_SUBSESSION_HH
  22. #ifndef _FILE_SERVER_MEDIA_SUBSESSION_HH
  23. #include "FileServerMediaSubsession.hh"
  24. #endif
  25. #ifndef _MP3_ADU_INTERLEAVING_HH
  26. #include "MP3ADUinterleaving.hh"
  27. #endif
  28. #ifndef _MP3_ADU_HH
  29. #include "MP3ADU.hh"
  30. #endif
  31. class MP3AudioFileServerMediaSubsession: public FileServerMediaSubsession{
  32. public:
  33. static MP3AudioFileServerMediaSubsession*
  34. createNew(UsageEnvironment& env, char const* fileName, Boolean reuseFirstSource,
  35. Boolean generateADUs, Interleaving* interleaving);
  36. // Note: "interleaving" is used only if "generateADUs" is True,
  37. // (and a value of NULL means 'no interleaving')
  38. protected:
  39. MP3AudioFileServerMediaSubsession(UsageEnvironment& env,
  40. char const* fileName, Boolean reuseFirstSource,
  41. Boolean generateADUs,
  42. Interleaving* interleaving);
  43. // called only by createNew();
  44. virtual ~MP3AudioFileServerMediaSubsession();
  45. FramedSource* createNewStreamSourceCommon(FramedSource* baseMP3Source, unsigned mp3NumBytes, unsigned& estBitrate);
  46. void getBaseStreams(FramedSource* frontStream,
  47. FramedSource*& sourceMP3Stream, ADUFromMP3Source*& aduStream/*if any*/);
  48. protected: // redefined virtual functions
  49. virtual void seekStreamSource(FramedSource* inputSource, double& seekNPT, double streamDuration, u_int64_t& numBytes);
  50. virtual void setStreamSourceScale(FramedSource* inputSource, float scale);
  51. virtual FramedSource* createNewStreamSource(unsigned clientSessionId,
  52. unsigned& estBitrate);
  53. virtual RTPSink* createNewRTPSink(Groupsock* rtpGroupsock,
  54. unsigned char rtpPayloadTypeIfDynamic,
  55. FramedSource* inputSource);
  56. virtual void testScaleFactor(float& scale);
  57. virtual float duration() const;
  58. protected:
  59. Boolean fGenerateADUs;
  60. Interleaving* fInterleaving;
  61. float fFileDuration;
  62. };
  63. #endif