WAVAudioFileServerMediaSubsession.hh 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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 WAV audio file.
  18. // C++ header
  19. #ifndef _WAV_AUDIO_FILE_SERVER_MEDIA_SUBSESSION_HH
  20. #define _WAV_AUDIO_FILE_SERVER_MEDIA_SUBSESSION_HH
  21. #ifndef _FILE_SERVER_MEDIA_SUBSESSION_HH
  22. #include "FileServerMediaSubsession.hh"
  23. #endif
  24. class WAVAudioFileServerMediaSubsession: public FileServerMediaSubsession{
  25. public:
  26. static WAVAudioFileServerMediaSubsession*
  27. createNew(UsageEnvironment& env, char const* fileName, Boolean reuseFirstSource,
  28. Boolean convertToULaw = False);
  29. // If "convertToULaw" is True, 16-bit audio streams are converted to
  30. // 8-bit u-law audio prior to streaming.
  31. protected:
  32. WAVAudioFileServerMediaSubsession(UsageEnvironment& env, char const* fileName,
  33. Boolean reuseFirstSource, Boolean convertToULaw);
  34. // called only by createNew();
  35. virtual ~WAVAudioFileServerMediaSubsession();
  36. protected: // redefined virtual functions
  37. virtual void seekStreamSource(FramedSource* inputSource, double& seekNPT, double streamDuration, u_int64_t& numBytes);
  38. virtual void setStreamSourceScale(FramedSource* inputSource, float scale);
  39. virtual void setStreamSourceDuration(FramedSource* inputSource, double streamDuration, u_int64_t& numBytes);
  40. virtual FramedSource* createNewStreamSource(unsigned clientSessionId,
  41. unsigned& estBitrate);
  42. virtual RTPSink* createNewRTPSink(Groupsock* rtpGroupsock,
  43. unsigned char rtpPayloadTypeIfDynamic,
  44. FramedSource* inputSource);
  45. virtual void testScaleFactor(float& scale);
  46. virtual float duration() const;
  47. protected:
  48. Boolean fConvertToULaw;
  49. // The following parameters of the input stream are set after
  50. // "createNewStreamSource" is called:
  51. unsigned char fAudioFormat;
  52. unsigned char fBitsPerSample;
  53. unsigned fSamplingFrequency;
  54. unsigned fNumChannels;
  55. float fFileDuration;
  56. };
  57. #endif