Use Buffer::from_mut_slice() in more places

This allows downstream to map the memory mutable.
This commit is contained in:
Sebastian Dröge 2021-09-18 10:46:55 +03:00
parent 484cad00ce
commit f4613bfc07
3 changed files with 7 additions and 5 deletions

View file

@ -141,7 +141,8 @@ impl TranscribeParse {
"punctuation" => {
if !item.alternatives.is_empty() {
let alternative = item.alternatives.remove(0);
let mut outbuf = gst::Buffer::from_slice(alternative.content.into_bytes());
let mut outbuf =
gst::Buffer::from_mut_slice(alternative.content.into_bytes());
{
let outbuf = outbuf.get_mut().unwrap();
@ -198,7 +199,8 @@ impl TranscribeParse {
if !(item.alternatives.is_empty()) {
let alternative = item.alternatives.remove(0);
let mut outbuf = gst::Buffer::from_slice(alternative.content.into_bytes());
let mut outbuf =
gst::Buffer::from_mut_slice(alternative.content.into_bytes());
{
let outbuf = outbuf.get_mut().unwrap();

View file

@ -257,10 +257,10 @@ impl JsonGstParse {
);
if !seeking {
let data = data.to_string().clone();
let data = data.to_string();
let mut events = state.create_events(element);
let mut buffer = gst::Buffer::from_slice(data);
let mut buffer = gst::Buffer::from_mut_slice(data.into_bytes());
if let Some(last_position) = state.last_position {
if let Some(duration) = pts.map(|pts| pts.checked_sub(last_position)) {

View file

@ -174,7 +174,7 @@ impl Ffv1Dec {
// FIXME: we can also do this if we have video meta support and differing strides
let mem = if src_stride == dest_stride {
// Just wrap the decoded frame vecs and push them out
gst::Memory::from_slice(decoded_plane)
gst::Memory::from_mut_slice(decoded_plane)
} else {
// Mismatched stride, let's copy
let out_plane = gst::Memory::with_size(dest_stride * comp_height);