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

« back to all changes in this revision

Viewing changes to external/maccore/src/CoreMedia/CMBlockBuffer.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:
2
2
// CMBlockBuffer.cs: Implements the managed CMBlockBuffer
3
3
//
4
4
// Authors: Mono Team
 
5
//          Marek Safar (marek.safar@gmail.com)
5
6
//     
6
7
// Copyright 2010 Novell, Inc
 
8
// Copyright 2012 Xamarin Inc
7
9
//
8
10
using System;
9
11
using System.Runtime.InteropServices;
15
17
 
16
18
namespace MonoMac.CoreMedia {
17
19
 
 
20
        public enum CMBlockBufferError {
 
21
                None                                            = 0,
 
22
                StructureAllocationFailed       = -12700,
 
23
                BlockAllocationFailed           = -12701,
 
24
                BadCustomBlockSource            = -12702,
 
25
                BadOffsetParameter                      = -12703,
 
26
                BadLengthParameter                      = -12704,
 
27
                BadPointerParameter                     = -12705,
 
28
                EmptyBlockBuffer                        = -12706,
 
29
                UnallocatedBlock                        = -12707,
 
30
        }
 
31
 
 
32
        [Flags]
 
33
        public enum CMBlockBufferFlags : uint {
 
34
                AssureMemoryNow                 = (1<<0),
 
35
                AlwaysCopyData                  = (1<<1),
 
36
                DontOptimizeDepth               = (1<<2),
 
37
                PermitEmptyReference    = (1<<3)
 
38
        }
 
39
 
18
40
        [Since (4,0)]
19
41
        public class CMBlockBuffer : INativeObject, IDisposable {
20
42
                internal IntPtr handle;
55
77
                                handle = IntPtr.Zero;
56
78
                        }
57
79
                }
58
 
                
59
 
                [DllImport(Constants.CoreMediaLibrary)]
60
 
                extern static int CMBlockBufferCopyDataBytes (IntPtr handle, uint offsetToData, uint dataLength, IntPtr destination);
61
 
                
62
 
                public int CopyDataBytes (uint offsetToData, uint dataLength, IntPtr destination)
 
80
 
 
81
                [DllImport(Constants.CoreMediaLibrary)]
 
82
                extern static CMBlockBufferError CMBlockBufferCreateEmpty (IntPtr allocator, uint subBlockCapacity, CMBlockBufferFlags flags, out IntPtr output);
 
83
 
 
84
                public static CMBlockBuffer CreateEmpty (uint subBlockCapacity, CMBlockBufferFlags flags, out CMBlockBufferError error)
 
85
                {
 
86
                        IntPtr buffer;
 
87
                        error = CMBlockBufferCreateEmpty (IntPtr.Zero, subBlockCapacity, flags, out buffer);
 
88
                        if (error != CMBlockBufferError.None)
 
89
                                return null;
 
90
 
 
91
                        return new CMBlockBuffer (buffer, true);
 
92
                }
 
93
                
 
94
                [DllImport(Constants.CoreMediaLibrary)]
 
95
                extern static CMBlockBufferError CMBlockBufferCopyDataBytes (IntPtr handle, uint offsetToData, uint dataLength, IntPtr destination);
 
96
                
 
97
                public CMBlockBufferError CopyDataBytes (uint offsetToData, uint dataLength, IntPtr destination)
63
98
                {
64
99
                        return CMBlockBufferCopyDataBytes (handle, offsetToData, dataLength, destination);
65
100
                }