create fix_deprecated_pix_fmt function to adjust deprecated pixfmts

pull/3122/head
Isaac Connor 2021-01-15 17:01:59 -05:00
parent 0f7c46e2cc
commit 430d64ba67
2 changed files with 22 additions and 0 deletions

View File

@ -425,6 +425,26 @@ int check_sample_fmt(AVCodec *codec, enum AVSampleFormat sample_fmt) {
return 0;
}
void fix_deprecated_pix_fmt(AVCodecContext *ctx) {
// Fix deprecated formats
switch ( ctx->pix_fmt ) {
case AV_PIX_FMT_YUVJ422P :
ctx->pix_fmt = AV_PIX_FMT_YUV422P;
break;
case AV_PIX_FMT_YUVJ444P :
ctx->pix_fmt = AV_PIX_FMT_YUV444P;
break;
case AV_PIX_FMT_YUVJ440P :
ctx->pix_fmt = AV_PIX_FMT_YUV440P;
break;
case AV_PIX_FMT_NONE :
case AV_PIX_FMT_YUVJ420P :
default:
ctx->pix_fmt = AV_PIX_FMT_YUV420P;
break;
}
}
#if LIBAVCODEC_VERSION_CHECK(56, 8, 0, 60, 100)
#else
unsigned int zm_av_packet_ref( AVPacket *dst, AVPacket *src ) {

View File

@ -379,6 +379,7 @@ void zm_dump_codecpar(const AVCodecParameters *par);
#endif
int check_sample_fmt(AVCodec *codec, enum AVSampleFormat sample_fmt);
void fix_deprecated_pix_fmt(AVCodecContext *);
bool is_video_stream(const AVStream *);
bool is_audio_stream(const AVStream *);
@ -423,4 +424,5 @@ int zm_add_samples_to_fifo(AVAudioFifo *fifo, AVFrame *frame);
int zm_get_samples_from_fifo(AVAudioFifo *fifo, AVFrame *frame);
#endif // ZM_FFMPEG_H