~ubuntu-branches/ubuntu/trusty/monodevelop/trusty-proposed

« back to all changes in this revision

Viewing changes to external/maccore/src/CoreVideo/CVPixelBufferPoolSettings.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2013-05-12 09:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20130512094603-mad323bzcxvmcam0
Tags: upstream-4.0.5+dfsg
ImportĀ upstreamĀ versionĀ 4.0.5+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// 
 
2
// CVPixelBufferPoolSettings.cs: Implements settings for CVPixelBufferPool
 
3
//
 
4
// Authors: Marek Safar (marek.safar@gmail.com)
 
5
//     
 
6
// Copyright 2012, Xamarin Inc.
 
7
//
 
8
// Permission is hereby granted, free of charge, to any person obtaining
 
9
// a copy of this software and associated documentation files (the
 
10
// "Software"), to deal in the Software without restriction, including
 
11
// without limitation the rights to use, copy, modify, merge, publish,
 
12
// distribute, sublicense, and/or sell copies of the Software, and to
 
13
// permit persons to whom the Software is furnished to do so, subject to
 
14
// the following conditions:
 
15
// 
 
16
// The above copyright notice and this permission notice shall be
 
17
// included in all copies or substantial portions of the Software.
 
18
// 
 
19
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 
20
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 
21
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 
22
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
 
23
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
 
24
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 
25
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
26
//
 
27
 
 
28
using System;
 
29
 
 
30
using MonoMac.Foundation;
 
31
using MonoMac.CoreFoundation;
 
32
using MonoMac.ObjCRuntime;
 
33
 
 
34
namespace MonoMac.CoreVideo {
 
35
 
 
36
        public class CVPixelBufferPoolSettings : DictionaryContainer
 
37
        {
 
38
#if !COREBUILD
 
39
                public CVPixelBufferPoolSettings ()
 
40
                        : base (new NSMutableDictionary ())
 
41
                {
 
42
                }
 
43
 
 
44
                public CVPixelBufferPoolSettings (NSDictionary dictionary)
 
45
                        : base (dictionary)
 
46
                {
 
47
                }
 
48
 
 
49
                public int? MinimumBufferCount {
 
50
                        set {
 
51
                                SetNumberValue (CVPixelBufferPool.MinimumBufferCountKey, value);
 
52
                        }
 
53
                        get {
 
54
                                return GetInt32Value (CVPixelBufferPool.MinimumBufferCountKey);
 
55
                        }
 
56
                }
 
57
 
 
58
                public double? MaximumBufferAgeInSeconds {
 
59
                        set {
 
60
                                SetNumberValue (CVPixelBufferPool.MaximumBufferAgeKey, value);
 
61
                        }
 
62
                        get {
 
63
                                return GetDoubleValue (CVPixelBufferPool.MaximumBufferAgeKey);
 
64
                        }
 
65
                }
 
66
#endif
 
67
        }
 
68
 
 
69
        public class CVPixelBufferPoolAllocationSettings : DictionaryContainer
 
70
        {
 
71
                static readonly NSString ThresholdKey;
 
72
 
 
73
                static CVPixelBufferPoolAllocationSettings ()
 
74
                {
 
75
                        var handle = Dlfcn.dlopen (Constants.CoreVideoLibrary, 0);
 
76
                        if (handle == IntPtr.Zero)
 
77
                                return;
 
78
                        try {
 
79
                                ThresholdKey = Dlfcn.GetStringConstant (handle, "kCVPixelBufferPoolAllocationThresholdKey");
 
80
                        } finally {
 
81
                                Dlfcn.dlclose (handle);
 
82
                        }
 
83
                }
 
84
 
 
85
#if !COREBUILD
 
86
                public CVPixelBufferPoolAllocationSettings ()
 
87
                        : base (new NSMutableDictionary ())
 
88
                {
 
89
                }
 
90
 
 
91
                public CVPixelBufferPoolAllocationSettings (NSDictionary dictionary)
 
92
                        : base (dictionary)
 
93
                {
 
94
                }
 
95
 
 
96
                public int? Threshold {
 
97
                        set {
 
98
                                SetNumberValue (ThresholdKey, value);
 
99
                        }
 
100
                        get {
 
101
                                return GetInt32Value (ThresholdKey);
 
102
                        }
 
103
                }
 
104
#endif
 
105
        }
 
106
}