~ubuntu-branches/debian/experimental/gpac/experimental

« back to all changes in this revision

Viewing changes to extra_lib/include/avcap/windows/DS_Control.h

  • Committer: Package Import Robot
  • Author(s): Reinhard Tartler
  • Date: 2014-02-22 18:15:00 UTC
  • mfrom: (1.2.2) (3.1.6 sid)
  • Revision ID: package-import@ubuntu.com-20140222181500-b4phupo05gjpmopa
Tags: 0.5.0+svn5104~dfsg1-1
* New  upstream version 0.5.0+svn5104~dfsg1:
  - src/utils/sha1.c is relicensed under LGPLv2.1, Closes: #730759
* Don't install modules in multi-arch directories, Closes: #730497
* Add libusb-1.0.0-dev headers because libfreenect requires this
* Fix install rule
* Follow upstream soname bump
  - Drop the symbols file for now until it has been revised thourougly
* Let binaries produce the correct svn revision
* Refresh patches
* Patch and build against libav10, Closes: #739321
* Bump standards version, no changes necessary

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * (c) 2005, 2008 Nico Pranke <Nico.Pranke@googlemail.com>, Robin Luedtke <RobinLu@gmx.de> 
3
 
 *
4
 
 * This file is part of avcap.
5
 
 *
6
 
 * avcap is free software: you can redistribute it and/or modify
7
 
 * it under the terms of the GNU General Public License as published by
8
 
 * the Free Software Foundation, either version 3 of the License, or
9
 
 * (at your option) any later version.
10
 
 *
11
 
 * avcap is distributed in the hope that it will be useful,
12
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 
 * GNU General Public License for more details.
15
 
 *
16
 
 * You should have received a copy of the GNU General Public License
17
 
 * along with avcap.  If not, see <http://www.gnu.org/licenses/>.
18
 
 */
19
 
 
20
 
/* avcap is free for non-commercial use.
21
 
 * To use it in commercial endeavors, please contact Nico Pranke <Nico.Pranke@googlemail.com>.
22
 
 */
23
 
 
24
 
 
25
 
#ifndef DSCONTROL_H_
26
 
#define DSCONTROL_H_
27
 
 
28
 
#include <string>
29
 
 
30
 
#include "Control_avcap.h"
31
 
#include "Interval.h"
32
 
#include "avcap-export.h"
33
 
 
34
 
namespace avcap
35
 
{
36
 
class DS_DeviceDescriptor;
37
 
 
38
 
        //! Implementation of the Control-class for DirectShow.
39
 
 
40
 
        class AVCAP_Export DS_Control
41
 
        {
42
 
        public:
43
 
                enum Ctrl_Type
44
 
                {
45
 
                        CTRL_TYPE_INTEGER = 1,
46
 
                        CTRL_TYPE_BOOLEAN = 2,
47
 
                };
48
 
        
49
 
                enum DShowInterface
50
 
                {
51
 
                        IAM_VIDEOPROCAMP = 1,
52
 
                        IAM_CAMERACONTROL = 2,
53
 
                };
54
 
        
55
 
                //! Helper-class to query control-properties
56
 
                
57
 
                struct Query_Ctrl
58
 
                {
59
 
                        unsigned int    id;
60
 
                        Ctrl_Type               type;
61
 
                        std::string     name;
62
 
                        
63
 
                        long minimum;
64
 
                        long maximum;
65
 
                        long step;
66
 
                        long default_value;
67
 
                        long flags;
68
 
                        long property;
69
 
        
70
 
                        DS_Control::DShowInterface DShowInterfaceType;
71
 
                };
72
 
        
73
 
        private:
74
 
                DShowInterface  mDShowInterfaceType;
75
 
                long                    mProperty;
76
 
                int                     mId;
77
 
                int                     mValue;
78
 
                std::string     mName;
79
 
                int                     mDefaultValue;
80
 
                int                     mFlags;
81
 
                bool                    mInitialized;
82
 
        
83
 
        protected:
84
 
                DS_DeviceDescriptor* mDSDeviceDescriptor;
85
 
        
86
 
        public:
87
 
                DS_Control(DS_DeviceDescriptor *dd, Query_Ctrl* query);
88
 
                virtual ~DS_Control();
89
 
        
90
 
                inline int getId() const
91
 
                        { return mId; }
92
 
        
93
 
                inline int getDefaultValue() const
94
 
                        { return mDefaultValue; }
95
 
        
96
 
                inline const std::string& getName() const
97
 
                        { return mName; }
98
 
        
99
 
                int setValue(int val);
100
 
        
101
 
                int getValue() const;
102
 
        
103
 
                int reset();
104
 
                
105
 
        private:
106
 
                int update();
107
 
 
108
 
                int retrieveValue();
109
 
        };
110
 
        
111
 
        //! DirectShow integer valued control.
112
 
        
113
 
        class DS_IntControl : public IntegerControl
114
 
        {
115
 
        private:
116
 
                Interval        mInterval;
117
 
                DS_Control      mControlBase;
118
 
                
119
 
        public:
120
 
                inline DS_IntControl(DS_DeviceDescriptor *dd, struct DS_Control::Query_Ctrl* query) :
121
 
                        mInterval(query->minimum, query->maximum, query->step),
122
 
                        mControlBase(dd, query)
123
 
                        {}
124
 
        
125
 
                virtual inline ~DS_IntControl()
126
 
                        {}
127
 
        
128
 
                inline const Interval& getInterval() const 
129
 
                        { return mInterval; }
130
 
 
131
 
                virtual inline int getId() const
132
 
                        { return mControlBase.getId(); }
133
 
        
134
 
                virtual inline int getDefaultValue() const
135
 
                        { return mControlBase.getDefaultValue(); }
136
 
        
137
 
                virtual inline const std::string& getName() const
138
 
                        { return mControlBase.getName(); }
139
 
        
140
 
                virtual inline int setValue(int val)
141
 
                        { return mControlBase.setValue(val); }
142
 
        
143
 
                virtual inline int getValue() const
144
 
                        { return mControlBase.getValue(); }
145
 
                
146
 
                virtual inline int reset() 
147
 
                        { return mControlBase.reset(); }
148
 
        };
149
 
        
150
 
        //! DirectShow boolean control.
151
 
 
152
 
        class DS_BoolControl : public BoolControl
153
 
        {
154
 
        private:
155
 
                DS_Control      mControlBase;
156
 
 
157
 
        public:
158
 
                inline DS_BoolControl(DS_DeviceDescriptor *dd, struct DS_Control::Query_Ctrl* query) :
159
 
                        mControlBase(dd, query)
160
 
                        {}
161
 
        
162
 
                virtual inline ~DS_BoolControl()
163
 
                        {}
164
 
                
165
 
                virtual inline int getId() const
166
 
                        { return mControlBase.getId(); }
167
 
        
168
 
                virtual inline int getDefaultValue() const
169
 
                        { return mControlBase.getDefaultValue(); }
170
 
        
171
 
                virtual inline const std::string& getName() const
172
 
                        { return mControlBase.getName(); }
173
 
        
174
 
                virtual inline int setValue(int val)
175
 
                        { return mControlBase.setValue(val); }
176
 
        
177
 
                virtual inline int getValue() const
178
 
                        { return mControlBase.getValue(); }
179
 
                
180
 
                virtual inline int reset() 
181
 
                        { return mControlBase.reset(); }
182
 
        };
183
 
}
184
 
 
185
 
#endif // DSCONTROL_H_
 
1
/*
 
2
 * (c) 2005, 2008 Nico Pranke <Nico.Pranke@googlemail.com>, Robin Luedtke <RobinLu@gmx.de> 
 
3
 *
 
4
 * This file is part of avcap.
 
5
 *
 
6
 * avcap is free software: you can redistribute it and/or modify
 
7
 * it under the terms of the GNU General Public License as published by
 
8
 * the Free Software Foundation, either version 3 of the License, or
 
9
 * (at your option) any later version.
 
10
 *
 
11
 * avcap is distributed in the hope that it will be useful,
 
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
 * GNU General Public License for more details.
 
15
 *
 
16
 * You should have received a copy of the GNU General Public License
 
17
 * along with avcap.  If not, see <http://www.gnu.org/licenses/>.
 
18
 */
 
19
 
 
20
/* avcap is free for non-commercial use.
 
21
 * To use it in commercial endeavors, please contact Nico Pranke <Nico.Pranke@googlemail.com>.
 
22
 */
 
23
 
 
24
 
 
25
#ifndef DSCONTROL_H_
 
26
#define DSCONTROL_H_
 
27
 
 
28
#include <string>
 
29
 
 
30
#include "Control_avcap.h"
 
31
#include "Interval.h"
 
32
#include "avcap-export.h"
 
33
 
 
34
namespace avcap
 
35
{
 
36
class DS_DeviceDescriptor;
 
37
 
 
38
        //! Implementation of the Control-class for DirectShow.
 
39
 
 
40
        class AVCAP_Export DS_Control
 
41
        {
 
42
        public:
 
43
                enum Ctrl_Type
 
44
                {
 
45
                        CTRL_TYPE_INTEGER = 1,
 
46
                        CTRL_TYPE_BOOLEAN = 2,
 
47
                };
 
48
        
 
49
                enum DShowInterface
 
50
                {
 
51
                        IAM_VIDEOPROCAMP = 1,
 
52
                        IAM_CAMERACONTROL = 2,
 
53
                };
 
54
        
 
55
                //! Helper-class to query control-properties
 
56
                
 
57
                struct Query_Ctrl
 
58
                {
 
59
                        unsigned int    id;
 
60
                        Ctrl_Type               type;
 
61
                        std::string     name;
 
62
                        
 
63
                        long minimum;
 
64
                        long maximum;
 
65
                        long step;
 
66
                        long default_value;
 
67
                        long flags;
 
68
                        long property;
 
69
        
 
70
                        DS_Control::DShowInterface DShowInterfaceType;
 
71
                };
 
72
        
 
73
        private:
 
74
                DShowInterface  mDShowInterfaceType;
 
75
                long                    mProperty;
 
76
                int                     mId;
 
77
                int                     mValue;
 
78
                std::string     mName;
 
79
                int                     mDefaultValue;
 
80
                int                     mFlags;
 
81
                bool                    mInitialized;
 
82
        
 
83
        protected:
 
84
                DS_DeviceDescriptor* mDSDeviceDescriptor;
 
85
        
 
86
        public:
 
87
                DS_Control(DS_DeviceDescriptor *dd, Query_Ctrl* query);
 
88
                virtual ~DS_Control();
 
89
        
 
90
                inline int getId() const
 
91
                        { return mId; }
 
92
        
 
93
                inline int getDefaultValue() const
 
94
                        { return mDefaultValue; }
 
95
        
 
96
                inline const std::string& getName() const
 
97
                        { return mName; }
 
98
        
 
99
                int setValue(int val);
 
100
        
 
101
                int getValue() const;
 
102
        
 
103
                int reset();
 
104
                
 
105
        private:
 
106
                int update();
 
107
 
 
108
                int retrieveValue();
 
109
        };
 
110
        
 
111
        //! DirectShow integer valued control.
 
112
        
 
113
        class DS_IntControl : public IntegerControl
 
114
        {
 
115
        private:
 
116
                Interval        mInterval;
 
117
                DS_Control      mControlBase;
 
118
                
 
119
        public:
 
120
                inline DS_IntControl(DS_DeviceDescriptor *dd, struct DS_Control::Query_Ctrl* query) :
 
121
                        mInterval(query->minimum, query->maximum, query->step),
 
122
                        mControlBase(dd, query)
 
123
                        {}
 
124
        
 
125
                virtual inline ~DS_IntControl()
 
126
                        {}
 
127
        
 
128
                inline const Interval& getInterval() const 
 
129
                        { return mInterval; }
 
130
 
 
131
                virtual inline int getId() const
 
132
                        { return mControlBase.getId(); }
 
133
        
 
134
                virtual inline int getDefaultValue() const
 
135
                        { return mControlBase.getDefaultValue(); }
 
136
        
 
137
                virtual inline const std::string& getName() const
 
138
                        { return mControlBase.getName(); }
 
139
        
 
140
                virtual inline int setValue(int val)
 
141
                        { return mControlBase.setValue(val); }
 
142
        
 
143
                virtual inline int getValue() const
 
144
                        { return mControlBase.getValue(); }
 
145
                
 
146
                virtual inline int reset() 
 
147
                        { return mControlBase.reset(); }
 
148
        };
 
149
        
 
150
        //! DirectShow boolean control.
 
151
 
 
152
        class DS_BoolControl : public BoolControl
 
153
        {
 
154
        private:
 
155
                DS_Control      mControlBase;
 
156
 
 
157
        public:
 
158
                inline DS_BoolControl(DS_DeviceDescriptor *dd, struct DS_Control::Query_Ctrl* query) :
 
159
                        mControlBase(dd, query)
 
160
                        {}
 
161
        
 
162
                virtual inline ~DS_BoolControl()
 
163
                        {}
 
164
                
 
165
                virtual inline int getId() const
 
166
                        { return mControlBase.getId(); }
 
167
        
 
168
                virtual inline int getDefaultValue() const
 
169
                        { return mControlBase.getDefaultValue(); }
 
170
        
 
171
                virtual inline const std::string& getName() const
 
172
                        { return mControlBase.getName(); }
 
173
        
 
174
                virtual inline int setValue(int val)
 
175
                        { return mControlBase.setValue(val); }
 
176
        
 
177
                virtual inline int getValue() const
 
178
                        { return mControlBase.getValue(); }
 
179
                
 
180
                virtual inline int reset() 
 
181
                        { return mControlBase.reset(); }
 
182
        };
 
183
}
 
184
 
 
185
#endif // DSCONTROL_H_