diff --git a/src/zm_ffmpeg.cpp b/src/zm_ffmpeg.cpp index de137668f..1d7bfd065 100644 --- a/src/zm_ffmpeg.cpp +++ b/src/zm_ffmpeg.cpp @@ -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; } } diff --git a/src/zm_ffmpeg.h b/src/zm_ffmpeg.h index 3a6c7b449..cd5f4cbed 100644 --- a/src/zm_ffmpeg.h +++ b/src/zm_ffmpeg.h @@ -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 *);