Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Zeeshan Ali
gstreamer-rs
Commits
b08a101c
Commit
b08a101c
authored
Aug 02, 2017
by
Sebastian Dröge
🍵
Browse files
Fix clippy warnings in the examples
parent
d7baadee
Changes
4
Hide whitespace changes
Inline
Side-by-side
examples/src/bin/appsink.rs
View file @
b08a101c
...
...
@@ -3,9 +3,6 @@ use gst::*;
extern
crate
gstreamer_app
as
gst_app
;
use
gst_app
::
*
;
extern
crate
glib
;
use
glib
::
*
;
use
std
::
u64
;
use
std
::
i16
;
use
std
::
i32
;
...
...
@@ -24,10 +21,10 @@ fn main() {
appsink
.set_caps
(
&
Caps
::
new_simple
(
"audio/x-raw"
,
&
[
(
&
"format"
,
&
"S16BE"
),
(
&
"layout"
,
&
"interleaved"
),
(
&
"channels"
,
&
(
1i32
)),
(
&
"rate"
,
&
IntRange
::
<
i32
>
::
new
(
1
,
i32
::
MAX
)),
(
"format"
,
&
"S16BE"
),
(
"layout"
,
&
"interleaved"
),
(
"channels"
,
&
(
1i32
)),
(
"rate"
,
&
IntRange
::
<
i32
>
::
new
(
1
,
i32
::
MAX
)),
],
));
...
...
examples/src/bin/appsrc.rs
View file @
b08a101c
...
...
@@ -3,9 +3,6 @@ use gst::*;
extern
crate
gstreamer_app
as
gst_app
;
use
gst_app
::
*
;
extern
crate
glib
;
use
glib
::
*
;
use
std
::
u64
;
use
std
::
thread
;
...
...
@@ -27,10 +24,10 @@ fn main() {
appsrc
.set_caps
(
&
Caps
::
new_simple
(
"video/x-raw"
,
&
[
(
&
"format"
,
&
"BGRx"
),
(
&
"width"
,
&
(
WIDTH
as
i32
)),
(
&
"height"
,
&
(
HEIGHT
as
i32
)),
(
&
"framerate"
,
&
Fraction
::
new
(
2
,
1
)),
(
"format"
,
&
"BGRx"
),
(
"width"
,
&
(
WIDTH
as
i32
)),
(
"height"
,
&
(
HEIGHT
as
i32
)),
(
"framerate"
,
&
Fraction
::
new
(
2
,
1
)),
],
));
appsrc
.set_property_format
(
Format
::
Time
);
...
...
examples/src/bin/decodebin.rs
View file @
b08a101c
...
...
@@ -29,7 +29,7 @@ fn main() {
// Need to move a new reference into the closure
let
pipeline_clone
=
pipeline
.clone
();
decodebin
.connect_pad_added
(
move
|
_
,
src_pad
|
{
let
ref
pipeline
=
pipeline_clone
;
let
pipeline
=
&
pipeline_clone
;
let
(
is_audio
,
is_video
)
=
{
let
caps
=
src_pad
.get_current_caps
()
.unwrap
();
...
...
examples/src/bin/pad_probes.rs
View file @
b08a101c
...
...
@@ -20,21 +20,18 @@ fn main() {
.unwrap
();
let
src_pad
=
src
.get_static_pad
(
"src"
)
.unwrap
();
src_pad
.add_probe
(
PAD_PROBE_TYPE_BUFFER
,
|
_
,
probe_info
|
{
match
probe_info
.data
{
Some
(
PadProbeData
::
Buffer
(
ref
buffer
))
=>
{
let
map
=
buffer
.map_read
()
.unwrap
();
let
data
=
map
.as_slice
();
let
sum
:
f64
=
data
.chunks
(
2
)
.map
(|
sample
|
{
let
u
:
u16
=
((
sample
[
0
]
as
u16
)
<<
8
)
|
(
sample
[
1
]
as
u16
);
let
f
=
(
u
as
i16
as
f64
)
/
(
i16
::
MAX
as
f64
);
f
*
f
})
.sum
();
let
rms
=
(
sum
/
((
data
.len
()
/
2
)
as
f64
))
.sqrt
();
println!
(
"rms: {}"
,
rms
);
}
_
=>
(),
if
let
Some
(
PadProbeData
::
Buffer
(
ref
buffer
))
=
probe_info
.data
{
let
map
=
buffer
.map_read
()
.unwrap
();
let
data
=
map
.as_slice
();
let
sum
:
f64
=
data
.chunks
(
2
)
.map
(|
sample
|
{
let
u
:
u16
=
((
sample
[
0
]
as
u16
)
<<
8
)
|
(
sample
[
1
]
as
u16
);
let
f
=
(
u
as
i16
as
f64
)
/
(
i16
::
MAX
as
f64
);
f
*
f
})
.sum
();
let
rms
=
(
sum
/
((
data
.len
()
/
2
)
as
f64
))
.sqrt
();
println!
(
"rms: {}"
,
rms
);
}
PadProbeReturn
::
Ok
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment