summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libavcodec/8bps.c2
-rw-r--r--libavcodec/h263dec.c2
-rw-r--r--libavcodec/h264_slice.c10
-rw-r--r--libavcodec/internal.h7
-rw-r--r--libavcodec/mpeg12dec.c4
-rw-r--r--libavcodec/utils.c5
-rw-r--r--libavcodec/vc1dec.c2
7 files changed, 22 insertions, 10 deletions
diff --git a/libavcodec/8bps.c b/libavcodec/8bps.c
index cfeb4867d1..3fd15e05eb 100644
--- a/libavcodec/8bps.c
+++ b/libavcodec/8bps.c
@@ -159,7 +159,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
c->planemap[0] = 0; // 1st plane is palette indexes
break;
case 24:
- avctx->pix_fmt = avctx->get_format(avctx, pixfmt_rgb24);
+ avctx->pix_fmt = ff_get_format(avctx, pixfmt_rgb24);
c->planes = 3;
c->planemap[0] = 2; // 1st plane is red
c->planemap[1] = 1; // 2nd plane is green
diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index ad1b31d036..c430cf9298 100644
--- a/libavcodec/h263dec.c
+++ b/libavcodec/h263dec.c
@@ -57,7 +57,7 @@ av_cold int ff_h263_decode_init(AVCodecContext *avctx)
if (avctx->codec->id == AV_CODEC_ID_MSS2)
avctx->pix_fmt = AV_PIX_FMT_YUV420P;
else
- avctx->pix_fmt = avctx->get_format(avctx, avctx->codec->pix_fmts);
+ avctx->pix_fmt = ff_get_format(avctx, avctx->codec->pix_fmts);
s->unrestricted_mv = 1;
/* select sub codec */
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index cc1b8965ed..5db8ef94b9 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -1008,11 +1008,11 @@ static enum AVPixelFormat get_pixel_format(H264Context *h)
return h->avctx->color_range == AVCOL_RANGE_JPEG ? AV_PIX_FMT_YUVJ422P
: AV_PIX_FMT_YUV422P;
} else {
- return h->avctx->get_format(h->avctx, h->avctx->codec->pix_fmts ?
- h->avctx->codec->pix_fmts :
- h->avctx->color_range == AVCOL_RANGE_JPEG ?
- h264_hwaccel_pixfmt_list_jpeg_420 :
- h264_hwaccel_pixfmt_list_420);
+ return ff_get_format(h->avctx, h->avctx->codec->pix_fmts ?
+ h->avctx->codec->pix_fmts :
+ h->avctx->color_range == AVCOL_RANGE_JPEG ?
+ h264_hwaccel_pixfmt_list_jpeg_420 :
+ h264_hwaccel_pixfmt_list_420);
}
break;
default:
diff --git a/libavcodec/internal.h b/libavcodec/internal.h
index 268a7584b2..678d6f10ce 100644
--- a/libavcodec/internal.h
+++ b/libavcodec/internal.h
@@ -187,6 +187,13 @@ int ff_side_data_update_matrix_encoding(AVFrame *frame,
enum AVMatrixEncoding matrix_encoding);
/**
+ * Select the (possibly hardware accelerated) pixel format.
+ * This is a wrapper around AVCodecContext.get_format() and should be used
+ * instead of calling get_format() directly.
+ */
+int ff_get_format(AVCodecContext *avctx, const enum AVPixelFormat *fmt);
+
+/**
* Set various frame properties from the codec context / packet data.
*/
int ff_decode_frame_props(AVCodecContext *avctx, AVFrame *frame);
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 97c82ceeda..c2cafe5f23 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -1188,12 +1188,12 @@ static enum AVPixelFormat mpeg_get_pixelformat(AVCodecContext *avctx)
#if FF_API_XVMC
FF_DISABLE_DEPRECATION_WARNINGS
if (avctx->xvmc_acceleration)
- return avctx->get_format(avctx, pixfmt_xvmc_mpg2_420);
+ return ff_get_format(avctx, pixfmt_xvmc_mpg2_420);
FF_ENABLE_DEPRECATION_WARNINGS
#endif /* FF_API_XVMC */
if (s->chroma_format < 2)
- return avctx->get_format(avctx, mpeg12_hwaccel_pixfmt_list_420);
+ return ff_get_format(avctx, mpeg12_hwaccel_pixfmt_list_420);
else if (s->chroma_format == 2)
return AV_PIX_FMT_YUV422P;
else
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index f14d1ebe3d..c6d793ba60 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -864,6 +864,11 @@ enum AVPixelFormat avcodec_default_get_format(struct AVCodecContext *s, const en
return fmt[0];
}
+int ff_get_format(AVCodecContext *avctx, const enum AVPixelFormat *fmt)
+{
+ return avctx->get_format(avctx, fmt);
+}
+
#if FF_API_AVFRAME_LAVC
void avcodec_get_frame_defaults(AVFrame *frame)
{
diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index 98259242bd..6590e8b079 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -5595,7 +5595,7 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx)
if (!avctx->extradata_size || !avctx->extradata)
return -1;
if (!(avctx->flags & CODEC_FLAG_GRAY))
- avctx->pix_fmt = avctx->get_format(avctx, avctx->codec->pix_fmts);
+ avctx->pix_fmt = ff_get_format(avctx, avctx->codec->pix_fmts);
else
avctx->pix_fmt = AV_PIX_FMT_GRAY8;
avctx->hwaccel = ff_find_hwaccel(avctx);