1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
#[repr(C)]
pub struct imgIEncoder {
vtable: *const imgIEncoderVTable,
__nosync: ::std::marker::PhantomData<::std::rc::Rc<u8>>,
}
unsafe impl XpCom for imgIEncoder {
const IID: nsIID = nsID(0x4baa2d6e, 0xfee7, 0x42df,
[0xae, 0x3f, 0x5f, 0xbe, 0xbc, 0x0c, 0x26, 0x7c]);
}
unsafe impl RefCounted for imgIEncoder {
#[inline]
unsafe fn addref(&self) {
self.AddRef();
}
#[inline]
unsafe fn release(&self) {
self.Release();
}
}
#[doc(hidden)]
pub trait imgIEncoderCoerce {
fn coerce_from(v: &imgIEncoder) -> &Self;
}
impl imgIEncoderCoerce for imgIEncoder {
#[inline]
fn coerce_from(v: &imgIEncoder) -> &Self {
v
}
}
impl imgIEncoder {
#[inline]
pub fn coerce<T: imgIEncoderCoerce>(&self) -> &T {
T::coerce_from(self)
}
}
impl ::std::ops::Deref for imgIEncoder {
type Target = nsIAsyncInputStream;
#[inline]
fn deref(&self) -> &nsIAsyncInputStream {
unsafe {
::std::mem::transmute(self)
}
}
}
impl<T: nsIAsyncInputStreamCoerce> imgIEncoderCoerce for T {
#[inline]
fn coerce_from(v: &imgIEncoder) -> &Self {
T::coerce_from(v)
}
}
#[doc(hidden)]
#[repr(C)]
pub struct imgIEncoderVTable {
pub __base: nsIAsyncInputStreamVTable,
pub InitFromData: unsafe extern "system" fn (this: *const imgIEncoder, data: *const uint8_t, length: libc::uint32_t, width: uint32_t, height: uint32_t, stride: uint32_t, inputFormat: uint32_t, outputOptions: &::nsstring::nsAString) -> nsresult,
pub StartImageEncode: unsafe extern "system" fn (this: *const imgIEncoder, width: uint32_t, height: uint32_t, inputFormat: uint32_t, outputOptions: &::nsstring::nsAString) -> nsresult,
pub AddImageFrame: unsafe extern "system" fn (this: *const imgIEncoder, data: *const uint8_t, length: libc::uint32_t, width: uint32_t, height: uint32_t, stride: uint32_t, frameFormat: uint32_t, frameOptions: &::nsstring::nsAString) -> nsresult,
pub EndImageEncode: unsafe extern "system" fn (this: *const imgIEncoder) -> nsresult,
pub GetImageBufferUsed: unsafe extern "system" fn (this: *const imgIEncoder, _retval: *mut libc::uint32_t) -> nsresult,
pub GetImageBuffer: unsafe extern "system" fn (this: *const imgIEncoder, _retval: *mut *mut u8) -> nsresult,
}
impl imgIEncoder {
pub const INPUT_FORMAT_RGB: i64 = 0;
pub const INPUT_FORMAT_RGBA: i64 = 1;
pub const INPUT_FORMAT_HOSTARGB: i64 = 2;
#[inline]
pub unsafe fn InitFromData(&self, data: *const uint8_t, length: libc::uint32_t, width: uint32_t, height: uint32_t, stride: uint32_t, inputFormat: uint32_t, outputOptions: &::nsstring::nsAString) -> nsresult {
((*self.vtable).InitFromData)(self, data, length, width, height, stride, inputFormat, outputOptions)
}
#[inline]
pub unsafe fn StartImageEncode(&self, width: uint32_t, height: uint32_t, inputFormat: uint32_t, outputOptions: &::nsstring::nsAString) -> nsresult {
((*self.vtable).StartImageEncode)(self, width, height, inputFormat, outputOptions)
}
#[inline]
pub unsafe fn AddImageFrame(&self, data: *const uint8_t, length: libc::uint32_t, width: uint32_t, height: uint32_t, stride: uint32_t, frameFormat: uint32_t, frameOptions: &::nsstring::nsAString) -> nsresult {
((*self.vtable).AddImageFrame)(self, data, length, width, height, stride, frameFormat, frameOptions)
}
#[inline]
pub unsafe fn EndImageEncode(&self, ) -> nsresult {
((*self.vtable).EndImageEncode)(self, )
}
#[inline]
pub unsafe fn GetImageBufferUsed(&self, _retval: *mut libc::uint32_t) -> nsresult {
((*self.vtable).GetImageBufferUsed)(self, _retval)
}
#[inline]
pub unsafe fn GetImageBuffer(&self, _retval: *mut *mut u8) -> nsresult {
((*self.vtable).GetImageBuffer)(self, _retval)
}
}