Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Zeeshan Ali
gstreamer-rs
Commits
3ecd67ee
Commit
3ecd67ee
authored
Apr 04, 2018
by
Bo Du
Committed by
Sebastian Dröge
Apr 05, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Address PR comments and fix compilation errors
parent
36d538c0
Changes
19
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
636 additions
and
442 deletions
+636
-442
Gir_GstSdp.toml
Gir_GstSdp.toml
+16
-0
gstreamer-sdp/src/auto/m_i_k_e_y_message.rs
gstreamer-sdp/src/auto/m_i_k_e_y_message.rs
+0
-12
gstreamer-sdp/src/auto/m_i_k_e_y_payload.rs
gstreamer-sdp/src/auto/m_i_k_e_y_payload.rs
+0
-14
gstreamer-sdp/src/lib.rs
gstreamer-sdp/src/lib.rs
+2
-4
gstreamer-sdp/src/m_i_k_e_y_decrypt_info.rs
gstreamer-sdp/src/m_i_k_e_y_decrypt_info.rs
+0
-12
gstreamer-sdp/src/m_i_k_e_y_encrypt_info.rs
gstreamer-sdp/src/m_i_k_e_y_encrypt_info.rs
+0
-12
gstreamer-sdp/src/m_i_k_e_y_map_s_r_t_p.rs
gstreamer-sdp/src/m_i_k_e_y_map_s_r_t_p.rs
+1
-5
gstreamer-sdp/src/m_i_k_e_y_message.rs
gstreamer-sdp/src/m_i_k_e_y_message.rs
+20
-8
gstreamer-sdp/src/m_i_k_e_y_payload.rs
gstreamer-sdp/src/m_i_k_e_y_payload.rs
+26
-6
gstreamer-sdp/src/m_i_k_e_y_payload_s_p_param.rs
gstreamer-sdp/src/m_i_k_e_y_payload_s_p_param.rs
+30
-0
gstreamer-sdp/src/s_d_p_attribute.rs
gstreamer-sdp/src/s_d_p_attribute.rs
+15
-7
gstreamer-sdp/src/s_d_p_bandwidth.rs
gstreamer-sdp/src/s_d_p_bandwidth.rs
+12
-6
gstreamer-sdp/src/s_d_p_connection.rs
gstreamer-sdp/src/s_d_p_connection.rs
+18
-9
gstreamer-sdp/src/s_d_p_key.rs
gstreamer-sdp/src/s_d_p_key.rs
+7
-3
gstreamer-sdp/src/s_d_p_media.rs
gstreamer-sdp/src/s_d_p_media.rs
+177
-140
gstreamer-sdp/src/s_d_p_message.rs
gstreamer-sdp/src/s_d_p_message.rs
+248
-172
gstreamer-sdp/src/s_d_p_origin.rs
gstreamer-sdp/src/s_d_p_origin.rs
+20
-7
gstreamer-sdp/src/s_d_p_time.rs
gstreamer-sdp/src/s_d_p_time.rs
+26
-15
gstreamer-sdp/src/s_d_p_zone.rs
gstreamer-sdp/src/s_d_p_zone.rs
+18
-10
No files found.
Gir_GstSdp.toml
View file @
3ecd67ee
...
...
@@ -55,9 +55,25 @@ status = "generate"
name
=
"add_payload"
ignore
=
true
[[object.function]]
name
=
"get_payload"
ignore
=
true
[[object.function]]
name
=
"base64_encode"
ignore
=
true
[[object]]
name
=
"GstSdp.MIKEYPayload"
status
=
"generate"
[[object.function]]
name
=
"kemac_add_sub"
ignore
=
true
[[object.function]]
name
=
"kemac_get_sub"
ignore
=
true
[[object.function]]
name
=
"key_data_set_interval"
ignore
=
true
gstreamer-sdp/src/auto/m_i_k_e_y_message.rs
View file @
3ecd67ee
...
...
@@ -85,12 +85,6 @@ impl MIKEYMessage {
}
}
pub
fn
base64_encode
(
&
mut
self
)
->
Option
<
String
>
{
unsafe
{
from_glib_full
(
ffi
::
gst_mikey_message_base64_encode
(
self
.to_glib_none_mut
()
.0
))
}
}
pub
fn
find_payload
(
&
self
,
type_
:
MIKEYPayloadType
,
nth
:
u32
)
->
Option
<
MIKEYPayload
>
{
unsafe
{
from_glib_none
(
ffi
::
gst_mikey_message_find_payload
(
self
.to_glib_none
()
.0
,
type_
.to_glib
(),
nth
))
...
...
@@ -113,12 +107,6 @@ impl MIKEYMessage {
}
}
pub
fn
get_payload
(
&
self
,
idx
:
u32
)
->
Option
<
MIKEYPayload
>
{
unsafe
{
from_glib_none
(
ffi
::
gst_mikey_message_get_payload
(
self
.to_glib_none
()
.0
,
idx
))
}
}
//pub fn insert_cs_srtp(&mut self, idx: i32, map: /*Ignored*/&MIKEYMapSRTP) -> bool {
// unsafe { TODO: call ffi::gst_mikey_message_insert_cs_srtp() }
//}
...
...
gstreamer-sdp/src/auto/m_i_k_e_y_payload.rs
View file @
3ecd67ee
...
...
@@ -39,12 +39,6 @@ impl MIKEYPayload {
}
}
pub
fn
kemac_get_sub
(
&
self
,
idx
:
u32
)
->
Option
<
MIKEYPayload
>
{
unsafe
{
from_glib_none
(
ffi
::
gst_mikey_payload_kemac_get_sub
(
self
.to_glib_none
()
.0
,
idx
))
}
}
pub
fn
kemac_remove_sub
(
&
mut
self
,
idx
:
u32
)
->
bool
{
unsafe
{
from_glib
(
ffi
::
gst_mikey_payload_kemac_remove_sub
(
self
.to_glib_none_mut
()
.0
,
idx
))
...
...
@@ -57,14 +51,6 @@ impl MIKEYPayload {
}
}
pub
fn
key_data_set_interval
(
&
mut
self
,
vf_len
:
u8
,
vt_data
:
&
[
u8
])
->
bool
{
let
vf_data
=
vf_data
.len
()
as
Vec
<
u8
>
;
let
vt_len
=
vt_data
.len
()
as
u8
;
unsafe
{
from_glib
(
ffi
::
gst_mikey_payload_key_data_set_interval
(
self
.to_glib_none_mut
()
.0
,
vf_len
,
vf_data
.to_glib_none
()
.0
,
vt_len
,
vt_data
.to_glib_none
()
.0
))
}
}
pub
fn
key_data_set_key
(
&
mut
self
,
key_type
:
MIKEYKeyDataType
,
key_data
:
&
[
u8
])
->
bool
{
let
key_len
=
key_data
.len
()
as
u16
;
unsafe
{
...
...
gstreamer-sdp/src/lib.rs
View file @
3ecd67ee
...
...
@@ -9,6 +9,7 @@
extern
crate
bitflags
;
extern
crate
libc
;
#[macro_use]
extern
crate
glib
;
extern
crate
glib_sys
as
glib_ffi
;
extern
crate
gobject_sys
as
gobject_ffi
;
...
...
@@ -46,14 +47,11 @@ mod s_d_p_key;
mod
s_d_p_origin
;
mod
s_d_p_time
;
mod
s_d_p_zone
;
mod
m_i_k_e_y_message
;
mod
m_i_k_e_y_payload
;
mod
m_i_k_e_y_payload_s_p_param
;
mod
m_i_k_e_y_encrypt_info
;
mod
m_i_k_e_y_decrypt_info
;
mod
m_i_k_e_y_map_s_r_t_p
;
pub
use
s_d_p_message
::
SDPMessage
;
// Re-export all the traits in a prelude module, so that applications
// can always "use gst::prelude::*" without getting conflicts
pub
mod
prelude
{
...
...
gstreamer-sdp/src/m_i_k_e_y_decrypt_info.rs
View file @
3ecd67ee
...
...
@@ -6,18 +6,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use
std
::
mem
;
use
std
::
ptr
;
use
ffi
;
use
glib
::
translate
::
*
;
use
glib_ffi
;
use
libc
::
c_void
;
pub
struct
MIKEYDecryptInfo
(
ffi
::
GstMIKEYDecryptInfo
);
impl
MIKEYDecryptInfo
{
pub
fn
new
()
->
MIKEYDecryptInfo
{
MIKEYDecryptInfo
(
ffi
::
GstMIKEYDecryptInfo
(
ptr
::
null_mut
()
as
*
mut
c_void
))
}
}
gstreamer-sdp/src/m_i_k_e_y_encrypt_info.rs
View file @
3ecd67ee
...
...
@@ -6,18 +6,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use
std
::
mem
;
use
std
::
ptr
;
use
ffi
;
use
glib
::
translate
::
*
;
use
glib_ffi
;
use
libc
::
c_void
;
pub
struct
MIKEYEncryptInfo
(
ffi
::
GstMIKEYEncryptInfo
);
impl
MIKEYEncryptInfo
{
pub
fn
new
()
->
MIKEYEncryptInfo
{
MIKEYEncryptInfo
(
ffi
::
GstMIKEYEncryptInfo
(
ptr
::
null_mut
()
as
*
mut
c_void
))
}
}
gstreamer-sdp/src/m_i_k_e_y_map_s_r_t_p.rs
View file @
3ecd67ee
...
...
@@ -6,13 +6,9 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use
std
::
mem
;
use
std
::
ptr
;
use
ffi
;
use
glib
::
translate
::
*
;
use
glib_ffi
;
#[repr(C)]
pub
struct
MIKEYMapSRTP
(
ffi
::
GstMIKEYMapSRTP
);
impl
MIKEYMapSRTP
{
...
...
gstreamer-sdp/src/m_i_k_e_y_message.rs
View file @
3ecd67ee
...
...
@@ -25,22 +25,22 @@ use m_i_k_e_y_encrypt_info::MIKEYEncryptInfo;
use
m_i_k_e_y_map_s_r_t_p
::
MIKEYMapSRTP
;
impl
MIKEYMessage
{
pub
fn
new_from_bytes
(
bytes
:
glib
::
Bytes
,
info
:
MIKEYDecryptInfo
)
->
Result
<
MIKEYMessage
,
Error
>
{
pub
fn
new_from_bytes
<
'a
,
P
:
Into
<
Option
<&
'a
MIKEYDecryptInfo
>>>
(
bytes
:
&
glib
::
Bytes
,
info
:
P
)
->
Result
<
MIKEYMessage
,
Error
>
{
unsafe
{
let
mut
error
=
ptr
::
null_mut
();
let
ret
=
ffi
::
gst_mikey_message_new_from_bytes
(
bytes
.to_glib_
full
(),
info
.to_glib_full
(),
&
mut
error
);
let
ret
=
ffi
::
gst_mikey_message_new_from_bytes
(
bytes
.to_glib_
none
(),
info
.to_glib_full
(),
&
mut
error
);
mem
::
forget
(
bytes
);
mem
::
forget
(
info
);
if
error
.is_null
()
{
Ok
(
from_glib_full
(
ret
))
}
else
{
Err
(
from_glib_full
(
error
)
}
if
error
.is_null
()
{
Ok
(
from_glib_full
(
ret
))
}
else
{
Err
(
from_glib_full
(
error
)
)
}
}
}
pub
fn
new_from_data
(
data
:
&
[
u8
],
info
:
MIKEYDecryptInfo
)
->
Result
<
MIKEYMessage
,
Error
>
{
pub
fn
new_from_data
<
'a
,
P
:
Into
<
Option
<&
'a
MIKEYDecryptInfo
>>>
(
data
:
&
[
u8
],
info
:
P
)
->
Result
<
MIKEYMessage
,
Error
>
{
unsafe
{
let
mut
error
=
ptr
::
null_mut
();
let
ret
=
ffi
::
gst_mikey_message_new_from_data
(
data
.to_glib_none
()
.0
,
data
.len
(),
info
.to_glib_full
(),
&
mut
err
);
mem
::
forget
(
info
);
if
error
.is_null
()
{
Ok
(
from_glib_full
(
ret
))
}
else
{
Err
(
from_glib_full
(
error
)
}
if
error
.is_null
()
{
Ok
(
from_glib_full
(
ret
))
}
else
{
Err
(
from_glib_full
(
error
)
)
}
}
}
...
...
@@ -50,9 +50,9 @@ impl MIKEYMessage {
}
}
pub
fn
get_cs_srtp
(
&
self
,
idx
:
u32
)
->
Option
<
MIKEYMapSRTP
>
{
pub
fn
get_cs_srtp
(
&
self
,
idx
:
u32
)
->
Option
<
&
MIKEYMapSRTP
>
{
unsafe
{
from_glib_none
(
ffi
::
gst_mikey_message_get_cs_srtp
(
self
.to_glib_none
()
.0
,
idx
))
&*
(
from_glib_none
(
ffi
::
gst_mikey_message_get_cs_srtp
(
self
.to_glib_none
()
.0
,
idx
))
as
*
mut
MIKEYMapSRTP
)
}
}
...
...
@@ -64,9 +64,15 @@ impl MIKEYMessage {
}
}
pub
fn
get_payload
(
&
self
,
idx
:
u32
)
->
Option
<&
MIKEYPayload
>
{
unsafe
{
&*
(
from_glib_none
(
ffi
::
gst_mikey_message_get_payload
(
self
.to_glib_none
()
.0
,
idx
))
as
*
mut
MIKEYPayload
)
}
}
pub
fn
add_payload
(
&
mut
self
,
payload
:
MIKEYPayload
)
->
bool
{
unsafe
{
let
ret
=
from_glib
(
ffi
::
gst_mikey_message_add_payload
(
self
.to_glib_none_mut
()
.0
,
payload
.to_glib_full
()))
let
ret
=
from_glib
(
ffi
::
gst_mikey_message_add_payload
(
self
.to_glib_none_mut
()
.0
,
payload
.to_glib_full
()))
;
mem
::
forget
(
payload
);
ret
}
...
...
@@ -95,4 +101,10 @@ impl MIKEYMessage {
ret
}
}
pub
fn
base64_encode
(
&
self
)
->
Option
<
String
>
{
unsafe
{
from_glib_full
(
ffi
::
gst_mikey_message_base64_encode
(
self
.to_glib_none_mut
()
.0
))
}
}
}
gstreamer-sdp/src/m_i_k_e_y_payload.rs
View file @
3ecd67ee
...
...
@@ -15,6 +15,7 @@ use glib_ffi;
use
gobject_ffi
;
use
auto
::
MIKEYPayload
;
use
m_i_k_e_y_map_s_r_t_p
::
MIKEYPayloadSPParam
;
impl
MIKEYPayload
{
...
...
@@ -25,11 +26,30 @@ impl MIKEYPayload {
mem
::
forget
(
newpay
);
}
//pub fn sp_get_param(&self, idx: u32) -> /*Ignored*/Option<MIKEYPayloadSPParam> {
// unsafe { TODO: call ffi::gst_mikey_payload_sp_get_param() }
//}
pub
fn
kemac_get_sub
(
&
self
,
idx
:
u32
)
->
Option
<
MIKEYPayload
>
{
unsafe
{
&*
(
from_glib_none
(
ffi
::
gst_mikey_payload_kemac_get_sub
(
self
.to_glib_none
()
.0
,
idx
))
as
*
mut
MIKEYPayload
)
}
}
pub
fn
sp_get_param
(
&
self
,
idx
:
u32
)
->
Option
<&
MIKEYPayloadSPParam
>
{
unsafe
{
&*
(
from_glib_none
(
ffi
::
gst_mikey_payload_sp_get_param
(
self
.to_glib_none
()
.0
,
idx
))
as
*
mut
MIKEYPayloadSPParam
)
}
}
pub
fn
t_set
(
&
mut
self
,
type_
:
MIKEYTSType
,
ts_value
:
&
[
u8
])
->
bool
{
unsafe
{
from_glib
(
ffi
::
gst_mikey_payload_t_set
(
self
.to_glib_none_mut
()
.0
,
type_
.to_glib
(),
ts_value
.to_glib_none
()
.0
))
}
}
pub
fn
key_data_set_interval
(
&
mut
self
,
vf_data
:
&
[
u8
],
vt_data
:
&
[
u8
])
->
bool
{
let
vf_len
=
vf_data
.len
()
as
u8
;
let
vt_len
=
vt_data
.len
()
as
u8
;
unsafe
{
from_glib
(
ffi
::
gst_mikey_payload_key_data_set_interval
(
self
.to_glib_none_mut
()
.0
,
vf_len
,
vf_data
.to_glib_none
()
.0
,
vt_len
,
vt_data
.to_glib_none
()
.0
))
}
}
//pub fn t_set(&mut self, type_: MIKEYTSType, ts_value: &[u8]) -> bool {
// unsafe { TODO: call ffi::gst_mikey_payload_t_set() }
//}
}
gstreamer-sdp/src/m_i_k_e_y_payload_s_p_param.rs
0 → 100644
View file @
3ecd67ee
// Copyright (C) 2018 Sebastian Dröge <sebastian@centricular.com>
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use
std
::
slice
;
use
ffi
;
#[repr(C)]
pub
struct
MIKEYPayloadSPParam
(
ffi
::
GstMIKEYPayloadSPParam
);
impl
MIKEYPayloadSPParam
{
pub
fn
type_
(
&
self
)
->
u8
{
self
.0
.type_
}
pub
fn
len
(
&
self
)
->
u8
{
self
.0
.len
}
pub
fn
val
(
&
self
)
->
&
[
u8
]
{
unsafe
{
slice
::
from_raw_parts
(
self
.0
.val
as
*
const
u8
,
self
.0
.len
as
usize
)
}
}
}
gstreamer-sdp/src/s_d_p_attribute.rs
View file @
3ecd67ee
...
...
@@ -10,35 +10,43 @@ use std::mem;
use
std
::
ffi
::
CStr
;
use
ffi
;
use
glib
::
translate
::
*
;
use
auto
::
SDPResult
;
pub
struct
SDPAttribute
(
ffi
::
GstSDPAttribute
);
#[repr(C)]
pub
struct
SDPAttribute
(
pub
ffi
::
GstSDPAttribute
);
impl
SDPAttribute
{
pub
fn
new
(
key
:
&
str
,
value
:
&
str
)
->
Result
<
Self
,
SDPResult
>
{
pub
fn
new
(
key
:
&
str
,
value
:
&
str
)
->
Result
<
Self
,
()
>
{
assert_initialized_main_thread!
();
unsafe
{
let
mut
attr
=
mem
::
uninitializ
ed
();
let
mut
attr
=
mem
::
zero
ed
();
let
result
=
from_glib
(
ffi
::
gst_sdp_attribute_set
(
&
mut
attr
,
key
.to_glib_none
()
.0
,
value
.to_glib_none
()
.0
));
match
result
{
SDPResult
::
Ok
=>
Ok
(
SDPAttribute
(
attr
)),
_
=>
Err
(
result
),
_
=>
Err
(
()
),
}
}
}
pub
fn
key
(
&
self
)
->
&
str
{
CStr
::
from_ptr
(
self
.0
.key
)
.to_str
()
.unwrap
()
unsafe
{
CStr
::
from_ptr
(
self
.0
.key
)
.to_str
()
.unwrap
()
}
}
pub
fn
value
(
&
self
)
->
&
str
{
CStr
::
from_ptr
(
self
.0
.value
)
.to_str
()
.unwrap
()
unsafe
{
CStr
::
from_ptr
(
self
.0
.value
)
.to_str
()
.unwrap
()
}
}
}
impl
Drop
for
SDPAttribute
{
fn
drop
(
&
mut
self
)
{
ffi
::
gst_sdp_attribute_clear
(
self
.to_glib_none_mut
()
.0
);
unsafe
{
ffi
::
gst_sdp_attribute_clear
(
&
mut
self
.0
);
}
}
}
gstreamer-sdp/src/s_d_p_bandwidth.rs
View file @
3ecd67ee
...
...
@@ -10,26 +10,30 @@ use std::mem;
use
std
::
ffi
::
CStr
;
use
ffi
;
use
glib
::
translate
::
*
;
use
auto
::
SDPResult
;
pub
struct
SDPBandwidth
(
ffi
::
GstSDPBandwidth
);
#[repr(C)]
pub
struct
SDPBandwidth
(
pub
ffi
::
GstSDPBandwidth
);
impl
SDPBandwidth
{
pub
fn
new
(
bwtype
:
&
str
,
bandwidth
:
u32
)
->
Result
<
Self
,
SDPResult
>
{
pub
fn
new
(
bwtype
:
&
str
,
bandwidth
:
u32
)
->
Result
<
Self
,
()
>
{
assert_initialized_main_thread!
();
unsafe
{
let
mut
bw
=
mem
::
uninitializ
ed
();
let
mut
bw
=
mem
::
zero
ed
();
let
result
=
from_glib
(
ffi
::
gst_sdp_bandwidth_set
(
&
mut
bw
,
bwtype
.to_glib_none
()
.0
,
bandwidth
));
match
result
{
SDPResult
::
Ok
=>
Ok
(
SDPBandwidth
(
bw
)),
_
=>
Err
(
result
),
_
=>
Err
(
()
),
}
}
}
pub
fn
bwtype
(
&
self
)
->
&
str
{
CStr
::
from_ptr
(
self
.0
.bwtype
)
.to_str
()
.unwrap
()
unsafe
{
CStr
::
from_ptr
(
self
.0
.bwtype
)
.to_str
()
.unwrap
()
}
}
pub
fn
value
(
&
self
)
->
u32
{
...
...
@@ -39,6 +43,8 @@ impl SDPBandwidth {
impl
Drop
for
SDPBandwidth
{
fn
drop
(
&
mut
self
)
{
ffi
::
gst_sdp_bandwidth_clear
(
self
.to_glib_none_mut
()
.0
);
unsafe
{
ffi
::
gst_sdp_bandwidth_clear
(
&
mut
self
.0
);
}
}
}
gstreamer-sdp/src/s_d_p_connection.rs
View file @
3ecd67ee
...
...
@@ -10,17 +10,18 @@ use std::mem;
use
std
::
ffi
::
CStr
;
use
ffi
;
use
glib
::
translate
::
*
;
use
auto
::
SDPResult
;
pub
struct
SDPConnection
(
ffi
::
GstSDPConnection
);
#[repr(C)]
pub
struct
SDPConnection
(
pub
ffi
::
GstSDPConnection
);
impl
SDPConnection
{
pub
fn
new
(
nettype
:
&
str
,
addrtype
:
&
str
,
address
:
&
str
,
ttl
:
u32
,
addr_number
:
u32
)
->
Result
<
Self
,
SDPResult
>
{
pub
fn
new
(
nettype
:
&
str
,
addrtype
:
&
str
,
address
:
&
str
,
ttl
:
u32
,
addr_number
:
u32
)
->
Result
<
Self
,
()
>
{
assert_initialized_main_thread!
();
unsafe
{
let
mut
conn
=
mem
::
uninitializ
ed
();
let
mut
conn
=
mem
::
zero
ed
();
let
result
=
from_glib
(
ffi
::
gst_sdp_connection_set
(
&
mut
conn
,
nettype
.to_glib_none
()
.0
,
...
...
@@ -31,21 +32,27 @@ impl SDPConnection {
));
match
result
{
SDPResult
::
Ok
=>
Ok
(
SDPConnection
(
conn
)),
_
=>
Err
(
result
),
_
=>
Err
(
()
),
}
}
}
pub
fn
nettype
(
&
self
)
->
&
str
{
CStr
::
from_ptr
(
self
.0
.nettype
)
.to_str
()
.unwrap
()
unsafe
{
CStr
::
from_ptr
(
self
.0
.nettype
)
.to_str
()
.unwrap
()
}
}
pub
fn
addrtype
(
&
self
)
->
&
str
{
CStr
::
from_ptr
(
self
.0
.addrtype
)
.to_str
()
.unwrap
()
unsafe
{
CStr
::
from_ptr
(
self
.0
.addrtype
)
.to_str
()
.unwrap
()
}
}
pub
fn
address
(
&
self
)
->
&
str
{
CStr
::
from_ptr
(
self
.0
.address
)
.to_str
()
.unwrap
()
unsafe
{
CStr
::
from_ptr
(
self
.0
.address
)
.to_str
()
.unwrap
()
}
}
pub
fn
ttl
(
&
self
)
->
u32
{
...
...
@@ -59,6 +66,8 @@ impl SDPConnection {
impl
Drop
for
SDPConnection
{
fn
drop
(
&
mut
self
)
{
ffi
::
gst_sdp_connection_clear
(
self
.to_glib_none_mut
()
.0
);
unsafe
{
ffi
::
gst_sdp_connection_clear
(
&
mut
self
.0
);
}
}
}
gstreamer-sdp/src/s_d_p_key.rs
View file @
3ecd67ee
...
...
@@ -13,11 +13,15 @@ use ffi;
pub
struct
SDPKey
(
ffi
::
GstSDPKey
);
impl
SDPKey
{
pub
fn
type
(
&
self
)
->
&
str
{
CStr
::
from_ptr
(
self
.0
.type_
)
.to_str
()
.unwrap
()
pub
fn
type_
(
&
self
)
->
&
str
{
unsafe
{
CStr
::
from_ptr
(
self
.0
.type_
)
.to_str
()
.unwrap
()
}
}
pub
fn
data
(
&
self
)
->
&
str
{
CStr
::
from_ptr
(
self
.0
.data
)
.to_str
()
.unwrap
()
unsafe
{
CStr
::
from_ptr
(
self
.0
.data
)
.to_str
()
.unwrap
()
}
}
}
gstreamer-sdp/src/s_d_p_media.rs
View file @
3ecd67ee
This diff is collapsed.
Click to expand it.
gstreamer-sdp/src/s_d_p_message.rs
View file @
3ecd67ee
This diff is collapsed.
Click to expand it.
gstreamer-sdp/src/s_d_p_origin.rs
View file @
3ecd67ee
...
...
@@ -10,30 +10,43 @@ use std::ffi::CStr;
use
ffi
;
pub
struct
SDPOrigin
(
ffi
::
GstSDPOrigin
);
#[repr(C)]
pub
struct
SDPOrigin
(
pub
ffi
::
GstSDPOrigin
);
impl
SDPOrigin
{
pub
fn
username
(
&
self
)
->
&
str
{
CStr
::
from_ptr
(
self
.0
.username
)
.to_str
()
.unwrap
()
unsafe
{
CStr
::
from_ptr
(
self
.0
.username
)
.to_str
()
.unwrap
()
}
}
pub
fn
sess_id
(
&
self
)
->
&
str
{
CStr
::
from_ptr
(
self
.0
.sess_id
)
.to_str
()
.unwrap
()
unsafe
{
CStr
::
from_ptr
(
self
.0
.sess_id
)
.to_str
()
.unwrap
()
}
}
pub
fn
sess_version
(
&
self
)
->
&
str
{
CStr
::
from_ptr
(
self
.0
.sess_version
)
.to_str
()
.unwrap
()
unsafe
{
CStr
::
from_ptr
(
self
.0
.sess_version
)
.to_str
()
.unwrap
()
}
}
pub
fn
nettype
(
&
self
)
->
&
str
{
CStr
::
from_ptr
(
self
.0
.nettype
)
.to_str
()
.unwrap
()
unsafe
{
CStr
::
from_ptr
(
self
.0
.nettype
)
.to_str
()
.unwrap
()
}
}
pub
fn
addrtype
(
&
self
)
->
&
str
{
CStr
::
from_ptr
(
self
.0
.addrtype
)
.to_str
()
.unwrap
()
unsafe
{
CStr
::
from_ptr
(
self
.0
.addrtype
)
.to_str
()
.unwrap
()
}
}
pub
fn
addr
(
&
self
)
->
&
str
{
CStr
::
from_ptr
(
self
.0
.addr
)
.to_str
()
.unwrap
()
unsafe
{
CStr
::
from_ptr
(
self
.0
.addr
)
.to_str
()
.unwrap
()
}
}
}
gstreamer-sdp/src/s_d_p_time.rs
View file @
3ecd67ee
...
...
@@ -7,20 +7,23 @@
// except according to those terms.
use
std
::
mem
;
use
std
::
ffi
:
CStr
;
use
std
::
os
::
raw
::
c_char
;
use
std
::
ffi
::
CStr
;
use
ffi
;
use
glib
::
translate
::
*
;
use
auto
::
SDPResult
;
pub
struct
SDPTime
(
ffi
::
GstSDPTime
);
#[repr(C)]
pub
struct
SDPTime
(
pub
ffi
::
GstSDPTime
);
impl
SDPTime
{
pub
fn
new
(
start
:
&
str
,
stop
:
&
str
,
repeat
:
&
[
&
str
])
->
Result
<
Self
,
SDPResult
>
{
pub
fn
new
(
start
:
&
str
,
stop
:
&
str
,
repeat
:
&
[
&
str
])
->
Result
<
Self
,
()
>
{
assert_initialized_main_thread!
();
unsafe
{
let
mut
time
=
mem
::
uninitializ
ed
();
let
result
=
from_glib
(
ffi
::
gst_sdp_time_set
(
let
mut
time
=
mem
::
zero
ed
();
let
result
=
from_glib
(
ffi
::
gst_sdp_time_set
(
&
mut
time
,
start
.to_glib_none
()
.0
,
stop
.to_glib_none
()
.0
,
...
...
@@ -28,32 +31,40 @@ impl SDPTime {
));
match
result
{
SDPResult
::
Ok
=>
Ok
(
SDPTime
(
time
)),
_
=>
Err
(
result
),
_
=>
Err
(
()
),
}
}
}
pub
fn
start
(
&
self
)
->
&
str
{
CStr
::
from_ptr
(
self
.0
.start
)
.to_str
()
.unwrap
()
unsafe
{
CStr
::
from_ptr
(
self
.0
.start
)
.to_str
()
.unwrap
()
}
}
pub
fn
stop
(
&
self
)
->
&
str
{
CStr
::
from_ptr
(
self
.0
.stop
)
.to_str
()
.unwrap
()
unsafe
{
CStr
::
from_ptr
(
self
.0
.stop
)
.to_str
()
.unwrap
()
}
}
pub
fn
repeat
(
&
self
)
->
Vec
<&
str
>
{
let
arr
=
(
*
self
.0
.repeat
)
.data
as
*
const
*
const
c_char
;
let
len
=
(
*
self
.0
.repeat
)
.len
as
usize
;
let
vec
=
Vec
::
with_capacity
(
len
);
for
i
in
0
..
len
{
vec
.push
(
CStr
::
from_ptr
(
arr
.offset
(
i
))
.to_str
()
.unwrap
());
unsafe
{