mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-25 11:01:10 +00:00
Add initial version of gstreamer-check
Covers GstHarness and GstTestClock Fixes https://github.com/sdroege/gstreamer-rs/issues/148
This commit is contained in:
parent
be8f29c9f7
commit
2a2ffa45c9
12 changed files with 865 additions and 332 deletions
|
@ -13,6 +13,7 @@ members = [
|
|||
"gstreamer-video",
|
||||
"gstreamer-pbutils",
|
||||
"gstreamer-webrtc",
|
||||
"gstreamer-check",
|
||||
"examples",
|
||||
"tutorials",
|
||||
]
|
||||
|
|
|
@ -16,7 +16,6 @@ external_libraries = [
|
|||
]
|
||||
|
||||
generate = [
|
||||
"GstCheck.TestClock",
|
||||
]
|
||||
|
||||
manual = [
|
||||
|
@ -31,3 +30,8 @@ manual = [
|
|||
name = "Gst.ClockTime"
|
||||
status = "manual"
|
||||
conversion_type = "scalar"
|
||||
|
||||
[[object]]
|
||||
name = "GstCheck.TestClock"
|
||||
status = "generate"
|
||||
trait = false
|
||||
|
|
39
gstreamer-check/Cargo.toml
Normal file
39
gstreamer-check/Cargo.toml
Normal file
|
@ -0,0 +1,39 @@
|
|||
[package]
|
||||
name = "gstreamer-check"
|
||||
version = "0.13.0"
|
||||
authors = ["Sebastian Dröge <sebastian@centricular.com>"]
|
||||
categories = ["api-bindings", "multimedia"]
|
||||
description = "Rust bindings for GStreamer Check library"
|
||||
repository = "https://github.com/sdroege/gstreamer-rs"
|
||||
license = "MIT/Apache-2.0"
|
||||
readme = "README.md"
|
||||
homepage = "https://gstreamer.freedesktop.org"
|
||||
documentation = "https://sdroege.github.io/rustdoc/gstreamer/gstreamer_check"
|
||||
keywords = ["gstreamer", "multimedia", "audio", "video", "gnome"]
|
||||
build = "build.rs"
|
||||
|
||||
[dependencies]
|
||||
bitflags = "1.0"
|
||||
glib-sys = { git = "https://github.com/gtk-rs/sys" }
|
||||
gobject-sys = { git = "https://github.com/gtk-rs/sys" }
|
||||
gstreamer-sys = { git = "https://github.com/sdroege/gstreamer-sys", features = ["v1_8"] }
|
||||
gstreamer-check-sys = { git = "https://github.com/sdroege/gstreamer-sys", features = ["v1_8"] }
|
||||
glib = { git = "https://github.com/gtk-rs/glib" }
|
||||
gstreamer = { path = "../gstreamer" }
|
||||
|
||||
[build-dependencies.rustdoc-stripper]
|
||||
version = "0.1"
|
||||
optional = true
|
||||
|
||||
[features]
|
||||
v1_10 = ["gstreamer-sys/v1_10", "gstreamer-check-sys/v1_10"]
|
||||
v1_12 = ["gstreamer-sys/v1_12", "gstreamer-check-sys/v1_12", "v1_10"]
|
||||
v1_14 = ["gstreamer-sys/v1_14", "gstreamer-check-sys/v1_14", "v1_12"]
|
||||
#v1_16 = ["gstreamer-sys/v1_16", "gstreamer-check-sys/v1_16", "v1_14"]
|
||||
embed-lgpl-docs = ["rustdoc-stripper"]
|
||||
purge-lgpl-docs = ["rustdoc-stripper"]
|
||||
dox = ["gstreamer-check-sys/dox", "glib/dox", "gstreamer/dox"]
|
||||
default-features = []
|
||||
|
||||
[badges]
|
||||
travis-ci = { repository = "sdroege/gstreamer-rs", branch = "master" }
|
201
gstreamer-check/LICENSE-APACHE
Normal file
201
gstreamer-check/LICENSE-APACHE
Normal file
|
@ -0,0 +1,201 @@
|
|||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
23
gstreamer-check/LICENSE-MIT
Normal file
23
gstreamer-check/LICENSE-MIT
Normal file
|
@ -0,0 +1,23 @@
|
|||
Permission is hereby granted, free of charge, to any
|
||||
person obtaining a copy of this software and associated
|
||||
documentation files (the "Software"), to deal in the
|
||||
Software without restriction, including without
|
||||
limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software
|
||||
is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice
|
||||
shall be included in all copies or substantial portions
|
||||
of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
|
||||
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
||||
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
|
||||
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
||||
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
170
gstreamer-check/README.md
Normal file
170
gstreamer-check/README.md
Normal file
|
@ -0,0 +1,170 @@
|
|||
# gstreamer-rs [![crates.io](https://img.shields.io/crates/v/gstreamer-app.svg)](https://crates.io/crates/gstreamer-app) [![Build Status](https://travis-ci.org/sdroege/gstreamer-rs.svg?branch=master)](https://travis-ci.org/sdroege/gstreamer-rs)
|
||||
|
||||
[GStreamer](https://gstreamer.freedesktop.org/) (Check library) bindings for Rust.
|
||||
Documentation can be found [here](https://sdroege.github.io/rustdoc/gstreamer/gstreamer/).
|
||||
|
||||
These bindings are providing a safe API that can be used to interface with
|
||||
GStreamer, e.g. for writing GStreamer-based applications.
|
||||
|
||||
For background and motivation, see the [announcement blogpost](https://coaxion.net/blog/2017/07/writing-gstreamer-applications-in-rust/).
|
||||
|
||||
The bindings (since 0.8.0) are autogenerated with [gir](https://github.com/gtk-rs/gir/)
|
||||
based on the [GObject-Introspection](https://wiki.gnome.org/Projects/GObjectIntrospection/)
|
||||
API metadata provided by the GStreamer project. Older versions before 0.8.0 were manually
|
||||
written and the repository can be found [here](https://github.com/arturoc/gstreamer1.0-rs).
|
||||
The API of the two is incompatible.
|
||||
|
||||
A crate for writing GStreamer plugins in Rust can be found here: https://github.com/sdroege/gst-plugin-rs
|
||||
|
||||
## Table of Contents
|
||||
1. [Installation](#installation)
|
||||
1. [Linux/BSDs](#installation-linux)
|
||||
1. [macOS](#installation-macos)
|
||||
1. [Windows](#installation-windows)
|
||||
1. [Getting Started](#getting-started)
|
||||
1. [License](#license)
|
||||
1. [Contribution](#contribution)
|
||||
|
||||
<a name="installation"/>
|
||||
|
||||
## Installation
|
||||
|
||||
To build the GStreamer bindings or anything depending on them, you need to
|
||||
have at least GStreamer 1.8 and gst-plugins-base 1.8 installed. In addition,
|
||||
some of the examples/tutorials require various GStreamer plugins to be
|
||||
available, which can be found in gst-plugins-base, gst-plugins-good,
|
||||
gst-plugins-bad, gst-plugins-ugly and/or gst-libav.
|
||||
|
||||
<a name="installation-linux"/>
|
||||
|
||||
### Linux/BSDs
|
||||
|
||||
You need to install the above mentioned packages with your distributions
|
||||
package manager, or build them from source.
|
||||
|
||||
On Debian/Ubuntu they can be installed with
|
||||
|
||||
```
|
||||
$ apt-get install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev \
|
||||
gstreamer1.0-plugins-base gstreamer1.0-plugins-good \
|
||||
gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly \
|
||||
gstreamer1.0-libav
|
||||
```
|
||||
|
||||
Package names on other distributions should be similar.
|
||||
Please submit a pull request with instructions for yours.
|
||||
|
||||
<a name="installation-macos"/>
|
||||
|
||||
### macOS
|
||||
|
||||
You can install GStreamer and the plugins via [Homebrew](https://brew.sh/) or
|
||||
by installing the [binaries](https://gstreamer.freedesktop.org/data/pkg/osx/)
|
||||
provided by the GStreamer project.
|
||||
|
||||
#### Homebrew
|
||||
|
||||
```
|
||||
$ brew install gstreamer gst-plugins-base gst-plugins-good \
|
||||
gst-plugins-bad gst-plugins-ugly gst-libav
|
||||
```
|
||||
|
||||
#### GStreamer Binaries
|
||||
|
||||
You need to download the *two* `.pkg` files from the GStreamer website and
|
||||
install them, e.g. `gstreamer-1.0-1.12.3-x86_64.pkg` and
|
||||
`gstreamer-1.0-devel-1.12.3-x86_64.pkg`.
|
||||
|
||||
After installation, you also need to install `pkg-config` (e.g. via Homebrew)
|
||||
and set the `PKG_CONFIG_PATH` environment variable
|
||||
|
||||
```
|
||||
$ export PKG_CONFIG_PATH="/Frameworks/GStreamer.framework/Versions/Current/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
|
||||
```
|
||||
|
||||
<a name="installation-windows"/>
|
||||
|
||||
### Windows
|
||||
|
||||
You can install GStreamer and the plugins via [MSYS2](http://www.msys2.org/)
|
||||
with `pacman` or by installing the
|
||||
[binaries](https://gstreamer.freedesktop.org/data/pkg/windows/) provided by
|
||||
the GStreamer project.
|
||||
|
||||
#### MSYS2 / pacman
|
||||
|
||||
```
|
||||
$ pacman -S pkg-config mingw-w64-x86_64-gstreamer mingw-w64-x86_64-gst-plugins-base \
|
||||
mingw-w64-x86_64-gst-plugins-good mingw-w64-x86_64-gst-plugins-bad \
|
||||
mingw-w64-x86_64-gst-plugins-ugly mingw-w64-x86_64-gst-libav
|
||||
```
|
||||
|
||||
#### GStreamer Binaries
|
||||
|
||||
You need to download the *two* `.msi` files for your platform from the
|
||||
GStreamer website and install them, e.g. `gstreamer-1.0-x86_64-1.12.3.msi` and
|
||||
`gstreamer-1.0-devel-x86_64-1.12.3.msi`.
|
||||
|
||||
After installation, you also need to install `pkg-config` (e.g. via MSYS2 or
|
||||
from [here](https://sourceforge.net/projects/pkgconfiglite/))
|
||||
and set the `PKG_CONFIG_PATH` environment variable
|
||||
|
||||
```
|
||||
$ export PKG_CONFIG_PATH="c:\\gstreamer\\1.0\\x86_64\\lib\\pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
|
||||
```
|
||||
|
||||
<a name="getting-started"/>
|
||||
|
||||
## Getting Started
|
||||
|
||||
The API reference can be found
|
||||
[here](https://sdroege.github.io/rustdoc/gstreamer/gstreamer/), however it is
|
||||
only the Rust API reference and does not explain any of the concepts.
|
||||
|
||||
For getting started with GStreamer development, the best would be to follow
|
||||
the [documentation](https://gstreamer.freedesktop.org/documentation/) on the
|
||||
GStreamer website, especially the [Application Development
|
||||
Manual](https://gstreamer.freedesktop.org/documentation/application-development/).
|
||||
While being C-centric, it explains all the fundamental concepts of GStreamer
|
||||
and the code examples should be relatively easily translatable to Rust. The
|
||||
API is basically the same, function/struct names are the same and everything
|
||||
is only more convenient (hopefully) and safer.
|
||||
|
||||
In addition there are
|
||||
[tutorials](https://gstreamer.freedesktop.org/documentation/tutorials/) on the
|
||||
GStreamer website. Many of them were ported to Rust already and the code can
|
||||
be found in the
|
||||
[tutorials](https://github.com/sdroege/gstreamer-rs/tree/master/tutorials)
|
||||
directory.
|
||||
|
||||
Some further examples for various aspects of GStreamer and how to use it from
|
||||
Rust can be found in the
|
||||
[examples](https://github.com/sdroege/gstreamer-rs/tree/master/examples)
|
||||
directory.
|
||||
|
||||
<a name="license"/>
|
||||
|
||||
## LICENSE
|
||||
|
||||
gstreamer-rs and all crates contained in here are licensed under either of
|
||||
|
||||
* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
||||
http://www.apache.org/licenses/LICENSE-2.0)
|
||||
* MIT license ([LICENSE-MIT](LICENSE-MIT) or
|
||||
http://opensource.org/licenses/MIT)
|
||||
|
||||
at your option.
|
||||
|
||||
GStreamer itself is licensed under the Lesser General Public License version
|
||||
2.1 or (at your option) any later version:
|
||||
https://www.gnu.org/licenses/lgpl-2.1.html
|
||||
|
||||
<a name="contribution"/>
|
||||
|
||||
## Contribution
|
||||
|
||||
Any kinds of contributions are welcome as a pull request.
|
||||
|
||||
Unless you explicitly state otherwise, any contribution intentionally submitted
|
||||
for inclusion in gstreamer-rs by you, as defined in the Apache-2.0 license, shall be
|
||||
dual licensed as above, without any additional terms or conditions.
|
34
gstreamer-check/build.rs
Normal file
34
gstreamer-check/build.rs
Normal file
|
@ -0,0 +1,34 @@
|
|||
fn main() {
|
||||
manage_docs();
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "embed-lgpl-docs", feature = "purge-lgpl-docs"))]
|
||||
fn manage_docs() {
|
||||
extern crate stripper_lib;
|
||||
use std::io;
|
||||
|
||||
let path = "src";
|
||||
let ignores: &[&str] = &[];
|
||||
|
||||
stripper_lib::loop_over_files(
|
||||
path.as_ref(),
|
||||
&mut |w, s| stripper_lib::strip_comments(w, s, &mut io::sink(), true),
|
||||
&ignores,
|
||||
false,
|
||||
);
|
||||
|
||||
#[cfg(feature = "embed-lgpl-docs")]
|
||||
{
|
||||
let docs = include_str!("../docs/gstreamer-check/docs.md");
|
||||
let mut infos = stripper_lib::parse_cmts(docs.lines(), true);
|
||||
stripper_lib::loop_over_files(
|
||||
path.as_ref(),
|
||||
&mut |w, s| stripper_lib::regenerate_comments(w, s, &mut infos, true, true),
|
||||
&ignores,
|
||||
false,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(any(feature = "embed-lgpl-docs", feature = "purge-lgpl-docs")))]
|
||||
fn manage_docs() {}
|
|
@ -4,9 +4,7 @@
|
|||
|
||||
mod test_clock;
|
||||
pub use self::test_clock::TestClock;
|
||||
pub use self::test_clock::TestClockExt;
|
||||
|
||||
#[doc(hidden)]
|
||||
pub mod traits {
|
||||
pub use super::TestClockExt;
|
||||
}
|
||||
|
|
|
@ -3,11 +3,9 @@
|
|||
// DO NOT EDIT
|
||||
|
||||
use ffi;
|
||||
use glib;
|
||||
use glib::StaticType;
|
||||
use glib::Value;
|
||||
use glib::object::Downcast;
|
||||
use glib::object::IsA;
|
||||
use glib::signal::SignalHandlerId;
|
||||
use glib::signal::connect;
|
||||
use glib::translate::*;
|
||||
|
@ -46,9 +44,99 @@ impl TestClock {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn advance_time(&self, delta: gst::ClockTimeDiff) {
|
||||
unsafe {
|
||||
ffi::gst_test_clock_advance_time(self.to_glib_none().0, delta);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn crank(&self) -> bool {
|
||||
unsafe {
|
||||
from_glib(ffi::gst_test_clock_crank(self.to_glib_none().0))
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_next_entry_time(&self) -> gst::ClockTime {
|
||||
unsafe {
|
||||
from_glib(ffi::gst_test_clock_get_next_entry_time(self.to_glib_none().0))
|
||||
}
|
||||
}
|
||||
|
||||
//pub fn has_id(&self, id: /*Ignored*/gst::ClockID) -> bool {
|
||||
// unsafe { TODO: call ffi::gst_test_clock_has_id() }
|
||||
//}
|
||||
|
||||
pub fn peek_id_count(&self) -> u32 {
|
||||
unsafe {
|
||||
ffi::gst_test_clock_peek_id_count(self.to_glib_none().0)
|
||||
}
|
||||
}
|
||||
|
||||
//pub fn peek_next_pending_id(&self, pending_id: /*Ignored*/&mut gst::ClockID) -> bool {
|
||||
// unsafe { TODO: call ffi::gst_test_clock_peek_next_pending_id() }
|
||||
//}
|
||||
|
||||
//pub fn process_id_list(&self, pending_list: /*Ignored*/&[&gst::ClockID]) -> u32 {
|
||||
// unsafe { TODO: call ffi::gst_test_clock_process_id_list() }
|
||||
//}
|
||||
|
||||
//pub fn process_next_clock_id(&self) -> /*Ignored*/Option<gst::ClockID> {
|
||||
// unsafe { TODO: call ffi::gst_test_clock_process_next_clock_id() }
|
||||
//}
|
||||
|
||||
pub fn set_time(&self, new_time: gst::ClockTime) {
|
||||
unsafe {
|
||||
ffi::gst_test_clock_set_time(self.to_glib_none().0, new_time.to_glib());
|
||||
}
|
||||
}
|
||||
|
||||
//pub fn wait_for_multiple_pending_ids(&self, count: u32, pending_list: /*Unimplemented*/Vec<gst::ClockID>) {
|
||||
// unsafe { TODO: call ffi::gst_test_clock_wait_for_multiple_pending_ids() }
|
||||
//}
|
||||
|
||||
//pub fn wait_for_next_pending_id(&self, pending_id: /*Ignored*/&mut gst::ClockID) {
|
||||
// unsafe { TODO: call ffi::gst_test_clock_wait_for_next_pending_id() }
|
||||
//}
|
||||
|
||||
pub fn wait_for_pending_id_count(&self, count: u32) {
|
||||
unsafe {
|
||||
ffi::gst_test_clock_wait_for_pending_id_count(self.to_glib_none().0, count);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_property_clock_type(&self) -> gst::ClockType {
|
||||
unsafe {
|
||||
let mut value = Value::from_type(<gst::ClockType as StaticType>::static_type());
|
||||
gobject_ffi::g_object_get_property(self.to_glib_none().0, "clock-type".to_glib_none().0, value.to_glib_none_mut().0);
|
||||
value.get().unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_property_clock_type(&self, clock_type: gst::ClockType) {
|
||||
unsafe {
|
||||
gobject_ffi::g_object_set_property(self.to_glib_none().0, "clock-type".to_glib_none().0, Value::from(&clock_type).to_glib_none().0);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_property_start_time(&self) -> u64 {
|
||||
unsafe {
|
||||
let mut value = Value::from_type(<u64 as StaticType>::static_type());
|
||||
gobject_ffi::g_object_get_property(self.to_glib_none().0, "start-time".to_glib_none().0, value.to_glib_none_mut().0);
|
||||
value.get().unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
//pub fn id_list_get_latest_time(pending_list: /*Ignored*/&[&gst::ClockID]) -> gst::ClockTime {
|
||||
// unsafe { TODO: call ffi::gst_test_clock_id_list_get_latest_time() }
|
||||
//}
|
||||
|
||||
pub fn connect_property_clock_type_notify<F: Fn(&TestClock) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
|
||||
unsafe {
|
||||
let f: Box_<Box_<Fn(&TestClock) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
|
||||
connect(self.to_glib_none().0, "notify::clock-type",
|
||||
transmute(notify_clock_type_trampoline as usize), Box_::into_raw(f) as *mut _)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for TestClock {
|
||||
|
@ -60,134 +148,7 @@ impl Default for TestClock {
|
|||
unsafe impl Send for TestClock {}
|
||||
unsafe impl Sync for TestClock {}
|
||||
|
||||
pub trait TestClockExt {
|
||||
fn advance_time(&self, delta: gst::ClockTimeDiff);
|
||||
|
||||
fn crank(&self) -> bool;
|
||||
|
||||
fn get_next_entry_time(&self) -> gst::ClockTime;
|
||||
|
||||
//fn has_id(&self, id: /*Ignored*/gst::ClockID) -> bool;
|
||||
|
||||
fn peek_id_count(&self) -> u32;
|
||||
|
||||
//fn peek_next_pending_id(&self, pending_id: /*Ignored*/&mut gst::ClockID) -> bool;
|
||||
|
||||
//fn process_id_list(&self, pending_list: /*Ignored*/&[&gst::ClockID]) -> u32;
|
||||
|
||||
//fn process_next_clock_id(&self) -> /*Ignored*/Option<gst::ClockID>;
|
||||
|
||||
fn set_time(&self, new_time: gst::ClockTime);
|
||||
|
||||
//fn wait_for_multiple_pending_ids(&self, count: u32, pending_list: /*Unimplemented*/Vec<gst::ClockID>);
|
||||
|
||||
//fn wait_for_next_pending_id(&self, pending_id: /*Ignored*/&mut gst::ClockID);
|
||||
|
||||
fn wait_for_pending_id_count(&self, count: u32);
|
||||
|
||||
fn get_property_clock_type(&self) -> gst::ClockType;
|
||||
|
||||
fn set_property_clock_type(&self, clock_type: gst::ClockType);
|
||||
|
||||
fn get_property_start_time(&self) -> u64;
|
||||
|
||||
fn connect_property_clock_type_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
|
||||
}
|
||||
|
||||
impl<O: IsA<TestClock> + IsA<glib::object::Object>> TestClockExt for O {
|
||||
fn advance_time(&self, delta: gst::ClockTimeDiff) {
|
||||
unsafe {
|
||||
ffi::gst_test_clock_advance_time(self.to_glib_none().0, delta);
|
||||
}
|
||||
}
|
||||
|
||||
fn crank(&self) -> bool {
|
||||
unsafe {
|
||||
from_glib(ffi::gst_test_clock_crank(self.to_glib_none().0))
|
||||
}
|
||||
}
|
||||
|
||||
fn get_next_entry_time(&self) -> gst::ClockTime {
|
||||
unsafe {
|
||||
from_glib(ffi::gst_test_clock_get_next_entry_time(self.to_glib_none().0))
|
||||
}
|
||||
}
|
||||
|
||||
//fn has_id(&self, id: /*Ignored*/gst::ClockID) -> bool {
|
||||
// unsafe { TODO: call ffi::gst_test_clock_has_id() }
|
||||
//}
|
||||
|
||||
fn peek_id_count(&self) -> u32 {
|
||||
unsafe {
|
||||
ffi::gst_test_clock_peek_id_count(self.to_glib_none().0)
|
||||
}
|
||||
}
|
||||
|
||||
//fn peek_next_pending_id(&self, pending_id: /*Ignored*/&mut gst::ClockID) -> bool {
|
||||
// unsafe { TODO: call ffi::gst_test_clock_peek_next_pending_id() }
|
||||
//}
|
||||
|
||||
//fn process_id_list(&self, pending_list: /*Ignored*/&[&gst::ClockID]) -> u32 {
|
||||
// unsafe { TODO: call ffi::gst_test_clock_process_id_list() }
|
||||
//}
|
||||
|
||||
//fn process_next_clock_id(&self) -> /*Ignored*/Option<gst::ClockID> {
|
||||
// unsafe { TODO: call ffi::gst_test_clock_process_next_clock_id() }
|
||||
//}
|
||||
|
||||
fn set_time(&self, new_time: gst::ClockTime) {
|
||||
unsafe {
|
||||
ffi::gst_test_clock_set_time(self.to_glib_none().0, new_time.to_glib());
|
||||
}
|
||||
}
|
||||
|
||||
//fn wait_for_multiple_pending_ids(&self, count: u32, pending_list: /*Unimplemented*/Vec<gst::ClockID>) {
|
||||
// unsafe { TODO: call ffi::gst_test_clock_wait_for_multiple_pending_ids() }
|
||||
//}
|
||||
|
||||
//fn wait_for_next_pending_id(&self, pending_id: /*Ignored*/&mut gst::ClockID) {
|
||||
// unsafe { TODO: call ffi::gst_test_clock_wait_for_next_pending_id() }
|
||||
//}
|
||||
|
||||
fn wait_for_pending_id_count(&self, count: u32) {
|
||||
unsafe {
|
||||
ffi::gst_test_clock_wait_for_pending_id_count(self.to_glib_none().0, count);
|
||||
}
|
||||
}
|
||||
|
||||
fn get_property_clock_type(&self) -> gst::ClockType {
|
||||
unsafe {
|
||||
let mut value = Value::from_type(<gst::ClockType as StaticType>::static_type());
|
||||
gobject_ffi::g_object_get_property(self.to_glib_none().0, "clock-type".to_glib_none().0, value.to_glib_none_mut().0);
|
||||
value.get().unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
fn set_property_clock_type(&self, clock_type: gst::ClockType) {
|
||||
unsafe {
|
||||
gobject_ffi::g_object_set_property(self.to_glib_none().0, "clock-type".to_glib_none().0, Value::from(&clock_type).to_glib_none().0);
|
||||
}
|
||||
}
|
||||
|
||||
fn get_property_start_time(&self) -> u64 {
|
||||
unsafe {
|
||||
let mut value = Value::from_type(<u64 as StaticType>::static_type());
|
||||
gobject_ffi::g_object_get_property(self.to_glib_none().0, "start-time".to_glib_none().0, value.to_glib_none_mut().0);
|
||||
value.get().unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
fn connect_property_clock_type_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
|
||||
unsafe {
|
||||
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
|
||||
connect(self.to_glib_none().0, "notify::clock-type",
|
||||
transmute(notify_clock_type_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unsafe extern "C" fn notify_clock_type_trampoline<P>(this: *mut ffi::GstTestClock, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
|
||||
where P: IsA<TestClock> {
|
||||
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
|
||||
f(&TestClock::from_glib_borrow(this).downcast_unchecked())
|
||||
unsafe extern "C" fn notify_clock_type_trampoline(this: *mut ffi::GstTestClock, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) {
|
||||
let f: &&(Fn(&TestClock) + Send + Sync + 'static) = transmute(f);
|
||||
f(&from_glib_borrow(this))
|
||||
}
|
||||
|
|
|
@ -1,28 +1,36 @@
|
|||
// This file was generated by gir (https://github.com/gtk-rs/gir)
|
||||
// from gir-files (https://github.com/gtk-rs/gir-files)
|
||||
// DO NOT EDIT
|
||||
// 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 ffi;
|
||||
#[cfg(any(feature = "v1_14", feature = "dox"))]
|
||||
use glib;
|
||||
use glib::object::IsA;
|
||||
use glib::translate::*;
|
||||
use glib_ffi;
|
||||
use gst;
|
||||
use gst::prelude::*;
|
||||
use std::marker::PhantomData;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
use TestClock;
|
||||
|
||||
glib_wrapper! {
|
||||
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||
pub struct Harness(Boxed<ffi::GstHarness>);
|
||||
#[derive(Debug)]
|
||||
pub struct Harness(ptr::NonNull<ffi::GstHarness>, PhantomData<ffi::GstHarness>);
|
||||
|
||||
match fn {
|
||||
copy => |ptr| ffi::gst_harness_copy(mut_override(ptr)),
|
||||
free => |ptr| ffi::gst_harness_free(ptr),
|
||||
impl Drop for Harness {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
ffi::gst_harness_teardown(self.0.as_ptr());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unsafe impl Send for Harness {}
|
||||
|
||||
impl Harness {
|
||||
pub fn add_element_full<
|
||||
'a,
|
||||
|
@ -50,11 +58,11 @@ impl Harness {
|
|||
let element_srcpad_name = element_srcpad_name.to_glib_none();
|
||||
unsafe {
|
||||
ffi::gst_harness_add_element_full(
|
||||
self.to_glib_none_mut().0,
|
||||
self.0.as_ptr(),
|
||||
element.to_glib_none().0,
|
||||
hsrc.to_glib_none_mut().0,
|
||||
hsrc.to_glib_none().0 as *mut _,
|
||||
element_sinkpad_name.0,
|
||||
hsink.to_glib_none_mut().0,
|
||||
hsink.to_glib_none().0 as *mut _,
|
||||
element_srcpad_name.0,
|
||||
);
|
||||
}
|
||||
|
@ -62,155 +70,152 @@ impl Harness {
|
|||
|
||||
pub fn add_element_sink_pad<P: IsA<gst::Pad>>(&mut self, sinkpad: &P) {
|
||||
unsafe {
|
||||
ffi::gst_harness_add_element_sink_pad(
|
||||
self.to_glib_none_mut().0,
|
||||
sinkpad.to_glib_none().0,
|
||||
);
|
||||
ffi::gst_harness_add_element_sink_pad(self.0.as_ptr(), sinkpad.to_glib_none().0);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn add_element_src_pad<P: IsA<gst::Pad>>(&mut self, srcpad: &P) {
|
||||
unsafe {
|
||||
ffi::gst_harness_add_element_src_pad(
|
||||
self.to_glib_none_mut().0,
|
||||
srcpad.to_glib_none().0,
|
||||
);
|
||||
ffi::gst_harness_add_element_src_pad(self.0.as_ptr(), srcpad.to_glib_none().0);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn add_parse(&mut self, launchline: &str) {
|
||||
unsafe {
|
||||
ffi::gst_harness_add_parse(self.to_glib_none_mut().0, launchline.to_glib_none().0);
|
||||
ffi::gst_harness_add_parse(self.0.as_ptr(), launchline.to_glib_none().0);
|
||||
}
|
||||
}
|
||||
|
||||
//pub fn add_probe(&mut self, element_name: &str, pad_name: &str, mask: /*Ignored*/gst::PadProbeType, callback: /*Unknown conversion*//*Unimplemented*/PadProbeCallback, destroy_data: /*Unknown conversion*//*Unimplemented*/DestroyNotify) {
|
||||
// unsafe { TODO: call ffi::gst_harness_add_probe() }
|
||||
//}
|
||||
pub fn add_probe<F>(
|
||||
&mut self,
|
||||
element_name: &str,
|
||||
pad_name: &str,
|
||||
mask: gst::PadProbeType,
|
||||
func: F,
|
||||
) where
|
||||
F: Fn(&gst::Pad, &mut gst::PadProbeInfo) -> gst::PadProbeReturn + Send + Sync + 'static,
|
||||
{
|
||||
// Reimplementation of the C code so we don't have to duplicate all the callback code
|
||||
|
||||
let element = self.find_element(element_name).expect("Element not found");
|
||||
let pad = element.get_static_pad(pad_name).expect("Pad not found");
|
||||
pad.add_probe(mask, func);
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "v1_16", feature = "dox"))]
|
||||
pub fn add_propose_allocation_meta<'a, P: Into<Option<&'a gst::Structure>>>(
|
||||
pub fn add_propose_allocation_meta<'a, P: Into<Option<&'a gst::StructureRef>>>(
|
||||
&mut self,
|
||||
api: glib::types::Type,
|
||||
params: P,
|
||||
) {
|
||||
let params = params.into();
|
||||
let params = params.to_glib_none();
|
||||
let params = params.map(|p| p.as_ptr()).unwrap_or(ptr::null_mut());
|
||||
unsafe {
|
||||
ffi::gst_harness_add_propose_allocation_meta(
|
||||
self.to_glib_none_mut().0,
|
||||
api.to_glib(),
|
||||
params.0,
|
||||
);
|
||||
ffi::gst_harness_add_propose_allocation_meta(self.0.as_ptr(), api.to_glib(), params);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn add_sink(&mut self, sink_element_name: &str) {
|
||||
unsafe {
|
||||
ffi::gst_harness_add_sink(
|
||||
self.to_glib_none_mut().0,
|
||||
sink_element_name.to_glib_none().0,
|
||||
);
|
||||
ffi::gst_harness_add_sink(self.0.as_ptr(), sink_element_name.to_glib_none().0);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn add_sink_harness(&mut self, sink_harness: &mut Harness) {
|
||||
pub fn add_sink_harness(&mut self, sink_harness: Harness) {
|
||||
unsafe {
|
||||
ffi::gst_harness_add_sink_harness(
|
||||
self.to_glib_none_mut().0,
|
||||
sink_harness.to_glib_full(),
|
||||
);
|
||||
ffi::gst_harness_add_sink_harness(self.0.as_ptr(), sink_harness.0.as_ptr());
|
||||
|
||||
mem::forget(sink_harness);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn add_sink_parse(&mut self, launchline: &str) {
|
||||
unsafe {
|
||||
ffi::gst_harness_add_sink_parse(self.to_glib_none_mut().0, launchline.to_glib_none().0);
|
||||
ffi::gst_harness_add_sink_parse(self.0.as_ptr(), launchline.to_glib_none().0);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn add_src(&mut self, src_element_name: &str, has_clock_wait: bool) {
|
||||
unsafe {
|
||||
ffi::gst_harness_add_src(
|
||||
self.to_glib_none_mut().0,
|
||||
self.0.as_ptr(),
|
||||
src_element_name.to_glib_none().0,
|
||||
has_clock_wait.to_glib(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn add_src_harness(&mut self, src_harness: &mut Harness, has_clock_wait: bool) {
|
||||
pub fn add_src_harness(&mut self, src_harness: Harness, has_clock_wait: bool) {
|
||||
unsafe {
|
||||
ffi::gst_harness_add_src_harness(
|
||||
self.to_glib_none_mut().0,
|
||||
src_harness.to_glib_full(),
|
||||
self.0.as_ptr(),
|
||||
src_harness.0.as_ptr(),
|
||||
has_clock_wait.to_glib(),
|
||||
);
|
||||
|
||||
mem::forget(src_harness);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn add_src_parse(&mut self, launchline: &str, has_clock_wait: bool) {
|
||||
unsafe {
|
||||
ffi::gst_harness_add_src_parse(
|
||||
self.to_glib_none_mut().0,
|
||||
self.0.as_ptr(),
|
||||
launchline.to_glib_none().0,
|
||||
has_clock_wait.to_glib(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn buffers_in_queue(&mut self) -> u32 {
|
||||
unsafe { ffi::gst_harness_buffers_in_queue(self.to_glib_none_mut().0) }
|
||||
pub fn buffers_in_queue(&self) -> u32 {
|
||||
unsafe { ffi::gst_harness_buffers_in_queue(self.0.as_ptr()) }
|
||||
}
|
||||
|
||||
pub fn buffers_received(&mut self) -> u32 {
|
||||
unsafe { ffi::gst_harness_buffers_received(self.to_glib_none_mut().0) }
|
||||
pub fn buffers_received(&self) -> u32 {
|
||||
unsafe { ffi::gst_harness_buffers_received(self.0.as_ptr()) }
|
||||
}
|
||||
|
||||
pub fn crank_multiple_clock_waits(&mut self, waits: u32) -> bool {
|
||||
pub fn crank_multiple_clock_waits(&mut self, waits: u32) -> Result<(), glib::BoolError> {
|
||||
unsafe {
|
||||
from_glib(ffi::gst_harness_crank_multiple_clock_waits(
|
||||
self.to_glib_none_mut().0,
|
||||
waits,
|
||||
))
|
||||
glib::error::BoolError::from_glib(
|
||||
ffi::gst_harness_crank_multiple_clock_waits(self.0.as_ptr(), waits),
|
||||
"Failed to crank multiple clock waits",
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn crank_single_clock_wait(&mut self) -> bool {
|
||||
pub fn crank_single_clock_wait(&mut self) -> Result<(), glib::BoolError> {
|
||||
unsafe {
|
||||
from_glib(ffi::gst_harness_crank_single_clock_wait(
|
||||
self.to_glib_none_mut().0,
|
||||
))
|
||||
glib::error::BoolError::from_glib(
|
||||
ffi::gst_harness_crank_single_clock_wait(self.0.as_ptr()),
|
||||
"Failed to crank single clock wait",
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn create_buffer(&mut self, size: usize) -> Option<gst::Buffer> {
|
||||
unsafe { from_glib_full(ffi::gst_harness_create_buffer(self.0.as_ptr(), size)) }
|
||||
}
|
||||
|
||||
pub fn dump_to_file<P: AsRef<std::path::Path>>(&mut self, filename: P) {
|
||||
let filename = filename.as_ref();
|
||||
unsafe {
|
||||
from_glib_full(ffi::gst_harness_create_buffer(
|
||||
self.to_glib_none_mut().0,
|
||||
size,
|
||||
))
|
||||
ffi::gst_harness_dump_to_file(self.0.as_ptr(), filename.to_glib_none().0);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn dump_to_file(&mut self, filename: &str) {
|
||||
unsafe {
|
||||
ffi::gst_harness_dump_to_file(self.to_glib_none_mut().0, filename.to_glib_none().0);
|
||||
}
|
||||
pub fn events_in_queue(&self) -> u32 {
|
||||
unsafe { ffi::gst_harness_events_in_queue(self.0.as_ptr()) }
|
||||
}
|
||||
|
||||
pub fn events_in_queue(&mut self) -> u32 {
|
||||
unsafe { ffi::gst_harness_events_in_queue(self.to_glib_none_mut().0) }
|
||||
}
|
||||
|
||||
pub fn events_received(&mut self) -> u32 {
|
||||
unsafe { ffi::gst_harness_events_received(self.to_glib_none_mut().0) }
|
||||
pub fn events_received(&self) -> u32 {
|
||||
unsafe { ffi::gst_harness_events_received(self.0.as_ptr()) }
|
||||
}
|
||||
|
||||
pub fn find_element(&mut self, element_name: &str) -> Option<gst::Element> {
|
||||
unsafe {
|
||||
from_glib_full(ffi::gst_harness_find_element(
|
||||
self.to_glib_none_mut().0,
|
||||
self.0.as_ptr(),
|
||||
element_name.to_glib_none().0,
|
||||
))
|
||||
}
|
||||
|
@ -224,82 +229,73 @@ impl Harness {
|
|||
// unsafe { TODO: call ffi::gst_harness_get_allocator() }
|
||||
//}
|
||||
|
||||
pub fn get_last_pushed_timestamp(&mut self) -> gst::ClockTime {
|
||||
unsafe { ffi::gst_harness_get_last_pushed_timestamp(self.to_glib_none_mut().0) }
|
||||
pub fn get_last_pushed_timestamp(&self) -> gst::ClockTime {
|
||||
unsafe { from_glib(ffi::gst_harness_get_last_pushed_timestamp(self.0.as_ptr())) }
|
||||
}
|
||||
|
||||
pub fn get_testclock(&mut self) -> Option<TestClock> {
|
||||
unsafe { from_glib_full(ffi::gst_harness_get_testclock(self.to_glib_none_mut().0)) }
|
||||
pub fn get_testclock(&self) -> Option<TestClock> {
|
||||
unsafe { from_glib_full(ffi::gst_harness_get_testclock(self.0.as_ptr())) }
|
||||
}
|
||||
|
||||
pub fn play(&mut self) {
|
||||
unsafe {
|
||||
ffi::gst_harness_play(self.to_glib_none_mut().0);
|
||||
ffi::gst_harness_play(self.0.as_ptr());
|
||||
}
|
||||
}
|
||||
|
||||
pub fn pull(&mut self) -> Option<gst::Buffer> {
|
||||
unsafe { from_glib_full(ffi::gst_harness_pull(self.to_glib_none_mut().0)) }
|
||||
unsafe { from_glib_full(ffi::gst_harness_pull(self.0.as_ptr())) }
|
||||
}
|
||||
|
||||
pub fn pull_event(&mut self) -> Option<gst::Event> {
|
||||
unsafe { from_glib_full(ffi::gst_harness_pull_event(self.to_glib_none_mut().0)) }
|
||||
unsafe { from_glib_full(ffi::gst_harness_pull_event(self.0.as_ptr())) }
|
||||
}
|
||||
|
||||
pub fn pull_upstream_event(&mut self) -> Option<gst::Event> {
|
||||
unsafe {
|
||||
from_glib_full(ffi::gst_harness_pull_upstream_event(
|
||||
self.to_glib_none_mut().0,
|
||||
))
|
||||
}
|
||||
unsafe { from_glib_full(ffi::gst_harness_pull_upstream_event(self.0.as_ptr())) }
|
||||
}
|
||||
|
||||
pub fn push(&mut self, buffer: &mut gst::Buffer) -> gst::FlowReturn {
|
||||
unsafe {
|
||||
from_glib(ffi::gst_harness_push(
|
||||
self.to_glib_none_mut().0,
|
||||
buffer.to_glib_full(),
|
||||
))
|
||||
}
|
||||
pub fn push(&mut self, buffer: gst::Buffer) -> gst::FlowReturn {
|
||||
unsafe { from_glib(ffi::gst_harness_push(self.0.as_ptr(), buffer.into_ptr())) }
|
||||
}
|
||||
|
||||
pub fn push_and_pull(&mut self, buffer: &mut gst::Buffer) -> Option<gst::Buffer> {
|
||||
pub fn push_and_pull(&mut self, buffer: gst::Buffer) -> Option<gst::Buffer> {
|
||||
unsafe {
|
||||
from_glib_full(ffi::gst_harness_push_and_pull(
|
||||
self.to_glib_none_mut().0,
|
||||
buffer.to_glib_full(),
|
||||
self.0.as_ptr(),
|
||||
buffer.into_ptr(),
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
pub fn push_event(&mut self, event: &mut gst::Event) -> bool {
|
||||
pub fn push_event(&mut self, event: gst::Event) -> bool {
|
||||
unsafe {
|
||||
from_glib(ffi::gst_harness_push_event(
|
||||
self.to_glib_none_mut().0,
|
||||
event.to_glib_none_mut().0,
|
||||
self.0.as_ptr(),
|
||||
event.into_ptr(),
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
pub fn push_from_src(&mut self) -> gst::FlowReturn {
|
||||
unsafe { from_glib(ffi::gst_harness_push_from_src(self.to_glib_none_mut().0)) }
|
||||
unsafe { from_glib(ffi::gst_harness_push_from_src(self.0.as_ptr())) }
|
||||
}
|
||||
|
||||
pub fn push_to_sink(&mut self) -> gst::FlowReturn {
|
||||
unsafe { from_glib(ffi::gst_harness_push_to_sink(self.to_glib_none_mut().0)) }
|
||||
unsafe { from_glib(ffi::gst_harness_push_to_sink(self.0.as_ptr())) }
|
||||
}
|
||||
|
||||
pub fn push_upstream_event(&mut self, event: &mut gst::Event) -> bool {
|
||||
pub fn push_upstream_event(&mut self, event: gst::Event) -> bool {
|
||||
unsafe {
|
||||
from_glib(ffi::gst_harness_push_upstream_event(
|
||||
self.to_glib_none_mut().0,
|
||||
event.to_glib_none_mut().0,
|
||||
self.0.as_ptr(),
|
||||
event.into_ptr(),
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
pub fn query_latency(&mut self) -> gst::ClockTime {
|
||||
unsafe { ffi::gst_harness_query_latency(self.to_glib_none_mut().0) }
|
||||
pub fn query_latency(&self) -> gst::ClockTime {
|
||||
unsafe { from_glib(ffi::gst_harness_query_latency(self.0.as_ptr())) }
|
||||
}
|
||||
|
||||
//pub fn set(&mut self, element_name: &str, first_property_name: &str, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) {
|
||||
|
@ -308,24 +304,20 @@ impl Harness {
|
|||
|
||||
pub fn set_blocking_push_mode(&mut self) {
|
||||
unsafe {
|
||||
ffi::gst_harness_set_blocking_push_mode(self.to_glib_none_mut().0);
|
||||
ffi::gst_harness_set_blocking_push_mode(self.0.as_ptr());
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_caps(&mut self, in_: &mut gst::Caps, out: &mut gst::Caps) {
|
||||
pub fn set_caps(&mut self, in_: gst::Caps, out: gst::Caps) {
|
||||
unsafe {
|
||||
ffi::gst_harness_set_caps(
|
||||
self.to_glib_none_mut().0,
|
||||
in_.to_glib_full(),
|
||||
out.to_glib_full(),
|
||||
);
|
||||
ffi::gst_harness_set_caps(self.0.as_ptr(), in_.into_ptr(), out.into_ptr());
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_caps_str(&mut self, in_: &str, out: &str) {
|
||||
unsafe {
|
||||
ffi::gst_harness_set_caps_str(
|
||||
self.to_glib_none_mut().0,
|
||||
self.0.as_ptr(),
|
||||
in_.to_glib_none().0,
|
||||
out.to_glib_none().0,
|
||||
);
|
||||
|
@ -334,13 +326,13 @@ impl Harness {
|
|||
|
||||
pub fn set_drop_buffers(&mut self, drop_buffers: bool) {
|
||||
unsafe {
|
||||
ffi::gst_harness_set_drop_buffers(self.to_glib_none_mut().0, drop_buffers.to_glib());
|
||||
ffi::gst_harness_set_drop_buffers(self.0.as_ptr(), drop_buffers.to_glib());
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_forwarding(&mut self, forwarding: bool) {
|
||||
unsafe {
|
||||
ffi::gst_harness_set_forwarding(self.to_glib_none_mut().0, forwarding.to_glib());
|
||||
ffi::gst_harness_set_forwarding(self.0.as_ptr(), forwarding.to_glib());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -348,61 +340,66 @@ impl Harness {
|
|||
// unsafe { TODO: call ffi::gst_harness_set_propose_allocator() }
|
||||
//}
|
||||
|
||||
pub fn set_sink_caps(&mut self, caps: &mut gst::Caps) {
|
||||
pub fn set_sink_caps(&mut self, caps: gst::Caps) {
|
||||
unsafe {
|
||||
ffi::gst_harness_set_sink_caps(self.to_glib_none_mut().0, caps.to_glib_full());
|
||||
ffi::gst_harness_set_sink_caps(self.0.as_ptr(), caps.into_ptr());
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_sink_caps_str(&mut self, str: &str) {
|
||||
unsafe {
|
||||
ffi::gst_harness_set_sink_caps_str(self.to_glib_none_mut().0, str.to_glib_none().0);
|
||||
ffi::gst_harness_set_sink_caps_str(self.0.as_ptr(), str.to_glib_none().0);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_src_caps(&mut self, caps: &mut gst::Caps) {
|
||||
pub fn set_src_caps(&mut self, caps: gst::Caps) {
|
||||
unsafe {
|
||||
ffi::gst_harness_set_src_caps(self.to_glib_none_mut().0, caps.to_glib_full());
|
||||
ffi::gst_harness_set_src_caps(self.0.as_ptr(), caps.into_ptr());
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_src_caps_str(&mut self, str: &str) {
|
||||
unsafe {
|
||||
ffi::gst_harness_set_src_caps_str(self.to_glib_none_mut().0, str.to_glib_none().0);
|
||||
ffi::gst_harness_set_src_caps_str(self.0.as_ptr(), str.to_glib_none().0);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_time(&mut self, time: gst::ClockTime) -> bool {
|
||||
unsafe { from_glib(ffi::gst_harness_set_time(self.to_glib_none_mut().0, time)) }
|
||||
pub fn set_time(&mut self, time: gst::ClockTime) -> Result<(), glib::BoolError> {
|
||||
unsafe {
|
||||
glib::error::BoolError::from_glib(
|
||||
ffi::gst_harness_set_time(self.0.as_ptr(), time.to_glib()),
|
||||
"Failed to set time",
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_upstream_latency(&mut self, latency: gst::ClockTime) {
|
||||
unsafe {
|
||||
ffi::gst_harness_set_upstream_latency(self.to_glib_none_mut().0, latency);
|
||||
ffi::gst_harness_set_upstream_latency(self.0.as_ptr(), latency.to_glib());
|
||||
}
|
||||
}
|
||||
|
||||
pub fn sink_push_many(&mut self, pushes: i32) -> gst::FlowReturn {
|
||||
pub fn sink_push_many(&mut self, pushes: u32) -> gst::FlowReturn {
|
||||
unsafe {
|
||||
from_glib(ffi::gst_harness_sink_push_many(
|
||||
self.to_glib_none_mut().0,
|
||||
pushes,
|
||||
self.0.as_ptr(),
|
||||
pushes as i32,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
pub fn src_crank_and_push_many(&mut self, cranks: i32, pushes: i32) -> gst::FlowReturn {
|
||||
pub fn src_crank_and_push_many(&mut self, cranks: u32, pushes: u32) -> gst::FlowReturn {
|
||||
unsafe {
|
||||
from_glib(ffi::gst_harness_src_crank_and_push_many(
|
||||
self.to_glib_none_mut().0,
|
||||
cranks,
|
||||
pushes,
|
||||
self.0.as_ptr(),
|
||||
cranks as i32,
|
||||
pushes as i32,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
pub fn src_push_event(&mut self) -> bool {
|
||||
unsafe { from_glib(ffi::gst_harness_src_push_event(self.to_glib_none_mut().0)) }
|
||||
unsafe { from_glib(ffi::gst_harness_src_push_event(self.0.as_ptr())) }
|
||||
}
|
||||
|
||||
//pub fn stress_custom_start<'a, P: Into<Option<&'a /*Ignored*/glib::Func>>, Q: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&mut self, init: P, callback: /*Unknown conversion*//*Unimplemented*/Func, data: Q, sleep: libc::c_ulong) -> /*Ignored*/Option<HarnessThread> {
|
||||
|
@ -445,93 +442,75 @@ impl Harness {
|
|||
// unsafe { TODO: call ffi::gst_harness_stress_statechange_start_full() }
|
||||
//}
|
||||
|
||||
#[cfg(any(feature = "v1_14", feature = "dox"))]
|
||||
pub fn take_all_data(&mut self) -> (u8, usize) {
|
||||
unsafe {
|
||||
let mut size = mem::uninitialized();
|
||||
let ret = ffi::gst_harness_take_all_data(self.to_glib_none_mut().0, &mut size);
|
||||
(ret, size)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "v1_14", feature = "dox"))]
|
||||
pub fn take_all_data_as_buffer(&mut self) -> Option<gst::Buffer> {
|
||||
unsafe {
|
||||
from_glib_full(ffi::gst_harness_take_all_data_as_buffer(
|
||||
self.to_glib_none_mut().0,
|
||||
))
|
||||
}
|
||||
unsafe { from_glib_full(ffi::gst_harness_take_all_data_as_buffer(self.0.as_ptr())) }
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "v1_14", feature = "dox"))]
|
||||
pub fn take_all_data_as_bytes(&mut self) -> Option<glib::Bytes> {
|
||||
unsafe {
|
||||
from_glib_full(ffi::gst_harness_take_all_data_as_bytes(
|
||||
self.to_glib_none_mut().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
pub fn teardown(&mut self) {
|
||||
unsafe {
|
||||
ffi::gst_harness_teardown(self.to_glib_none_mut().0);
|
||||
}
|
||||
unsafe { from_glib_full(ffi::gst_harness_take_all_data_as_bytes(self.0.as_ptr())) }
|
||||
}
|
||||
|
||||
pub fn try_pull(&mut self) -> Option<gst::Buffer> {
|
||||
unsafe { from_glib_full(ffi::gst_harness_try_pull(self.to_glib_none_mut().0)) }
|
||||
unsafe { from_glib_full(ffi::gst_harness_try_pull(self.0.as_ptr())) }
|
||||
}
|
||||
|
||||
pub fn try_pull_event(&mut self) -> Option<gst::Event> {
|
||||
unsafe { from_glib_full(ffi::gst_harness_try_pull_event(self.to_glib_none_mut().0)) }
|
||||
unsafe { from_glib_full(ffi::gst_harness_try_pull_event(self.0.as_ptr())) }
|
||||
}
|
||||
|
||||
pub fn try_pull_upstream_event(&mut self) -> Option<gst::Event> {
|
||||
unsafe {
|
||||
from_glib_full(ffi::gst_harness_try_pull_upstream_event(
|
||||
self.to_glib_none_mut().0,
|
||||
))
|
||||
}
|
||||
unsafe { from_glib_full(ffi::gst_harness_try_pull_upstream_event(self.0.as_ptr())) }
|
||||
}
|
||||
|
||||
pub fn upstream_events_in_queue(&mut self) -> u32 {
|
||||
unsafe { ffi::gst_harness_upstream_events_in_queue(self.to_glib_none_mut().0) }
|
||||
pub fn upstream_events_in_queue(&self) -> u32 {
|
||||
unsafe { ffi::gst_harness_upstream_events_in_queue(self.0.as_ptr()) }
|
||||
}
|
||||
|
||||
pub fn upstream_events_received(&mut self) -> u32 {
|
||||
unsafe { ffi::gst_harness_upstream_events_received(self.to_glib_none_mut().0) }
|
||||
pub fn upstream_events_received(&self) -> u32 {
|
||||
unsafe { ffi::gst_harness_upstream_events_received(self.0.as_ptr()) }
|
||||
}
|
||||
|
||||
pub fn use_systemclock(&mut self) {
|
||||
unsafe {
|
||||
ffi::gst_harness_use_systemclock(self.to_glib_none_mut().0);
|
||||
ffi::gst_harness_use_systemclock(self.0.as_ptr());
|
||||
}
|
||||
}
|
||||
|
||||
pub fn use_testclock(&mut self) {
|
||||
unsafe {
|
||||
ffi::gst_harness_use_testclock(self.to_glib_none_mut().0);
|
||||
ffi::gst_harness_use_testclock(self.0.as_ptr());
|
||||
}
|
||||
}
|
||||
|
||||
pub fn wait_for_clock_id_waits(&mut self, waits: u32, timeout: u32) -> bool {
|
||||
pub fn wait_for_clock_id_waits(
|
||||
&mut self,
|
||||
waits: u32,
|
||||
timeout: u32,
|
||||
) -> Result<(), glib::BoolError> {
|
||||
unsafe {
|
||||
from_glib(ffi::gst_harness_wait_for_clock_id_waits(
|
||||
self.to_glib_none_mut().0,
|
||||
waits,
|
||||
timeout,
|
||||
))
|
||||
glib::error::BoolError::from_glib(
|
||||
ffi::gst_harness_wait_for_clock_id_waits(self.0.as_ptr(), waits, timeout),
|
||||
"Failed to wait for clock id waits",
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn new(element_name: &str) -> Option<Harness> {
|
||||
assert_initialized_main_thread!();
|
||||
unsafe { from_glib_full(ffi::gst_harness_new(element_name.to_glib_none().0)) }
|
||||
unsafe fn from_glib_full(ptr: *mut ffi::GstHarness) -> Harness {
|
||||
assert!(!ptr.is_null());
|
||||
|
||||
Harness(ptr::NonNull::new_unchecked(ptr), PhantomData)
|
||||
}
|
||||
|
||||
pub fn new_empty() -> Option<Harness> {
|
||||
pub fn new(element_name: &str) -> Harness {
|
||||
assert_initialized_main_thread!();
|
||||
unsafe { from_glib_full(ffi::gst_harness_new_empty()) }
|
||||
unsafe { Self::from_glib_full(ffi::gst_harness_new(element_name.to_glib_none().0)) }
|
||||
}
|
||||
|
||||
pub fn new_empty() -> Harness {
|
||||
assert_initialized_main_thread!();
|
||||
unsafe { Self::from_glib_full(ffi::gst_harness_new_empty()) }
|
||||
}
|
||||
|
||||
pub fn new_full<
|
||||
|
@ -550,7 +529,7 @@ impl Harness {
|
|||
element_sinkpad_name: R,
|
||||
hsink: S,
|
||||
element_srcpad_name: T,
|
||||
) -> Option<Harness> {
|
||||
) -> Harness {
|
||||
assert_initialized_main_thread!();
|
||||
let hsrc = hsrc.into();
|
||||
let element_sinkpad_name = element_sinkpad_name.into();
|
||||
|
@ -559,19 +538,19 @@ impl Harness {
|
|||
let element_srcpad_name = element_srcpad_name.into();
|
||||
let element_srcpad_name = element_srcpad_name.to_glib_none();
|
||||
unsafe {
|
||||
from_glib_full(ffi::gst_harness_new_full(
|
||||
Self::from_glib_full(ffi::gst_harness_new_full(
|
||||
element.to_glib_none().0,
|
||||
hsrc.to_glib_none_mut().0,
|
||||
hsrc.to_glib_none().0 as *mut _,
|
||||
element_sinkpad_name.0,
|
||||
hsink.to_glib_none_mut().0,
|
||||
hsink.to_glib_none().0 as *mut _,
|
||||
element_srcpad_name.0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
pub fn new_parse(launchline: &str) -> Option<Harness> {
|
||||
pub fn new_parse(launchline: &str) -> Harness {
|
||||
assert_initialized_main_thread!();
|
||||
unsafe { from_glib_full(ffi::gst_harness_new_parse(launchline.to_glib_none().0)) }
|
||||
unsafe { Self::from_glib_full(ffi::gst_harness_new_parse(launchline.to_glib_none().0)) }
|
||||
}
|
||||
|
||||
pub fn new_with_element<
|
||||
|
@ -584,14 +563,14 @@ impl Harness {
|
|||
element: &P,
|
||||
element_sinkpad_name: Q,
|
||||
element_srcpad_name: R,
|
||||
) -> Option<Harness> {
|
||||
) -> Harness {
|
||||
assert_initialized_main_thread!();
|
||||
let element_sinkpad_name = element_sinkpad_name.into();
|
||||
let element_sinkpad_name = element_sinkpad_name.to_glib_none();
|
||||
let element_srcpad_name = element_srcpad_name.into();
|
||||
let element_srcpad_name = element_srcpad_name.to_glib_none();
|
||||
unsafe {
|
||||
from_glib_full(ffi::gst_harness_new_with_element(
|
||||
Self::from_glib_full(ffi::gst_harness_new_with_element(
|
||||
element.to_glib_none().0,
|
||||
element_sinkpad_name.0,
|
||||
element_srcpad_name.0,
|
||||
|
@ -603,14 +582,14 @@ impl Harness {
|
|||
element_name: &str,
|
||||
element_sinkpad_name: P,
|
||||
element_srcpad_name: Q,
|
||||
) -> Option<Harness> {
|
||||
) -> Harness {
|
||||
assert_initialized_main_thread!();
|
||||
let element_sinkpad_name = element_sinkpad_name.into();
|
||||
let element_sinkpad_name = element_sinkpad_name.to_glib_none();
|
||||
let element_srcpad_name = element_srcpad_name.into();
|
||||
let element_srcpad_name = element_srcpad_name.to_glib_none();
|
||||
unsafe {
|
||||
from_glib_full(ffi::gst_harness_new_with_padnames(
|
||||
Self::from_glib_full(ffi::gst_harness_new_with_padnames(
|
||||
element_name.to_glib_none().0,
|
||||
element_sinkpad_name.0,
|
||||
element_srcpad_name.0,
|
||||
|
@ -627,15 +606,15 @@ impl Harness {
|
|||
element_name: &str,
|
||||
hsrc: P,
|
||||
hsink: Q,
|
||||
) -> Option<Harness> {
|
||||
) -> Harness {
|
||||
assert_initialized_main_thread!();
|
||||
let hsrc = hsrc.into();
|
||||
let hsink = hsink.into();
|
||||
unsafe {
|
||||
from_glib_full(ffi::gst_harness_new_with_templates(
|
||||
Self::from_glib_full(ffi::gst_harness_new_with_templates(
|
||||
element_name.to_glib_none().0,
|
||||
hsrc.to_glib_none_mut().0,
|
||||
hsink.to_glib_none_mut().0,
|
||||
hsrc.to_glib_none().0 as *mut _,
|
||||
hsink.to_glib_none().0 as *mut _,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
@ -644,3 +623,18 @@ impl Harness {
|
|||
// unsafe { TODO: call ffi::gst_harness_stress_thread_stop() }
|
||||
//}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_identity_push_pull() {
|
||||
gst::init().unwrap();
|
||||
|
||||
let mut h = Harness::new("identity");
|
||||
let buf = gst::Buffer::new();
|
||||
let buf = h.push_and_pull(buf);
|
||||
assert!(buf.is_some());
|
||||
}
|
||||
}
|
||||
|
|
48
gstreamer-check/src/lib.rs
Normal file
48
gstreamer-check/src/lib.rs
Normal file
|
@ -0,0 +1,48 @@
|
|||
// 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.
|
||||
|
||||
extern crate glib_sys as glib_ffi;
|
||||
extern crate gobject_sys as gobject_ffi;
|
||||
extern crate gstreamer as gst;
|
||||
extern crate gstreamer_check_sys as ffi;
|
||||
extern crate gstreamer_sys as gst_ffi;
|
||||
|
||||
#[macro_use]
|
||||
extern crate glib;
|
||||
|
||||
macro_rules! assert_initialized_main_thread {
|
||||
() => {
|
||||
if unsafe { ::gst_ffi::gst_is_initialized() } != ::glib_ffi::GTRUE {
|
||||
panic!("GStreamer has not been initialized. Call `gst::init` first.");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
pub use glib::{Cast, Continue, Error, IsA, StaticType, ToValue, Type, TypedValue, Value};
|
||||
|
||||
#[cfg_attr(feature = "cargo-clippy", allow(unreadable_literal))]
|
||||
#[cfg_attr(feature = "cargo-clippy", allow(transmute_ptr_to_ref))]
|
||||
#[cfg_attr(feature = "cargo-clippy", allow(too_many_arguments))]
|
||||
#[cfg_attr(feature = "cargo-clippy", allow(match_same_arms))]
|
||||
#[cfg_attr(feature = "cargo-clippy", allow(type_complexity))]
|
||||
mod auto;
|
||||
pub use auto::*;
|
||||
|
||||
mod test_clock;
|
||||
|
||||
mod harness;
|
||||
pub use harness::*;
|
||||
|
||||
// Re-export all the traits in a prelude module, so that applications
|
||||
// can always "use gst::prelude::*" without getting conflicts
|
||||
pub mod prelude {
|
||||
pub use glib::prelude::*;
|
||||
pub use gst::prelude::*;
|
||||
|
||||
pub use auto::traits::*;
|
||||
}
|
60
gstreamer-check/src/test_clock.rs
Normal file
60
gstreamer-check/src/test_clock.rs
Normal file
|
@ -0,0 +1,60 @@
|
|||
// 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 ffi;
|
||||
#[cfg(any(feature = "v1_14", feature = "dox"))]
|
||||
use glib::translate::*;
|
||||
use gst;
|
||||
use std::ptr;
|
||||
use TestClock;
|
||||
|
||||
impl TestClock {
|
||||
pub fn has_id(&self, id: &gst::ClockId) -> bool {
|
||||
unsafe { from_glib(ffi::gst_test_clock_has_id(self.to_glib_none().0, id.to_glib_none().0)) }
|
||||
}
|
||||
|
||||
pub fn peek_next_pending_id(&self) -> Option<gst::ClockId> {
|
||||
unsafe {
|
||||
let mut id = ptr::null_mut();
|
||||
let ret: bool = from_glib(ffi::gst_test_clock_peek_next_pending_id(self.to_glib_none().0, &mut id));
|
||||
if ret {
|
||||
from_glib_full(id)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn process_id_list(&self, pending_list: &[&gst::ClockId]) -> u32 {
|
||||
unsafe {
|
||||
ffi::gst_test_clock_process_id_list(self.to_glib_none().0, pending_list.to_glib_none().0)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn process_next_clock_id(&self) -> Option<gst::ClockId> {
|
||||
unsafe {
|
||||
from_glib_full(ffi::gst_test_clock_process_next_clock_id(self.to_glib_none().0))
|
||||
}
|
||||
}
|
||||
|
||||
pub fn wait_for_multiple_pending_ids(&self, count: u32) -> Vec<gst::ClockId> {
|
||||
unsafe {
|
||||
let mut pending_list = ptr::null_mut();
|
||||
ffi::gst_test_clock_wait_for_multiple_pending_ids(self.to_glib_none().0, count, &mut pending_list);
|
||||
FromGlibPtrContainer::from_glib_full(pending_list)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn wait_for_next_pending_id(&self) -> gst::ClockId {
|
||||
unsafe {
|
||||
let mut id = ptr::null_mut();
|
||||
ffi::gst_test_clock_wait_for_next_pending_id(self.to_glib_none().0, &mut id);
|
||||
from_glib_full(id)
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue