Skip to content

Commit

Permalink
Revise transcode test (#149)
Browse files Browse the repository at this point in the history
* Revise transcode test

* Rename transcoding test to transcode
  • Loading branch information
ldm0 authored Jan 28, 2024
1 parent 2bdcfc2 commit 8174ea5
Show file tree
Hide file tree
Showing 5 changed files with 591 additions and 576 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,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

0 comments on commit 8174ea5

Please sign in to comment.