mirror of
https://github.com/encounter/rust-ffmpeg.git
synced 2026-07-10 21:18:39 -07:00
feat(codec): access time_base on context
This commit is contained in:
+11
-1
@@ -5,7 +5,7 @@ use libc::c_int;
|
||||
#[cfg(feature = "ffmpeg_3_1")]
|
||||
use super::Parameters;
|
||||
use super::{decoder::Decoder, encoder::Encoder, threading, Compliance, Debug, Flags, Id};
|
||||
use crate::{ffi::*, media, Codec, Error};
|
||||
use crate::{ffi::*, media, Codec, Error, Rational};
|
||||
|
||||
pub struct Context {
|
||||
ptr: *mut AVCodecContext,
|
||||
@@ -121,6 +121,16 @@ impl Context {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn time_base(&self) -> Rational {
|
||||
unsafe { Rational::from((*self.as_ptr()).time_base) }
|
||||
}
|
||||
|
||||
pub fn set_time_base<R: Into<Rational>>(&mut self, value: R) {
|
||||
unsafe {
|
||||
(*self.as_mut_ptr()).time_base = value.into().into();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Context {
|
||||
|
||||
@@ -134,16 +134,6 @@ impl Encoder {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn time_base(&self) -> Rational {
|
||||
unsafe { Rational::from((*self.as_ptr()).time_base) }
|
||||
}
|
||||
|
||||
pub fn set_time_base<R: Into<Rational>>(&mut self, value: R) {
|
||||
unsafe {
|
||||
(*self.as_mut_ptr()).time_base = value.into().into();
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_frame_rate<R: Into<Rational>>(&mut self, value: Option<R>) {
|
||||
unsafe {
|
||||
if let Some(value) = value {
|
||||
|
||||
Reference in New Issue
Block a user