1/**********
2This library is free software; you can redistribute it and/or modify it under
3the terms of the GNU Lesser General Public License as published by the
4Free Software Foundation; either version 3 of the License, or (at your
5option) any later version. (See <http://www.gnu.org/copyleft/lesser.html>.)
6
7This library is distributed in the hope that it will be useful, but WITHOUT
8ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
9FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
10more details.
11
12You should have received a copy of the GNU Lesser General Public License
13along with this library; if not, write to the Free Software Foundation, Inc.,
1451 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
32class DeviceParameters {
33 //%%% TO BE WRITTEN %%%
34};
35
36class DeviceSource: public FramedSource {
37public:
38 static DeviceSource* createNew(UsageEnvironment& env,
39 DeviceParameters params);
40
41public:
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
47protected:
48 DeviceSource(UsageEnvironment& env, DeviceParameters params);
49 // called only by createNew(), or by subclass constructors
50 virtual ~DeviceSource();
51
52private:
53 // redefined virtual functions:
54 virtual void doGetNextFrame();
55 //virtual void doStopGettingFrames(); // optional
56
57private:
58 static void deliverFrame0(void* clientData);
59 void deliverFrame();
60
61private:
62 static unsigned referenceCount; // used to count how many instances of this class currently exist
63 DeviceParameters fParams;
64};
65
66#endif
67