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 | |
7 | This library is distributed in the hope that it will be useful, but WITHOUT |
8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for |
10 | more details. |
11 | |
12 | You should have received a copy of the GNU Lesser General Public License |
13 | along with this library; if not, write to the Free Software Foundation, Inc., |
14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
15 | **********/ |
16 | // "liveMedia" |
17 | // Copyright (c) 1996-2020 Live Networks, Inc. All rights reserved. |
18 | // A template for a MediaSource encapsulating an audio/video input device |
19 | // |
20 | // NOTE: Sections of this code labeled "%%% TO BE WRITTEN %%%" are incomplete, and needto be written by the programmer |
21 | // (depending on the features of the particulardevice). |
22 | // C++ header |
23 | |
24 | #ifndef _DEVICE_SOURCE_HH |
25 | #define _DEVICE_SOURCE_HH |
26 | |
27 | #ifndef _FRAMED_SOURCE_HH |
28 | #include "FramedSource.hh" |
29 | #endif |
30 | |
31 | // The following class can be used to define specific encoder parameters |
32 | class DeviceParameters { |
33 | //%%% TO BE WRITTEN %%% |
34 | }; |
35 | |
36 | class DeviceSource: public FramedSource { |
37 | public: |
38 | static DeviceSource* createNew(UsageEnvironment& env, |
39 | DeviceParameters params); |
40 | |
41 | public: |
42 | static EventTriggerId eventTriggerId; |
43 | // Note that this is defined here to be a static class variable, because this code is intended to illustrate how to |
44 | // encapsulate a *single* device - not a set of devices. |
45 | // You can, however, redefine this to be a non-static member variable. |
46 | |
47 | protected: |
48 | DeviceSource(UsageEnvironment& env, DeviceParameters params); |
49 | // called only by createNew(), or by subclass constructors |
50 | virtual ~DeviceSource(); |
51 | |
52 | private: |
53 | // redefined virtual functions: |
54 | virtual void doGetNextFrame(); |
55 | //virtual void doStopGettingFrames(); // optional |
56 | |
57 | private: |
58 | static void deliverFrame0(void* clientData); |
59 | void deliverFrame(); |
60 | |
61 | private: |
62 | static unsigned referenceCount; // used to count how many instances of this class currently exist |
63 | DeviceParameters fParams; |
64 | }; |
65 | |
66 | #endif |
67 | |