Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revise transcode test #149

Merged
merged 2 commits into from
Jan 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ jobs:
LLVM_CONFIG_PATH: ${{ github.workspace }}/clang/bin/llvm-config
run: |
copy ${{ github.workspace }}/ffmpeg_prebuilt_cross/lib/libffmpeg.dll .
cargo test --tests --target i686-pc-windows-msvc -vv -- --skip transcoding
cargo test --tests --target i686-pc-windows-msvc -vv -- --skip transcode

# Check if correct documentation can be generated by docs.rs
docs_rs_check:
Expand Down
49 changes: 47 additions & 2 deletions src/avfilter/avfilter.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use std::{
ffi::CStr,
mem::size_of,
mem::{size_of, MaybeUninit},
ops::Drop,
ptr::{self, NonNull},
};

use crate::{
avutil::AVFrame,
avutil::{AVChannelLayout, AVFrame},
error::{Result, RsmpegError},
ffi,
shared::*,
Expand Down Expand Up @@ -100,6 +100,51 @@ impl AVFilterContext {
Err(err) => Err(RsmpegError::BufferSinkGetFrameError(err)),
}
}

pub fn get_type(&self) -> i32 {
unsafe { ffi::av_buffersink_get_type(self.as_ptr()) }
}

pub fn get_time_base(&self) -> ffi::AVRational {
unsafe { ffi::av_buffersink_get_time_base(self.as_ptr()) }
}

pub fn get_format(&self) -> i32 {
unsafe { ffi::av_buffersink_get_format(self.as_ptr()) }
}

pub fn get_frame_rate(&self) -> ffi::AVRational {
unsafe { ffi::av_buffersink_get_frame_rate(self.as_ptr()) }
}

pub fn get_w(&self) -> i32 {
unsafe { ffi::av_buffersink_get_w(self.as_ptr()) }
}

pub fn get_h(&self) -> i32 {
unsafe { ffi::av_buffersink_get_h(self.as_ptr()) }
}

pub fn get_sample_aspect_ratio(&self) -> ffi::AVRational {
unsafe { ffi::av_buffersink_get_sample_aspect_ratio(self.as_ptr()) }
}

pub fn get_channels(&self) -> i32 {
unsafe { ffi::av_buffersink_get_channels(self.as_ptr()) }
}

pub fn get_ch_layout(&self) -> AVChannelLayout {
let mut ch_layout = MaybeUninit::<ffi::AVChannelLayout>::uninit();
unsafe { ffi::av_buffersink_get_ch_layout(self.as_ptr(), ch_layout.as_mut_ptr()) }
.upgrade()
.unwrap();
let ch_layout = Box::leak(Box::new(unsafe { ch_layout.assume_init() }));
unsafe { AVChannelLayout::from_raw(NonNull::new(ch_layout).unwrap()) }
}

pub fn get_sample_rate(&self) -> i32 {
unsafe { ffi::av_buffersink_get_sample_rate(self.as_ptr()) }
}
}

wrap!(AVFilterInOut: ffi::AVFilterInOut);
Expand Down
1 change: 1 addition & 0 deletions src/avutil/frame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ settable!(AVFrame {
width: i32,
height: i32,
pts: i64,
time_base: ffi::AVRational,
pict_type: ffi::AVPictureType,
nb_samples: i32,
format: i32,
Expand Down
Loading