mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-06-03 05:49:31 +00:00
Run everything through new rustfmt
This commit is contained in:
parent
021de8af1f
commit
9864413be2
|
@ -51,10 +51,12 @@ impl FileSink {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn validate_uri(uri: &Url) -> Result<(), UriError> {
|
fn validate_uri(uri: &Url) -> Result<(), UriError> {
|
||||||
let _ = try!(uri.to_file_path().or_else(|_| {
|
let _ = try!(uri.to_file_path()
|
||||||
Err(UriError::new(UriErrorKind::UnsupportedProtocol,
|
.or_else(|_| {
|
||||||
Some(format!("Unsupported file URI '{}'", uri.as_str()))))
|
Err(UriError::new(UriErrorKind::UnsupportedProtocol,
|
||||||
}));
|
Some(format!("Unsupported file URI '{}'",
|
||||||
|
uri.as_str()))))
|
||||||
|
}));
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,11 +70,13 @@ impl Sink for FileSink {
|
||||||
return Err(error_msg!(SinkError::Failure, ["Sink already started"]));
|
return Err(error_msg!(SinkError::Failure, ["Sink already started"]));
|
||||||
}
|
}
|
||||||
|
|
||||||
let location = try!(uri.to_file_path().or_else(|_| {
|
let location =
|
||||||
error!(self.logger, "Unsupported file URI '{}'", uri.as_str());
|
try!(uri.to_file_path()
|
||||||
Err(error_msg!(SinkError::Failure,
|
.or_else(|_| {
|
||||||
["Unsupported file URI '{}'", uri.as_str()]))
|
error!(self.logger, "Unsupported file URI '{}'", uri.as_str());
|
||||||
}));
|
Err(error_msg!(SinkError::Failure,
|
||||||
|
["Unsupported file URI '{}'", uri.as_str()]))
|
||||||
|
}));
|
||||||
|
|
||||||
|
|
||||||
let file = try!(File::create(location.as_path()).or_else(|err| {
|
let file = try!(File::create(location.as_path()).or_else(|err| {
|
||||||
|
@ -108,7 +112,10 @@ impl Sink for FileSink {
|
||||||
trace!(logger, "Rendering {:?}", buffer);
|
trace!(logger, "Rendering {:?}", buffer);
|
||||||
|
|
||||||
let (file, position) = match self.streaming_state {
|
let (file, position) = match self.streaming_state {
|
||||||
StreamingState::Started { ref mut file, ref mut position } => (file, position),
|
StreamingState::Started {
|
||||||
|
ref mut file,
|
||||||
|
ref mut position,
|
||||||
|
} => (file, position),
|
||||||
StreamingState::Stopped => {
|
StreamingState::Stopped => {
|
||||||
return Err(FlowError::Error(error_msg!(SinkError::Failure, ["Not started yet"])));
|
return Err(FlowError::Error(error_msg!(SinkError::Failure, ["Not started yet"])));
|
||||||
}
|
}
|
||||||
|
@ -123,10 +130,12 @@ impl Sink for FileSink {
|
||||||
};
|
};
|
||||||
let data = map.as_slice();
|
let data = map.as_slice();
|
||||||
|
|
||||||
try!(file.write_all(data).or_else(|err| {
|
try!(file.write_all(data)
|
||||||
error!(logger, "Failed to write: {}", err);
|
.or_else(|err| {
|
||||||
Err(FlowError::Error(error_msg!(SinkError::WriteFailed, ["Failed to write: {}", err])))
|
error!(logger, "Failed to write: {}", err);
|
||||||
}));
|
Err(FlowError::Error(error_msg!(SinkError::WriteFailed,
|
||||||
|
["Failed to write: {}", err])))
|
||||||
|
}));
|
||||||
|
|
||||||
*position += data.len() as u64;
|
*position += data.len() as u64;
|
||||||
|
|
||||||
|
|
|
@ -49,10 +49,12 @@ impl FileSrc {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn validate_uri(uri: &Url) -> Result<(), UriError> {
|
fn validate_uri(uri: &Url) -> Result<(), UriError> {
|
||||||
let _ = try!(uri.to_file_path().or_else(|_| {
|
let _ = try!(uri.to_file_path()
|
||||||
Err(UriError::new(UriErrorKind::UnsupportedProtocol,
|
.or_else(|_| {
|
||||||
Some(format!("Unsupported file URI '{}'", uri.as_str()))))
|
Err(UriError::new(UriErrorKind::UnsupportedProtocol,
|
||||||
}));
|
Some(format!("Unsupported file URI '{}'",
|
||||||
|
uri.as_str()))))
|
||||||
|
}));
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,11 +80,13 @@ impl Source for FileSrc {
|
||||||
return Err(error_msg!(SourceError::Failure, ["Source already started"]));
|
return Err(error_msg!(SourceError::Failure, ["Source already started"]));
|
||||||
}
|
}
|
||||||
|
|
||||||
let location = try!(uri.to_file_path().or_else(|_| {
|
let location =
|
||||||
error!(self.logger, "Unsupported file URI '{}'", uri.as_str());
|
try!(uri.to_file_path()
|
||||||
Err(error_msg!(SourceError::Failure,
|
.or_else(|_| {
|
||||||
["Unsupported file URI '{}'", uri.as_str()]))
|
error!(self.logger, "Unsupported file URI '{}'", uri.as_str());
|
||||||
}));
|
Err(error_msg!(SourceError::Failure,
|
||||||
|
["Unsupported file URI '{}'", uri.as_str()]))
|
||||||
|
}));
|
||||||
|
|
||||||
let file = try!(File::open(location.as_path()).or_else(|err| {
|
let file = try!(File::open(location.as_path()).or_else(|err| {
|
||||||
error!(self.logger,
|
error!(self.logger,
|
||||||
|
@ -115,20 +119,24 @@ impl Source for FileSrc {
|
||||||
let logger = self.logger.clone();
|
let logger = self.logger.clone();
|
||||||
|
|
||||||
let (file, position) = match self.streaming_state {
|
let (file, position) = match self.streaming_state {
|
||||||
StreamingState::Started { ref mut file, ref mut position } => (file, position),
|
StreamingState::Started {
|
||||||
|
ref mut file,
|
||||||
|
ref mut position,
|
||||||
|
} => (file, position),
|
||||||
StreamingState::Stopped => {
|
StreamingState::Stopped => {
|
||||||
return Err(FlowError::Error(error_msg!(SourceError::Failure, ["Not started yet"])));
|
return Err(FlowError::Error(error_msg!(SourceError::Failure, ["Not started yet"])));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if *position != offset {
|
if *position != offset {
|
||||||
try!(file.seek(SeekFrom::Start(offset)).or_else(|err| {
|
try!(file.seek(SeekFrom::Start(offset))
|
||||||
error!(logger, "Failed to seek to {}: {:?}", offset, err);
|
.or_else(|err| {
|
||||||
Err(FlowError::Error(error_msg!(SourceError::SeekFailed,
|
error!(logger, "Failed to seek to {}: {:?}", offset, err);
|
||||||
["Failed to seek to {}: {}",
|
Err(FlowError::Error(error_msg!(SourceError::SeekFailed,
|
||||||
offset,
|
["Failed to seek to {}: {}",
|
||||||
err.to_string()])))
|
offset,
|
||||||
}));
|
err.to_string()])))
|
||||||
|
}));
|
||||||
*position = offset;
|
*position = offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,13 +151,14 @@ impl Source for FileSrc {
|
||||||
|
|
||||||
let data = map.as_mut_slice();
|
let data = map.as_mut_slice();
|
||||||
|
|
||||||
try!(file.read(data).or_else(|err| {
|
try!(file.read(data)
|
||||||
error!(logger, "Failed to read: {:?}", err);
|
.or_else(|err| {
|
||||||
Err(FlowError::Error(error_msg!(SourceError::ReadFailed,
|
error!(logger, "Failed to read: {:?}", err);
|
||||||
["Failed to read at {}: {}",
|
Err(FlowError::Error(error_msg!(SourceError::ReadFailed,
|
||||||
offset,
|
["Failed to read at {}: {}",
|
||||||
err.to_string()])))
|
offset,
|
||||||
}))
|
err.to_string()])))
|
||||||
|
}))
|
||||||
};
|
};
|
||||||
|
|
||||||
*position += size as u64;
|
*position += size as u64;
|
||||||
|
|
|
@ -76,11 +76,13 @@ impl HttpSrc {
|
||||||
|
|
||||||
debug!(self.logger, "Doing new request {:?}", req);
|
debug!(self.logger, "Doing new request {:?}", req);
|
||||||
|
|
||||||
let response = try!(req.send().or_else(|err| {
|
let response =
|
||||||
error!(self.logger, "Request failed: {:?}", err);
|
try!(req.send()
|
||||||
Err(error_msg!(SourceError::ReadFailed,
|
.or_else(|err| {
|
||||||
["Failed to fetch {}: {}", uri, err.to_string()]))
|
error!(self.logger, "Request failed: {:?}", err);
|
||||||
}));
|
Err(error_msg!(SourceError::ReadFailed,
|
||||||
|
["Failed to fetch {}: {}", uri, err.to_string()]))
|
||||||
|
}));
|
||||||
|
|
||||||
if !response.status().is_success() {
|
if !response.status().is_success() {
|
||||||
error!(self.logger, "Request status failed: {:?}", response);
|
error!(self.logger, "Request status failed: {:?}", response);
|
||||||
|
@ -88,7 +90,10 @@ impl HttpSrc {
|
||||||
["Failed to fetch {}: {}", uri, response.status()]));
|
["Failed to fetch {}: {}", uri, response.status()]));
|
||||||
}
|
}
|
||||||
|
|
||||||
let size = response.headers().get().map(|&ContentLength(cl)| cl + start);
|
let size = response
|
||||||
|
.headers()
|
||||||
|
.get()
|
||||||
|
.map(|&ContentLength(cl)| cl + start);
|
||||||
|
|
||||||
let accept_byte_ranges = if let Some(&AcceptRanges(ref ranges)) =
|
let accept_byte_ranges = if let Some(&AcceptRanges(ref ranges)) =
|
||||||
response.headers().get() {
|
response.headers().get() {
|
||||||
|
@ -99,10 +104,9 @@ impl HttpSrc {
|
||||||
|
|
||||||
let seekable = size.is_some() && accept_byte_ranges;
|
let seekable = size.is_some() && accept_byte_ranges;
|
||||||
|
|
||||||
let position = if let Some(&ContentRange(ContentRangeSpec::Bytes { range: Some((range_start,
|
let position = if let Some(&ContentRange(ContentRangeSpec::Bytes {
|
||||||
_)),
|
range: Some((range_start, _)), ..
|
||||||
.. })) = response.headers()
|
})) = response.headers().get() {
|
||||||
.get() {
|
|
||||||
range_start
|
range_start
|
||||||
} else {
|
} else {
|
||||||
start
|
start
|
||||||
|
@ -170,9 +174,12 @@ impl Source for HttpSrc {
|
||||||
|
|
||||||
fn seek(&mut self, start: u64, stop: Option<u64>) -> Result<(), ErrorMessage> {
|
fn seek(&mut self, start: u64, stop: Option<u64>) -> Result<(), ErrorMessage> {
|
||||||
let (position, old_stop, uri) = match self.streaming_state {
|
let (position, old_stop, uri) = match self.streaming_state {
|
||||||
StreamingState::Started { position, stop, ref uri, .. } => {
|
StreamingState::Started {
|
||||||
(position, stop, uri.clone())
|
position,
|
||||||
}
|
stop,
|
||||||
|
ref uri,
|
||||||
|
..
|
||||||
|
} => (position, stop, uri.clone()),
|
||||||
StreamingState::Stopped => {
|
StreamingState::Stopped => {
|
||||||
return Err(error_msg!(SourceError::Failure, ["Not started yet"]));
|
return Err(error_msg!(SourceError::Failure, ["Not started yet"]));
|
||||||
}
|
}
|
||||||
|
@ -192,9 +199,11 @@ impl Source for HttpSrc {
|
||||||
let logger = self.logger.clone();
|
let logger = self.logger.clone();
|
||||||
|
|
||||||
let (response, position) = match self.streaming_state {
|
let (response, position) = match self.streaming_state {
|
||||||
StreamingState::Started { ref mut response, ref mut position, .. } => {
|
StreamingState::Started {
|
||||||
(response, position)
|
ref mut response,
|
||||||
}
|
ref mut position,
|
||||||
|
..
|
||||||
|
} => (response, position),
|
||||||
StreamingState::Stopped => {
|
StreamingState::Stopped => {
|
||||||
return Err(FlowError::Error(error_msg!(SourceError::Failure, ["Not started yet"])));
|
return Err(FlowError::Error(error_msg!(SourceError::Failure, ["Not started yet"])));
|
||||||
}
|
}
|
||||||
|
@ -218,13 +227,15 @@ impl Source for HttpSrc {
|
||||||
|
|
||||||
let data = map.as_mut_slice();
|
let data = map.as_mut_slice();
|
||||||
|
|
||||||
try!(response.read(data).or_else(|err| {
|
try!(response
|
||||||
error!(logger, "Failed to read: {:?}", err);
|
.read(data)
|
||||||
Err(FlowError::Error(error_msg!(SourceError::ReadFailed,
|
.or_else(|err| {
|
||||||
["Failed to read at {}: {}",
|
error!(logger, "Failed to read: {:?}", err);
|
||||||
offset,
|
Err(FlowError::Error(error_msg!(SourceError::ReadFailed,
|
||||||
err.to_string()])))
|
["Failed to read at {}: {}",
|
||||||
}))
|
offset,
|
||||||
|
err.to_string()])))
|
||||||
|
}))
|
||||||
};
|
};
|
||||||
|
|
||||||
if size == 0 {
|
if size == 0 {
|
||||||
|
|
|
@ -55,7 +55,8 @@ impl Adapter {
|
||||||
buffer,
|
buffer,
|
||||||
size,
|
size,
|
||||||
self.size);
|
self.size);
|
||||||
self.deque.push_back(Buffer::into_read_mapped_buffer(buffer).unwrap());
|
self.deque
|
||||||
|
.push_back(Buffer::into_read_mapped_buffer(buffer).unwrap());
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn clear(&mut self) {
|
pub fn clear(&mut self) {
|
||||||
|
@ -163,13 +164,18 @@ impl Adapter {
|
||||||
return Ok(Buffer::new());
|
return Ok(Buffer::new());
|
||||||
}
|
}
|
||||||
|
|
||||||
let sub = self.deque.front().and_then(|front| if front.get_size() - self.skip >= size {
|
let sub = self.deque
|
||||||
trace!(LOGGER, "Get buffer of {} bytes, subbuffer of first", size);
|
.front()
|
||||||
let new = front.get_buffer().copy_region(self.skip, Some(size)).unwrap();
|
.and_then(|front| if front.get_size() - self.skip >= size {
|
||||||
Some(new)
|
trace!(LOGGER, "Get buffer of {} bytes, subbuffer of first", size);
|
||||||
} else {
|
let new = front
|
||||||
None
|
.get_buffer()
|
||||||
});
|
.copy_region(self.skip, Some(size))
|
||||||
|
.unwrap();
|
||||||
|
Some(new)
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
});
|
||||||
|
|
||||||
if let Some(s) = sub {
|
if let Some(s) = sub {
|
||||||
self.flush(size).unwrap();
|
self.flush(size).unwrap();
|
||||||
|
@ -179,10 +185,7 @@ impl Adapter {
|
||||||
trace!(LOGGER, "Get buffer of {} bytes, copy into new buffer", size);
|
trace!(LOGGER, "Get buffer of {} bytes, copy into new buffer", size);
|
||||||
let mut new = Buffer::new_with_size(size).unwrap();
|
let mut new = Buffer::new_with_size(size).unwrap();
|
||||||
{
|
{
|
||||||
let mut map = new.get_mut()
|
let mut map = new.get_mut().unwrap().map_readwrite().unwrap();
|
||||||
.unwrap()
|
|
||||||
.map_readwrite()
|
|
||||||
.unwrap();
|
|
||||||
let data = map.as_mut_slice();
|
let data = map.as_mut_slice();
|
||||||
Self::copy_data(&self.deque, self.skip, data, size);
|
Self::copy_data(&self.deque, self.skip, data, size);
|
||||||
}
|
}
|
||||||
|
@ -207,10 +210,7 @@ impl Adapter {
|
||||||
|
|
||||||
let mut left = size;
|
let mut left = size;
|
||||||
while left > 0 {
|
while left > 0 {
|
||||||
let front_size = self.deque
|
let front_size = self.deque.front().unwrap().get_size() - self.skip;
|
||||||
.front()
|
|
||||||
.unwrap()
|
|
||||||
.get_size() - self.skip;
|
|
||||||
|
|
||||||
if front_size <= left {
|
if front_size <= left {
|
||||||
trace!(LOGGER,
|
trace!(LOGGER,
|
||||||
|
|
|
@ -102,18 +102,24 @@ impl ErrorMessage {
|
||||||
|
|
||||||
|
|
||||||
pub unsafe fn post(&self, element: *mut gst::GstElement) {
|
pub unsafe fn post(&self, element: *mut gst::GstElement) {
|
||||||
let ErrorMessage { error_domain,
|
let ErrorMessage {
|
||||||
error_code,
|
error_domain,
|
||||||
ref message,
|
error_code,
|
||||||
ref debug,
|
ref message,
|
||||||
filename,
|
ref debug,
|
||||||
function,
|
filename,
|
||||||
line } = *self;
|
function,
|
||||||
|
line,
|
||||||
|
} = *self;
|
||||||
|
|
||||||
let message_cstr = message.as_ref().map(|m| CString::new(m.as_bytes()).unwrap());
|
let message_cstr = message
|
||||||
|
.as_ref()
|
||||||
|
.map(|m| CString::new(m.as_bytes()).unwrap());
|
||||||
let message_ptr = message_cstr.as_ref().map_or(ptr::null(), |m| m.as_ptr());
|
let message_ptr = message_cstr.as_ref().map_or(ptr::null(), |m| m.as_ptr());
|
||||||
|
|
||||||
let debug_cstr = debug.as_ref().map(|m| CString::new(m.as_bytes()).unwrap());
|
let debug_cstr = debug
|
||||||
|
.as_ref()
|
||||||
|
.map(|m| CString::new(m.as_bytes()).unwrap());
|
||||||
let debug_ptr = debug_cstr.as_ref().map_or(ptr::null(), |m| m.as_ptr());
|
let debug_ptr = debug_cstr.as_ref().map_or(ptr::null(), |m| m.as_ptr());
|
||||||
|
|
||||||
let file_cstr = CString::new(filename.as_bytes()).unwrap();
|
let file_cstr = CString::new(filename.as_bytes()).unwrap();
|
||||||
|
|
|
@ -44,9 +44,9 @@ impl<T: MiniObject> GstRc<T> {
|
||||||
return &mut self.obj;
|
return &mut self.obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.obj.replace_ptr(gst::gst_mini_object_make_writable(ptr as
|
self.obj
|
||||||
*mut gst::GstMiniObject) as
|
.replace_ptr(gst::gst_mini_object_make_writable(ptr as *mut gst::GstMiniObject) as
|
||||||
*mut T::PtrType);
|
*mut T::PtrType);
|
||||||
assert!(self.is_writable());
|
assert!(self.is_writable());
|
||||||
|
|
||||||
&mut self.obj
|
&mut self.obj
|
||||||
|
|
|
@ -119,7 +119,10 @@ impl SinkWrapper {
|
||||||
|
|
||||||
fn get_uri(&self) -> Option<String> {
|
fn get_uri(&self) -> Option<String> {
|
||||||
let uri_storage = &self.uri.lock().unwrap();
|
let uri_storage = &self.uri.lock().unwrap();
|
||||||
uri_storage.0.as_ref().map(|uri| String::from(uri.as_str()))
|
uri_storage
|
||||||
|
.0
|
||||||
|
.as_ref()
|
||||||
|
.map(|uri| String::from(uri.as_str()))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn start(&self) -> bool {
|
fn start(&self) -> bool {
|
||||||
|
@ -147,10 +150,7 @@ impl SinkWrapper {
|
||||||
Err(ref msg) => {
|
Err(ref msg) => {
|
||||||
error!(self.logger, "Failed to start: {:?}", msg);
|
error!(self.logger, "Failed to start: {:?}", msg);
|
||||||
|
|
||||||
self.uri
|
self.uri.lock().unwrap().1 = false;
|
||||||
.lock()
|
|
||||||
.unwrap()
|
|
||||||
.1 = false;
|
|
||||||
self.post_message(msg);
|
self.post_message(msg);
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
@ -165,10 +165,7 @@ impl SinkWrapper {
|
||||||
match sink.stop() {
|
match sink.stop() {
|
||||||
Ok(..) => {
|
Ok(..) => {
|
||||||
trace!(self.logger, "Stopped successfully");
|
trace!(self.logger, "Stopped successfully");
|
||||||
self.uri
|
self.uri.lock().unwrap().1 = false;
|
||||||
.lock()
|
|
||||||
.unwrap()
|
|
||||||
.1 = false;
|
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
Err(ref msg) => {
|
Err(ref msg) => {
|
||||||
|
@ -356,7 +353,8 @@ unsafe extern "C" fn sink_class_init(klass: glib::gpointer, klass_data: glib::gp
|
||||||
let sink_info = &*(klass_data as *const SinkInfo);
|
let sink_info = &*(klass_data as *const SinkInfo);
|
||||||
|
|
||||||
{
|
{
|
||||||
let gobject_klass = &mut sink_klass.parent_class
|
let gobject_klass = &mut sink_klass
|
||||||
|
.parent_class
|
||||||
.parent_class
|
.parent_class
|
||||||
.parent_class
|
.parent_class
|
||||||
.parent_class;
|
.parent_class;
|
||||||
|
|
|
@ -122,7 +122,10 @@ impl SourceWrapper {
|
||||||
|
|
||||||
fn get_uri(&self) -> Option<String> {
|
fn get_uri(&self) -> Option<String> {
|
||||||
let uri_storage = &self.uri.lock().unwrap();
|
let uri_storage = &self.uri.lock().unwrap();
|
||||||
uri_storage.0.as_ref().map(|uri| String::from(uri.as_str()))
|
uri_storage
|
||||||
|
.0
|
||||||
|
.as_ref()
|
||||||
|
.map(|uri| String::from(uri.as_str()))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_seekable(&self) -> bool {
|
fn is_seekable(&self) -> bool {
|
||||||
|
@ -160,10 +163,7 @@ impl SourceWrapper {
|
||||||
Err(ref msg) => {
|
Err(ref msg) => {
|
||||||
error!(self.logger, "Failed to start: {:?}", msg);
|
error!(self.logger, "Failed to start: {:?}", msg);
|
||||||
|
|
||||||
self.uri
|
self.uri.lock().unwrap().1 = false;
|
||||||
.lock()
|
|
||||||
.unwrap()
|
|
||||||
.1 = false;
|
|
||||||
self.post_message(msg);
|
self.post_message(msg);
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
@ -178,10 +178,7 @@ impl SourceWrapper {
|
||||||
match source.stop() {
|
match source.stop() {
|
||||||
Ok(..) => {
|
Ok(..) => {
|
||||||
trace!(self.logger, "Stopped successfully");
|
trace!(self.logger, "Stopped successfully");
|
||||||
self.uri
|
self.uri.lock().unwrap().1 = false;
|
||||||
.lock()
|
|
||||||
.unwrap()
|
|
||||||
.1 = false;
|
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
Err(ref msg) => {
|
Err(ref msg) => {
|
||||||
|
@ -434,7 +431,8 @@ unsafe extern "C" fn source_class_init(klass: glib::gpointer, klass_data: glib::
|
||||||
let source_info = &*(klass_data as *const SourceInfo);
|
let source_info = &*(klass_data as *const SourceInfo);
|
||||||
|
|
||||||
{
|
{
|
||||||
let gobject_klass = &mut src_klass.parent_class
|
let gobject_klass = &mut src_klass
|
||||||
|
.parent_class
|
||||||
.parent_class
|
.parent_class
|
||||||
.parent_class
|
.parent_class
|
||||||
.parent_class
|
.parent_class
|
||||||
|
|
|
@ -45,7 +45,8 @@ impl Stream {
|
||||||
flags: StreamFlags)
|
flags: StreamFlags)
|
||||||
-> Self {
|
-> Self {
|
||||||
let stream_id_cstr = CString::new(stream_id).unwrap();
|
let stream_id_cstr = CString::new(stream_id).unwrap();
|
||||||
let caps = caps.map(|caps| unsafe { caps.as_ptr() }).unwrap_or(ptr::null_mut());
|
let caps = caps.map(|caps| unsafe { caps.as_ptr() })
|
||||||
|
.unwrap_or(ptr::null_mut());
|
||||||
|
|
||||||
Stream(unsafe {
|
Stream(unsafe {
|
||||||
gst::gst_stream_new(stream_id_cstr.as_ptr(),
|
gst::gst_stream_new(stream_id_cstr.as_ptr(),
|
||||||
|
@ -93,7 +94,8 @@ impl Stream {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_caps(&self, caps: Option<GstRc<Caps>>) {
|
pub fn set_caps(&self, caps: Option<GstRc<Caps>>) {
|
||||||
let ptr = caps.map(|caps| unsafe { caps.as_ptr() }).unwrap_or(ptr::null_mut());
|
let ptr = caps.map(|caps| unsafe { caps.as_ptr() })
|
||||||
|
.unwrap_or(ptr::null_mut());
|
||||||
|
|
||||||
unsafe { gst::gst_stream_set_caps(self.0, ptr) }
|
unsafe { gst::gst_stream_set_caps(self.0, ptr) }
|
||||||
}
|
}
|
||||||
|
@ -107,7 +109,8 @@ impl Stream {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_tags(&self, tags: Option<TagList>) {
|
pub fn set_tags(&self, tags: Option<TagList>) {
|
||||||
let ptr = tags.map(|tags| unsafe { tags.as_ptr() }).unwrap_or(ptr::null_mut());
|
let ptr = tags.map(|tags| unsafe { tags.as_ptr() })
|
||||||
|
.unwrap_or(ptr::null_mut());
|
||||||
|
|
||||||
unsafe { gst::gst_stream_set_tags(self.0, ptr) }
|
unsafe { gst::gst_stream_set_tags(self.0, ptr) }
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue