mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
refactor DST_STRIDE_RGBA
This commit is contained in:
@@ -306,7 +306,7 @@ impl Decoder {
|
||||
pub fn handle_video_frame(
|
||||
&mut self,
|
||||
frame: &video_frame::Union,
|
||||
fmt: ImageFormat,
|
||||
fmt: (ImageFormat, usize),
|
||||
rgb: &mut Vec<u8>,
|
||||
) -> ResultType<bool> {
|
||||
match frame {
|
||||
@@ -352,7 +352,7 @@ impl Decoder {
|
||||
fn handle_vp9s_video_frame(
|
||||
decoder: &mut VpxDecoder,
|
||||
vp9s: &EncodedVideoFrames,
|
||||
fmt: ImageFormat,
|
||||
fmt: (ImageFormat, usize),
|
||||
rgb: &mut Vec<u8>,
|
||||
) -> ResultType<bool> {
|
||||
let mut last_frame = Image::new();
|
||||
@@ -369,7 +369,7 @@ impl Decoder {
|
||||
if last_frame.is_null() {
|
||||
Ok(false)
|
||||
} else {
|
||||
last_frame.to(fmt, 1, rgb);
|
||||
last_frame.to(fmt.0, fmt.1, rgb);
|
||||
Ok(true)
|
||||
}
|
||||
}
|
||||
@@ -378,7 +378,7 @@ impl Decoder {
|
||||
fn handle_hw_video_frame(
|
||||
decoder: &mut HwDecoder,
|
||||
frames: &EncodedVideoFrames,
|
||||
fmt: ImageFormat,
|
||||
fmt: (ImageFormat, usize),
|
||||
raw: &mut Vec<u8>,
|
||||
i420: &mut Vec<u8>,
|
||||
) -> ResultType<bool> {
|
||||
@@ -398,7 +398,7 @@ impl Decoder {
|
||||
fn handle_mediacodec_video_frame(
|
||||
decoder: &mut MediaCodecDecoder,
|
||||
frames: &EncodedVideoFrames,
|
||||
fmt: ImageFormat,
|
||||
fmt: (ImageFormat, usize),
|
||||
raw: &mut Vec<u8>,
|
||||
) -> ResultType<bool> {
|
||||
let mut ret = false;
|
||||
|
||||
@@ -236,7 +236,13 @@ pub struct HwDecoderImage<'a> {
|
||||
}
|
||||
|
||||
impl HwDecoderImage<'_> {
|
||||
pub fn to_fmt(&self, fmt: ImageFormat, fmt_data: &mut Vec<u8>, i420: &mut Vec<u8>) -> ResultType<()> {
|
||||
// take dst_stride into account when you convert
|
||||
pub fn to_fmt(
|
||||
&self,
|
||||
(fmt, dst_stride): (ImageFormat, usize),
|
||||
fmt_data: &mut Vec<u8>,
|
||||
i420: &mut Vec<u8>,
|
||||
) -> ResultType<()> {
|
||||
let frame = self.frame;
|
||||
match frame.pixfmt {
|
||||
AVPixelFormat::AV_PIX_FMT_NV12 => hw::hw_nv12_to(
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use hbb_common::{log, anyhow::Error, bail, ResultType};
|
||||
use hbb_common::{anyhow::Error, bail, log, ResultType};
|
||||
use ndk::media::media_codec::{MediaCodec, MediaCodecDirection, MediaFormat};
|
||||
use std::ops::Deref;
|
||||
use std::{
|
||||
@@ -50,7 +50,13 @@ impl MediaCodecDecoder {
|
||||
MediaCodecDecoders { h264, h265 }
|
||||
}
|
||||
|
||||
pub fn decode(&mut self, data: &[u8], fmt: ImageFormat, raw: &mut Vec<u8>) -> ResultType<bool> {
|
||||
// take dst_stride into account please
|
||||
pub fn decode(
|
||||
&mut self,
|
||||
data: &[u8],
|
||||
(fmt, dst_stride): (ImageFormat, usize),
|
||||
raw: &mut Vec<u8>,
|
||||
) -> ResultType<bool> {
|
||||
match self.dequeue_input_buffer(Duration::from_millis(10))? {
|
||||
Some(mut input_buffer) => {
|
||||
let mut buf = input_buffer.buffer_mut();
|
||||
|
||||
Reference in New Issue
Block a user