codec: deprecate encoder's encode/flush and decoder's decode

This commit is contained in:
Zhiming Wang 2020-08-08 01:16:44 +08:00
parent 55c8b5fa02
commit 6f44fb79fd
No known key found for this signature in database
GPG Key ID: 5B58F95EC95965D8
4 changed files with 30 additions and 0 deletions

View File

@ -12,6 +12,11 @@ use {packet, AudioService, ChannelLayout, Error};
pub struct Audio(pub Opened);
impl Audio {
#[deprecated(
since = "4.4.0",
note = "Underlying API avcodec_decode_audio4 has been deprecated since FFmpeg 3.1; \
consider switching to send_packet() and receive_frame()"
)]
pub fn decode<P: packet::Ref>(
&mut self,
packet: &P,

View File

@ -14,6 +14,11 @@ use {packet, Error, FieldOrder, Rational};
pub struct Video(pub Opened);
impl Video {
#[deprecated(
since = "4.4.0",
note = "Underlying API avcodec_decode_video2 has been deprecated since FFmpeg 3.1; \
consider switching to send_packet() and receive_frame()"
)]
pub fn decode<P: packet::Ref>(
&mut self,
packet: &P,

View File

@ -140,6 +140,11 @@ impl AsMut<Context> for Audio {
pub struct Encoder(pub Audio);
impl Encoder {
#[deprecated(
since = "4.4.0",
note = "Underlying API avcodec_encode_audio2 has been deprecated since FFmpeg 3.1; \
consider switching to send_frame() and receive_packet()"
)]
pub fn encode<P: packet::Mut>(
&mut self,
frame: &frame::Audio,
@ -164,6 +169,11 @@ impl Encoder {
}
}
#[deprecated(
since = "4.4.0",
note = "Underlying API avcodec_encode_audio2 has been deprecated since FFmpeg 3.1; \
consider switching to send_eof() and receive_packet()"
)]
pub fn flush<P: packet::Mut>(&mut self, out: &mut P) -> Result<bool, Error> {
unsafe {
let mut got: c_int = 0;

View File

@ -415,6 +415,11 @@ impl AsMut<Context> for Video {
pub struct Encoder(pub Video);
impl Encoder {
#[deprecated(
since = "4.4.0",
note = "Underlying API avcodec_encode_video2 has been deprecated since FFmpeg 3.1; \
consider switching to send_frame() and receive_packet()"
)]
#[inline]
pub fn encode<P: packet::Mut>(
&mut self,
@ -443,6 +448,11 @@ impl Encoder {
}
}
#[deprecated(
since = "4.4.0",
note = "Underlying API avcodec_encode_video2 has been deprecated since FFmpeg 3.1; \
consider switching to send_frame() and receive_packet()"
)]
#[inline]
pub fn flush<P: packet::Mut>(&mut self, out: &mut P) -> Result<bool, Error> {
unsafe {