diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2021-09-18 10:46:55 +0300 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2021-09-18 11:58:59 +0300 |
commit | f4613bfc072c2f8eda1e7c803bbc4788852f3117 (patch) | |
tree | 0dabd0f764fc376bd4e99e99aa0a1c113f8aef63 | |
parent | 484cad00cea9294e8c464e70fc999da5e51cf4eb (diff) |
Use Buffer::from_mut_slice() in more places
This allows downstream to map the memory mutable.
-rw-r--r-- | net/rusoto/src/aws_transcribe_parse/imp.rs | 6 | ||||
-rw-r--r-- | text/json/src/jsongstparse/imp.rs | 4 | ||||
-rw-r--r-- | video/ffv1/src/ffv1dec/imp.rs | 2 |
3 files changed, 7 insertions, 5 deletions
diff --git a/net/rusoto/src/aws_transcribe_parse/imp.rs b/net/rusoto/src/aws_transcribe_parse/imp.rs index d471f32d2..88d475dd6 100644 --- a/net/rusoto/src/aws_transcribe_parse/imp.rs +++ b/net/rusoto/src/aws_transcribe_parse/imp.rs @@ -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(); diff --git a/text/json/src/jsongstparse/imp.rs b/text/json/src/jsongstparse/imp.rs index 782899226..c3331c7fe 100644 --- a/text/json/src/jsongstparse/imp.rs +++ b/text/json/src/jsongstparse/imp.rs @@ -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)) { diff --git a/video/ffv1/src/ffv1dec/imp.rs b/video/ffv1/src/ffv1dec/imp.rs index cf4125a37..dd1b3e01a 100644 --- a/video/ffv1/src/ffv1dec/imp.rs +++ b/video/ffv1/src/ffv1dec/imp.rs @@ -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); |