change how fix_deprecated_pix_fmt works to return a value so we can use it elsewhere

This commit is contained in:
Isaac Connor 2021-02-18 13:42:33 -05:00
parent 04c13c6ff3
commit 8a329df5ec
2 changed files with 7 additions and 11 deletions

View File

@ -374,23 +374,19 @@ int check_sample_fmt(AVCodec *codec, enum AVSampleFormat sample_fmt) {
return 0;
}
void fix_deprecated_pix_fmt(AVCodecContext *ctx) {
enum AVPixelFormat fix_deprecated_pix_fmt(enum AVPixelFormat fmt) {
// Fix deprecated formats
switch ( ctx->pix_fmt ) {
switch ( fmt ) {
case AV_PIX_FMT_YUVJ422P :
ctx->pix_fmt = AV_PIX_FMT_YUV422P;
break;
return AV_PIX_FMT_YUV422P;
case AV_PIX_FMT_YUVJ444P :
ctx->pix_fmt = AV_PIX_FMT_YUV444P;
break;
return AV_PIX_FMT_YUV444P;
case AV_PIX_FMT_YUVJ440P :
ctx->pix_fmt = AV_PIX_FMT_YUV440P;
break;
return AV_PIX_FMT_YUV440P;
case AV_PIX_FMT_NONE :
case AV_PIX_FMT_YUVJ420P :
default:
ctx->pix_fmt = AV_PIX_FMT_YUV420P;
break;
return AV_PIX_FMT_YUV420P;
}
}

View File

@ -423,7 +423,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 *);
enum AVPixelFormat fix_deprecated_pix_fmt(enum AVPixelFormat );
bool is_video_stream(const AVStream *);
bool is_audio_stream(const AVStream *);