DeviceSource.hh 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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 template for a MediaSource encapsulating an audio/video input device
  17. //
  18. // NOTE: Sections of this code labeled "%%% TO BE WRITTEN %%%" are incomplete, and needto be written by the programmer
  19. // (depending on the features of the particulardevice).
  20. // C++ header
  21. #ifndef _DEVICE_SOURCE_HH
  22. #define _DEVICE_SOURCE_HH
  23. #ifndef _FRAMED_SOURCE_HH
  24. #include "FramedSource.hh"
  25. #endif
  26. // The following class can be used to define specific encoder parameters
  27. class DeviceParameters {
  28. //%%% TO BE WRITTEN %%%
  29. };
  30. class DeviceSource: public FramedSource {
  31. public:
  32. static DeviceSource* createNew(UsageEnvironment& env,
  33. DeviceParameters params);
  34. public:
  35. static EventTriggerId eventTriggerId;
  36. // Note that this is defined here to be a static class variable, because this code is intended to illustrate how to
  37. // encapsulate a *single* device - not a set of devices.
  38. // You can, however, redefine this to be a non-static member variable.
  39. protected:
  40. DeviceSource(UsageEnvironment& env, DeviceParameters params);
  41. // called only by createNew(), or by subclass constructors
  42. virtual ~DeviceSource();
  43. private:
  44. // redefined virtual functions:
  45. virtual void doGetNextFrame();
  46. //virtual void doStopGettingFrames(); // optional
  47. private:
  48. static void deliverFrame0(void* clientData);
  49. void deliverFrame();
  50. private:
  51. static unsigned referenceCount; // used to count how many instances of this class currently exist
  52. DeviceParameters fParams;
  53. };
  54. #endif