Commit d4bd1c2d authored by Sebastian Dröge's avatar Sebastian Dröge 🍵

Add dox feature to everything as needed

parent a557a8d6
......@@ -182,7 +182,8 @@ pub struct VideoInfoBuilder<'a> {
stride: Option<&'a [i32]>,
multiview_mode: Option<::VideoMultiviewMode>,
multiview_flags: Option<::VideoMultiviewFlags>,
#[cfg(feature = "v1_12")] field_order: Option<::VideoFieldOrder>,
#[cfg(any(feature = "v1_12", feature = "dox"))]
field_order: Option<::VideoFieldOrder>,
}
impl<'a> VideoInfoBuilder<'a> {
......@@ -263,7 +264,7 @@ impl<'a> VideoInfoBuilder<'a> {
ptr::write(ptr.offset(1), multiview_flags.to_glib().bits());
}
#[cfg(feature = "v1_12")]
#[cfg(any(feature = "v1_12", feature = "dox"))]
{
if let Some(field_order) = self.field_order {
let ptr = &mut info._gst_reserved as *mut _ as *mut i32;
......@@ -359,7 +360,7 @@ impl<'a> VideoInfoBuilder<'a> {
}
}
#[cfg(feature = "v1_12")]
#[cfg(any(feature = "v1_12", feature = "dox"))]
pub fn field_order(self, field_order: ::VideoFieldOrder) -> Self {
Self {
field_order: Some(field_order),
......@@ -372,7 +373,7 @@ impl VideoInfo {
pub fn new<'a>(format: ::VideoFormat, width: u32, height: u32) -> VideoInfoBuilder<'a> {
assert_initialized_main_thread!();
#[cfg(not(feature = "v1_12"))]
#[cfg(not(any(feature = "v1_12", feature = "dox")))]
{
VideoInfoBuilder {
format: format,
......@@ -392,7 +393,7 @@ impl VideoInfo {
multiview_flags: None,
}
}
#[cfg(feature = "v1_12")]
#[cfg(any(feature = "v1_12", feature = "dox"))]
{
VideoInfoBuilder {
format: format,
......@@ -509,7 +510,7 @@ impl VideoInfo {
}
}
#[cfg(feature = "v1_12")]
#[cfg(any(feature = "v1_12", feature = "dox"))]
pub fn field_order(&self) -> ::VideoFieldOrder {
unsafe {
let ptr = &self.0._gst_reserved as *const _ as *const i32;
......@@ -667,7 +668,7 @@ impl glib::translate::FromGlibPtrFull<*mut ffi::GstVideoInfo> for VideoInfo {
}
}
#[cfg(feature = "v1_12")]
#[cfg(any(feature = "v1_12", feature = "dox"))]
impl ::VideoFieldOrder {
pub fn to_string(&self) -> String {
unsafe { from_glib_full(ffi::gst_video_field_order_to_string(self.to_glib())) }
......@@ -680,7 +681,7 @@ impl ::VideoFieldOrder {
}
}
#[cfg(feature = "v1_12")]
#[cfg(any(feature = "v1_12", feature = "dox"))]
impl str::FromStr for ::VideoFieldOrder {
type Err = ();
......@@ -690,7 +691,7 @@ impl str::FromStr for ::VideoFieldOrder {
}
}
#[cfg(feature = "v1_12")]
#[cfg(any(feature = "v1_12", feature = "dox"))]
impl fmt::Display for ::VideoFieldOrder {
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
f.write_str(&self.to_string())
......
......@@ -16,17 +16,6 @@ use glib_ffi;
use glib_ffi::{gboolean, gpointer};
use std::ptr;
#[cfg(feature = "futures")]
use std::sync::{Arc, Mutex};
#[cfg(feature = "futures")]
use futures;
#[cfg(feature = "futures")]
use futures::{Async, Poll};
#[cfg(feature = "futures")]
use futures::task::Task;
#[cfg(feature = "futures")]
use futures::stream::Stream;
use Bus;
use BusSyncReply;
use Message;
......@@ -145,52 +134,61 @@ impl Bus {
}
}
#[cfg(feature = "futures")]
pub struct BusStream(Bus, Arc<Mutex<Option<Task>>>);
#[cfg(feature = "futures")]
impl BusStream {
pub fn new(bus: &Bus) -> Self {
skip_assert_initialized!();
let task = Arc::new(Mutex::new(None));
let task_clone = task.clone();
bus.set_sync_handler(move |_, _| {
let mut task = task_clone.lock().unwrap();
if let Some(task) = task.take() {
// FIXME: Force type...
let task: Task = task;
task.notify();
}
BusSyncReply::Pass
});
BusStream(bus.clone(), task)
#[cfg(any(feature = "futures", feature = "dox"))]
mod futures {
use std::sync::{Arc, Mutex};
use futures;
use futures::{Async, Poll};
use futures::task::Task;
use futures::stream::Stream;
use super::*;
pub struct BusStream(Bus, Arc<Mutex<Option<Task>>>);
impl BusStream {
pub fn new(bus: &Bus) -> Self {
skip_assert_initialized!();
let task = Arc::new(Mutex::new(None));
let task_clone = task.clone();
bus.set_sync_handler(move |_, _| {
let mut task = task_clone.lock().unwrap();
if let Some(task) = task.take() {
// FIXME: Force type...
let task: Task = task;
task.notify();
}
BusSyncReply::Pass
});
BusStream(bus.clone(), task)
}
}
}
#[cfg(feature = "futures")]
impl Drop for BusStream {
fn drop(&mut self) {
self.0.unset_sync_handler();
impl Drop for BusStream {
fn drop(&mut self) {
self.0.unset_sync_handler();
}
}
}
#[cfg(feature = "futures")]
impl Stream for BusStream {
type Item = Message;
type Error = ();
impl Stream for BusStream {
type Item = Message;
type Error = ();
fn poll(&mut self) -> Poll<Option<Self::Item>, Self::Error> {
let mut task = self.1.lock().unwrap();
fn poll(&mut self) -> Poll<Option<Self::Item>, Self::Error> {
let mut task = self.1.lock().unwrap();
let msg = self.0.pop();
if let Some(msg) = msg {
Ok(Async::Ready(Some(msg)))
} else {
*task = Some(futures::task::current());
Ok(Async::NotReady)
let msg = self.0.pop();
if let Some(msg) = msg {
Ok(Async::Ready(Some(msg)))
} else {
*task = Some(futures::task::current());
Ok(Async::NotReady)
}
}
}
}
#[cfg(any(feature = "futures", feature = "dox"))]
pub use bus::futures::BusStream;
......@@ -98,7 +98,7 @@ pub trait ElementExtManual {
function: &str,
line: u32,
);
#[cfg(feature = "v1_10")]
#[cfg(any(feature = "v1_10", feature = "dox"))]
fn message_full_with_details<T: ::MessageErrorDomain>(
&self,
type_: ElementMessageType,
......@@ -248,7 +248,7 @@ impl<O: IsA<Element>> ElementExtManual for O {
}
}
#[cfg(feature = "v1_10")]
#[cfg(any(feature = "v1_10", feature = "dox"))]
fn message_full_with_details<T: ::MessageErrorDomain>(
&self,
type_: ElementMessageType,
......
......@@ -18,7 +18,7 @@ use glib;
use glib::value::ToValue;
use glib::translate::{from_glib, from_glib_full, from_glib_none, ToGlib, ToGlibPtr};
#[cfg(feature = "v1_10")]
#[cfg(any(feature = "v1_10", feature = "dox"))]
use glib::translate::FromGlibPtrContainer;
#[repr(C)]
......@@ -138,7 +138,7 @@ impl GstRc<EventRef> {
SegmentBuilder::new(segment)
}
#[cfg(feature = "v1_10")]
#[cfg(any(feature = "v1_10", feature = "dox"))]
pub fn new_stream_collection<'a>(
stream_collection: &'a ::StreamCollection,
) -> StreamCollectionBuilder<'a> {
......@@ -169,7 +169,7 @@ impl GstRc<EventRef> {
SinkMessageBuilder::new(name, msg)
}
#[cfg(feature = "v1_10")]
#[cfg(any(feature = "v1_10", feature = "dox"))]
pub fn new_stream_group_done<'a>(group_id: u32) -> StreamGroupDoneBuilder<'a> {
assert_initialized_main_thread!();
StreamGroupDoneBuilder::new(group_id)
......@@ -262,7 +262,7 @@ impl GstRc<EventRef> {
TocSelectBuilder::new(uid)
}
#[cfg(feature = "v1_10")]
#[cfg(any(feature = "v1_10", feature = "dox"))]
pub fn new_select_streams<'a>(streams: &'a [&'a str]) -> SelectStreamsBuilder<'a> {
assert_initialized_main_thread!();
SelectStreamsBuilder::new(streams)
......@@ -418,7 +418,7 @@ impl<'a> Segment<'a> {
pub struct StreamCollection<'a>(&'a EventRef);
impl<'a> StreamCollection<'a> {
#[cfg(feature = "v1_10")]
#[cfg(any(feature = "v1_10", feature = "dox"))]
pub fn get_stream_collection(&self) -> ::StreamCollection {
unsafe {
let mut stream_collection = ptr::null_mut();
......@@ -480,7 +480,7 @@ impl<'a> SinkMessage<'a> {
pub struct StreamGroupDone<'a>(&'a EventRef);
impl<'a> StreamGroupDone<'a> {
#[cfg(feature = "v1_10")]
#[cfg(any(feature = "v1_10", feature = "dox"))]
pub fn get_group_id(&self) -> u32 {
unsafe {
let mut group_id = mem::uninitialized();
......@@ -688,7 +688,7 @@ impl<'a> TocSelect<'a> {
pub struct SelectStreams<'a>(&'a EventRef);
impl<'a> SelectStreams<'a> {
#[cfg(feature = "v1_10")]
#[cfg(any(feature = "v1_10", feature = "dox"))]
pub fn get_streams(&self) -> Vec<String> {
unsafe {
let mut streams = ptr::null_mut();
......@@ -889,14 +889,14 @@ impl<'a> SegmentBuilder<'a> {
});
}
#[cfg(feature = "v1_10")]
#[cfg(any(feature = "v1_10", feature = "dox"))]
pub struct StreamCollectionBuilder<'a> {
seqnum: Option<u32>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToValue)>,
stream_collection: &'a ::StreamCollection,
}
#[cfg(feature = "v1_10")]
#[cfg(any(feature = "v1_10", feature = "dox"))]
impl<'a> StreamCollectionBuilder<'a> {
fn new(stream_collection: &'a ::StreamCollection) -> Self {
skip_assert_initialized!();
......@@ -991,14 +991,14 @@ impl<'a> SinkMessageBuilder<'a> {
});
}
#[cfg(feature = "v1_10")]
#[cfg(any(feature = "v1_10", feature = "dox"))]
pub struct StreamGroupDoneBuilder<'a> {
seqnum: Option<u32>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToValue)>,
uid: u32,
}
#[cfg(feature = "v1_10")]
#[cfg(any(feature = "v1_10", feature = "dox"))]
impl<'a> StreamGroupDoneBuilder<'a> {
fn new(uid: u32) -> Self {
skip_assert_initialized!();
......@@ -1326,14 +1326,14 @@ impl<'a> TocSelectBuilder<'a> {
});
}
#[cfg(feature = "v1_10")]
#[cfg(any(feature = "v1_10", feature = "dox"))]
pub struct SelectStreamsBuilder<'a> {
seqnum: Option<u32>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToValue)>,
streams: &'a [&'a str],
}
#[cfg(feature = "v1_10")]
#[cfg(any(feature = "v1_10", feature = "dox"))]
impl<'a> SelectStreamsBuilder<'a> {
fn new(streams: &'a [&'a str]) -> Self {
skip_assert_initialized!();
......
......@@ -22,7 +22,7 @@ extern crate glib;
extern crate num_rational;
#[cfg(feature = "futures")]
#[cfg(any(feature = "futures", feature = "dox"))]
extern crate futures;
extern crate muldiv;
......@@ -118,7 +118,7 @@ pub use tag_setter::TagSetterExtManual;
pub use self::iterator::{Iterator, IteratorError, IteratorImpl};
pub use device_provider::DeviceProviderExtManual;
pub use parse_context::ParseContext;
#[cfg(feature = "futures")]
#[cfg(any(feature = "futures", feature = "dox"))]
pub use bus::BusStream;
pub use enums::{StateChangeError, StateChangeSuccess};
pub use clock_time::ClockTime;
......
......@@ -300,7 +300,7 @@ impl GstRc<MessageRef> {
DeviceRemovedBuilder::new(device)
}
#[cfg(feature = "v1_10")]
#[cfg(any(feature = "v1_10", feature = "dox"))]
pub fn new_property_notify<'a>(
property_name: &'a str,
value: &'a glib::Value,
......@@ -309,7 +309,7 @@ impl GstRc<MessageRef> {
PropertyNotifyBuilder::new(property_name, value)
}
#[cfg(feature = "v1_10")]
#[cfg(any(feature = "v1_10", feature = "dox"))]
pub fn new_stream_collection<'a>(
collection: &'a ::StreamCollection,
) -> StreamCollectionBuilder<'a> {
......@@ -317,7 +317,7 @@ impl GstRc<MessageRef> {
StreamCollectionBuilder::new(collection)
}
#[cfg(feature = "v1_10")]
#[cfg(any(feature = "v1_10", feature = "dox"))]
pub fn new_streams_selected<'a>(
collection: &'a ::StreamCollection,
) -> StreamsSelectedBuilder<'a> {
......@@ -325,7 +325,7 @@ impl GstRc<MessageRef> {
StreamsSelectedBuilder::new(collection)
}
#[cfg(feature = "v1_10")]
#[cfg(any(feature = "v1_10", feature = "dox"))]
pub fn new_redirect<'a>(
location: &'a str,
tag_list: Option<&'a TagList>,
......@@ -408,7 +408,7 @@ impl<'a> Error<'a> {
}
}
#[cfg(feature = "v1_10")]
#[cfg(any(feature = "v1_10", feature = "dox"))]
pub fn get_details(&self) -> Option<&StructureRef> {
unsafe {
let mut details = ptr::null();
......@@ -446,7 +446,7 @@ impl<'a> Warning<'a> {
}
}
#[cfg(feature = "v1_10")]
#[cfg(any(feature = "v1_10", feature = "dox"))]
pub fn get_details(&self) -> Option<&StructureRef> {
unsafe {
let mut details = ptr::null();
......@@ -484,7 +484,7 @@ impl<'a> Info<'a> {
}
}
#[cfg(feature = "v1_10")]
#[cfg(any(feature = "v1_10", feature = "dox"))]
pub fn get_details(&self) -> Option<&StructureRef> {
unsafe {
let mut details = ptr::null();
......@@ -1008,7 +1008,7 @@ impl<'a> DeviceRemoved<'a> {
pub struct PropertyNotify<'a>(&'a MessageRef);
impl<'a> PropertyNotify<'a> {
#[cfg(feature = "v1_10")]
#[cfg(any(feature = "v1_10", feature = "dox"))]
pub fn get(&self) -> (Object, &str, ::Value) {
unsafe {
let mut object = ptr::null_mut();
......@@ -1033,7 +1033,7 @@ impl<'a> PropertyNotify<'a> {
pub struct StreamCollection<'a>(&'a MessageRef);
impl<'a> StreamCollection<'a> {
#[cfg(feature = "v1_10")]
#[cfg(any(feature = "v1_10", feature = "dox"))]
pub fn get_stream_collection(&self) -> ::StreamCollection {
unsafe {
let mut collection = ptr::null_mut();
......@@ -1046,7 +1046,7 @@ impl<'a> StreamCollection<'a> {
}
pub struct StreamsSelected<'a>(&'a MessageRef);
impl<'a> StreamsSelected<'a> {
#[cfg(feature = "v1_10")]
#[cfg(any(feature = "v1_10", feature = "dox"))]
pub fn get_stream_collection(&self) -> ::StreamCollection {
unsafe {
let mut collection = ptr::null_mut();
......@@ -1057,7 +1057,7 @@ impl<'a> StreamsSelected<'a> {
}
}
#[cfg(feature = "v1_10")]
#[cfg(any(feature = "v1_10", feature = "dox"))]
pub fn get_streams(&self) -> Vec<::Stream> {
unsafe {
let n = ffi::gst_message_streams_selected_get_size(self.0.as_mut_ptr());
......@@ -1076,7 +1076,7 @@ impl<'a> StreamsSelected<'a> {
pub struct Redirect<'a>(&'a MessageRef);
impl<'a> Redirect<'a> {
#[cfg(feature = "v1_10")]
#[cfg(any(feature = "v1_10", feature = "dox"))]
pub fn get_entries(&self) -> Vec<(&str, Option<TagList>, Option<&StructureRef>)> {
unsafe {
let n = ffi::gst_message_get_num_redirect_entries(self.0.as_mut_ptr());
......@@ -1220,7 +1220,7 @@ impl<'a, T: MessageErrorDomain> ErrorBuilder<'a, T> {
}
}
#[cfg(feature = "v1_10")]
#[cfg(any(feature = "v1_10", feature = "dox"))]
pub fn details(self, details: Structure) -> Self {
Self {
details: Some(details),
......@@ -1229,7 +1229,7 @@ impl<'a, T: MessageErrorDomain> ErrorBuilder<'a, T> {
}
message_builder_generic_impl!(|s: &mut Self, src| {
#[cfg(feature = "v1_10")]
#[cfg(any(feature = "v1_10", feature = "dox"))]
{
let details = match s.details.take() {
None => ptr::null_mut(),
......@@ -1245,7 +1245,7 @@ impl<'a, T: MessageErrorDomain> ErrorBuilder<'a, T> {
details,
)
}
#[cfg(not(feature = "v1_10"))]
#[cfg(not(any(feature = "v1_10", feature = "dox")))]
{
let error = glib::Error::new(s.error, s.message);
......@@ -1288,7 +1288,7 @@ impl<'a, T: MessageErrorDomain> WarningBuilder<'a, T> {
}
}
#[cfg(feature = "v1_10")]
#[cfg(any(feature = "v1_10", feature = "dox"))]
pub fn details(self, details: Structure) -> Self {
Self {
details: Some(details),
......@@ -1297,7 +1297,7 @@ impl<'a, T: MessageErrorDomain> WarningBuilder<'a, T> {
}
message_builder_generic_impl!(|s: &mut Self, src| {
#[cfg(feature = "v1_10")]
#[cfg(any(feature = "v1_10", feature = "dox"))]
{
let details = match s.details.take() {
None => ptr::null_mut(),
......@@ -1313,7 +1313,7 @@ impl<'a, T: MessageErrorDomain> WarningBuilder<'a, T> {
details,
)
}
#[cfg(not(feature = "v1_10"))]
#[cfg(not(any(feature = "v1_10", feature = "dox")))]
{
let error = glib::Error::new(s.error, s.message);
......@@ -1356,7 +1356,7 @@ impl<'a, T: MessageErrorDomain> InfoBuilder<'a, T> {
}
}
#[cfg(feature = "v1_10")]
#[cfg(any(feature = "v1_10", feature = "dox"))]
pub fn details(self, details: Structure) -> Self {
Self {
details: Some(details),
......@@ -1365,7 +1365,7 @@ impl<'a, T: MessageErrorDomain> InfoBuilder<'a, T> {
}
message_builder_generic_impl!(|s: &mut Self, src| {
#[cfg(feature = "v1_10")]
#[cfg(any(feature = "v1_10", feature = "dox"))]
{
let details = match s.details.take() {
None => ptr::null_mut(),
......@@ -1381,7 +1381,7 @@ impl<'a, T: MessageErrorDomain> InfoBuilder<'a, T> {
details,
)
}
#[cfg(not(feature = "v1_10"))]
#[cfg(not(any(feature = "v1_10", feature = "dox")))]
{
let error = glib::Error::new(s.error, s.message);
......@@ -2219,7 +2219,7 @@ impl<'a> DeviceRemovedBuilder<'a> {
});
}
#[cfg(feature = "v1_10")]
#[cfg(any(feature = "v1_10", feature = "dox"))]
pub struct PropertyNotifyBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
......@@ -2227,7 +2227,7 @@ pub struct PropertyNotifyBuilder<'a> {
property_name: &'a str,
value: &'a glib::Value,
}
#[cfg(feature = "v1_10")]
#[cfg(any(feature = "v1_10", feature = "dox"))]
impl<'a> PropertyNotifyBuilder<'a> {
fn new(property_name: &'a str, value: &'a glib::Value) -> Self {
skip_assert_initialized!();
......@@ -2249,14 +2249,14 @@ impl<'a> PropertyNotifyBuilder<'a> {
});
}
#[cfg(feature = "v1_10")]
#[cfg(any(feature = "v1_10", feature = "dox"))]
pub struct StreamCollectionBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
collection: &'a ::StreamCollection,
}
#[cfg(feature = "v1_10")]
#[cfg(any(feature = "v1_10", feature = "dox"))]
impl<'a> StreamCollectionBuilder<'a> {
fn new(collection: &'a ::StreamCollection) -> Self {
skip_assert_initialized!();
......@@ -2273,15 +2273,17 @@ impl<'a> StreamCollectionBuilder<'a> {
});
}
#[cfg(feature = "v1_10")]
#[cfg(any(feature = "v1_10", feature = "dox"))]
pub struct StreamsSelectedBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
#[cfg(feature = "v1_10")] collection: &'a ::StreamCollection,
#[cfg(feature = "v1_10")] streams: Option<&'a [&'a ::Stream]>,
#[cfg(any(feature = "v1_10", feature = "dox"))]
collection: &'a ::StreamCollection,
#[cfg(any(feature = "v1_10", feature = "dox"))]
streams: Option<&'a [&'a ::Stream]>,
}
#[cfg(feature = "v1_10")]
#[cfg(any(feature = "v1_10", feature = "dox"))]
impl<'a> StreamsSelectedBuilder<'a> {
fn new(collection: &'a ::StreamCollection) -> Self {
skip_assert_initialized!();
......@@ -2312,7 +2314,7 @@ impl<'a> StreamsSelectedBuilder<'a> {
});
}
#[cfg(feature = "v1_10")]
#[cfg(any(feature = "v1_10", feature = "dox"))]
pub struct RedirectBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
......@@ -2323,7 +2325,7 @@ pub struct RedirectBuilder<'a> {
#[cfg_attr(feature = "cargo-clippy", allow(type_complexity))]
entries: Option<&'a [(&'a str, Option<&'a TagList>, Option<&'a Structure>)]>,
}
#[cfg(feature = "v1_10")]
#[cfg(any(feature = "v1_10", feature = "dox"))]
impl<'a> RedirectBuilder<'a> {
fn new(
location: &'a str,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment