codec/packet: add rescale_ts() method

This commit is contained in:
lummax 2015-08-26 10:29:37 +02:00 committed by meh
parent 40c13a7238
commit f2fc59f25d

View File

@ -9,7 +9,7 @@ use std::mem;
use libc::c_int; use libc::c_int;
use ffi::*; use ffi::*;
use ::{Error, format}; use ::{Error, Rational, format};
pub struct Packet(AVPacket); pub struct Packet(AVPacket);
@ -59,6 +59,15 @@ impl Packet {
} }
} }
pub fn rescale_ts<S, D>(&mut self, source: S, destination: D)
where S: Into<Rational>,
D: Into<Rational>
{
unsafe {
av_packet_rescale_ts(self.as_mut_ptr(), source.into().into(), destination.into().into());
}
}
pub fn flags(&self) -> Flags { pub fn flags(&self) -> Flags {
Flags::from_bits_truncate(self.0.flags) Flags::from_bits_truncate(self.0.flags)
} }