diff --git a/doc/APIchanges b/doc/APIchanges
index 457a76971bd45eaa96ce0763535206dcddc60a96..44a740e51f456ab83c9f623ba970225343188ef2 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,9 @@ libavutil:     2017-10-21
 
 API changes, most recent first:
 
+2017-xx-xx - xxxxxxx - lavc 58.6.100 - avcodec.h
+  Add const to AVCodecContext.hwaccel.
+
 2017-11-xx - xxxxxxx - lavc 58.5.100 - avcodec.h
   Deprecate user visibility of the AVHWAccel structure and the functions
   av_register_hwaccel() and av_hwaccel_next().
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 1ae0344bb2e39224356e968fe33dd93d04d6ce2f..0972df0bde2383295e66638b76337252060feea5 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -2635,7 +2635,7 @@ typedef struct AVCodecContext {
      * - encoding: unused.
      * - decoding: Set by libavcodec
      */
-    struct AVHWAccel *hwaccel;
+    const struct AVHWAccel *hwaccel;
 
     /**
      * Hardware accelerator context.
diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index f2a23735ace7d713f18004b63a0f9377ef13e43b..3f5b086f7e4fb6a91385fcb56608bebcdb3b8cc9 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -1252,7 +1252,7 @@ static int hwaccel_init(AVCodecContext *avctx,
             return AVERROR(ENOMEM);
     }
 
-    avctx->hwaccel = (AVHWAccel*)hwaccel;
+    avctx->hwaccel = hwaccel;
     if (hwaccel->init) {
         err = hwaccel->init(avctx);
         if (err < 0) {
diff --git a/libavcodec/dxva2_h264.c b/libavcodec/dxva2_h264.c
index ee35b20e829ea59cacb8ea45c05bfd8849ce96e1..a4278c80b5258cad573cb6eeb82524ef4b51376a 100644
--- a/libavcodec/dxva2_h264.c
+++ b/libavcodec/dxva2_h264.c
@@ -518,7 +518,7 @@ static int dxva2_h264_end_frame(AVCodecContext *avctx)
 }
 
 #if CONFIG_H264_DXVA2_HWACCEL
-AVHWAccel ff_h264_dxva2_hwaccel = {
+const AVHWAccel ff_h264_dxva2_hwaccel = {
     .name           = "h264_dxva2",
     .type           = AVMEDIA_TYPE_VIDEO,
     .id             = AV_CODEC_ID_H264,
@@ -535,7 +535,7 @@ AVHWAccel ff_h264_dxva2_hwaccel = {
 #endif
 
 #if CONFIG_H264_D3D11VA_HWACCEL
-AVHWAccel ff_h264_d3d11va_hwaccel = {
+const AVHWAccel ff_h264_d3d11va_hwaccel = {
     .name           = "h264_d3d11va",
     .type           = AVMEDIA_TYPE_VIDEO,
     .id             = AV_CODEC_ID_H264,
@@ -552,7 +552,7 @@ AVHWAccel ff_h264_d3d11va_hwaccel = {
 #endif
 
 #if CONFIG_H264_D3D11VA2_HWACCEL
-AVHWAccel ff_h264_d3d11va2_hwaccel = {
+const AVHWAccel ff_h264_d3d11va2_hwaccel = {
     .name           = "h264_d3d11va2",
     .type           = AVMEDIA_TYPE_VIDEO,
     .id             = AV_CODEC_ID_H264,
diff --git a/libavcodec/dxva2_hevc.c b/libavcodec/dxva2_hevc.c
index 542afc383a6cfb720defaf83846de2ca530f8b05..0ae07d304f1b9aed3595e3f833ecddd5b6e15dcf 100644
--- a/libavcodec/dxva2_hevc.c
+++ b/libavcodec/dxva2_hevc.c
@@ -422,7 +422,7 @@ static int dxva2_hevc_end_frame(AVCodecContext *avctx)
 }
 
 #if CONFIG_HEVC_DXVA2_HWACCEL
-AVHWAccel ff_hevc_dxva2_hwaccel = {
+const AVHWAccel ff_hevc_dxva2_hwaccel = {
     .name           = "hevc_dxva2",
     .type           = AVMEDIA_TYPE_VIDEO,
     .id             = AV_CODEC_ID_HEVC,
@@ -439,7 +439,7 @@ AVHWAccel ff_hevc_dxva2_hwaccel = {
 #endif
 
 #if CONFIG_HEVC_D3D11VA_HWACCEL
-AVHWAccel ff_hevc_d3d11va_hwaccel = {
+const AVHWAccel ff_hevc_d3d11va_hwaccel = {
     .name           = "hevc_d3d11va",
     .type           = AVMEDIA_TYPE_VIDEO,
     .id             = AV_CODEC_ID_HEVC,
@@ -456,7 +456,7 @@ AVHWAccel ff_hevc_d3d11va_hwaccel = {
 #endif
 
 #if CONFIG_HEVC_D3D11VA2_HWACCEL
-AVHWAccel ff_hevc_d3d11va2_hwaccel = {
+const AVHWAccel ff_hevc_d3d11va2_hwaccel = {
     .name           = "hevc_d3d11va2",
     .type           = AVMEDIA_TYPE_VIDEO,
     .id             = AV_CODEC_ID_HEVC,
diff --git a/libavcodec/dxva2_mpeg2.c b/libavcodec/dxva2_mpeg2.c
index df5fe59a7d741f64c52893a1192d4537615731d8..a57778b4271dd0e34f33b8c4ede2e48eda678595 100644
--- a/libavcodec/dxva2_mpeg2.c
+++ b/libavcodec/dxva2_mpeg2.c
@@ -317,7 +317,7 @@ static int dxva2_mpeg2_end_frame(AVCodecContext *avctx)
 }
 
 #if CONFIG_MPEG2_DXVA2_HWACCEL
-AVHWAccel ff_mpeg2_dxva2_hwaccel = {
+const AVHWAccel ff_mpeg2_dxva2_hwaccel = {
     .name           = "mpeg2_dxva2",
     .type           = AVMEDIA_TYPE_VIDEO,
     .id             = AV_CODEC_ID_MPEG2VIDEO,
@@ -334,7 +334,7 @@ AVHWAccel ff_mpeg2_dxva2_hwaccel = {
 #endif
 
 #if CONFIG_MPEG2_D3D11VA_HWACCEL
-AVHWAccel ff_mpeg2_d3d11va_hwaccel = {
+const AVHWAccel ff_mpeg2_d3d11va_hwaccel = {
     .name           = "mpeg2_d3d11va",
     .type           = AVMEDIA_TYPE_VIDEO,
     .id             = AV_CODEC_ID_MPEG2VIDEO,
@@ -351,7 +351,7 @@ AVHWAccel ff_mpeg2_d3d11va_hwaccel = {
 #endif
 
 #if CONFIG_MPEG2_D3D11VA2_HWACCEL
-AVHWAccel ff_mpeg2_d3d11va2_hwaccel = {
+const AVHWAccel ff_mpeg2_d3d11va2_hwaccel = {
     .name           = "mpeg2_d3d11va2",
     .type           = AVMEDIA_TYPE_VIDEO,
     .id             = AV_CODEC_ID_MPEG2VIDEO,
diff --git a/libavcodec/dxva2_vc1.c b/libavcodec/dxva2_vc1.c
index f21c5d5544f9cbe6d44ba1e839e79c24ad3f4fe7..f22c73cd1ebaf7470bab34ca764df6269d50341d 100644
--- a/libavcodec/dxva2_vc1.c
+++ b/libavcodec/dxva2_vc1.c
@@ -378,7 +378,7 @@ static int dxva2_vc1_end_frame(AVCodecContext *avctx)
 }
 
 #if CONFIG_WMV3_DXVA2_HWACCEL
-AVHWAccel ff_wmv3_dxva2_hwaccel = {
+const AVHWAccel ff_wmv3_dxva2_hwaccel = {
     .name           = "wmv3_dxva2",
     .type           = AVMEDIA_TYPE_VIDEO,
     .id             = AV_CODEC_ID_WMV3,
@@ -395,7 +395,7 @@ AVHWAccel ff_wmv3_dxva2_hwaccel = {
 #endif
 
 #if CONFIG_VC1_DXVA2_HWACCEL
-AVHWAccel ff_vc1_dxva2_hwaccel = {
+const AVHWAccel ff_vc1_dxva2_hwaccel = {
     .name           = "vc1_dxva2",
     .type           = AVMEDIA_TYPE_VIDEO,
     .id             = AV_CODEC_ID_VC1,
@@ -412,7 +412,7 @@ AVHWAccel ff_vc1_dxva2_hwaccel = {
 #endif
 
 #if CONFIG_WMV3_D3D11VA_HWACCEL
-AVHWAccel ff_wmv3_d3d11va_hwaccel = {
+const AVHWAccel ff_wmv3_d3d11va_hwaccel = {
     .name           = "wmv3_d3d11va",
     .type           = AVMEDIA_TYPE_VIDEO,
     .id             = AV_CODEC_ID_WMV3,
@@ -429,7 +429,7 @@ AVHWAccel ff_wmv3_d3d11va_hwaccel = {
 #endif
 
 #if CONFIG_WMV3_D3D11VA2_HWACCEL
-AVHWAccel ff_wmv3_d3d11va2_hwaccel = {
+const AVHWAccel ff_wmv3_d3d11va2_hwaccel = {
     .name           = "wmv3_d3d11va2",
     .type           = AVMEDIA_TYPE_VIDEO,
     .id             = AV_CODEC_ID_WMV3,
@@ -446,7 +446,7 @@ AVHWAccel ff_wmv3_d3d11va2_hwaccel = {
 #endif
 
 #if CONFIG_VC1_D3D11VA_HWACCEL
-AVHWAccel ff_vc1_d3d11va_hwaccel = {
+const AVHWAccel ff_vc1_d3d11va_hwaccel = {
     .name           = "vc1_d3d11va",
     .type           = AVMEDIA_TYPE_VIDEO,
     .id             = AV_CODEC_ID_VC1,
@@ -463,7 +463,7 @@ AVHWAccel ff_vc1_d3d11va_hwaccel = {
 #endif
 
 #if CONFIG_VC1_D3D11VA2_HWACCEL
-AVHWAccel ff_vc1_d3d11va2_hwaccel = {
+const AVHWAccel ff_vc1_d3d11va2_hwaccel = {
     .name           = "vc1_d3d11va2",
     .type           = AVMEDIA_TYPE_VIDEO,
     .id             = AV_CODEC_ID_VC1,
diff --git a/libavcodec/dxva2_vp9.c b/libavcodec/dxva2_vp9.c
index a2e55f573644c23364d3020a94ba81e6f8fb0740..5a5b226422808470d21fc6d94e5c01bd9f4ac634 100644
--- a/libavcodec/dxva2_vp9.c
+++ b/libavcodec/dxva2_vp9.c
@@ -309,7 +309,7 @@ static int dxva2_vp9_end_frame(AVCodecContext *avctx)
 }
 
 #if CONFIG_VP9_DXVA2_HWACCEL
-AVHWAccel ff_vp9_dxva2_hwaccel = {
+const AVHWAccel ff_vp9_dxva2_hwaccel = {
     .name           = "vp9_dxva2",
     .type           = AVMEDIA_TYPE_VIDEO,
     .id             = AV_CODEC_ID_VP9,
@@ -326,7 +326,7 @@ AVHWAccel ff_vp9_dxva2_hwaccel = {
 #endif
 
 #if CONFIG_VP9_D3D11VA_HWACCEL
-AVHWAccel ff_vp9_d3d11va_hwaccel = {
+const AVHWAccel ff_vp9_d3d11va_hwaccel = {
     .name           = "vp9_d3d11va",
     .type           = AVMEDIA_TYPE_VIDEO,
     .id             = AV_CODEC_ID_VP9,
@@ -343,7 +343,7 @@ AVHWAccel ff_vp9_d3d11va_hwaccel = {
 #endif
 
 #if CONFIG_VP9_D3D11VA2_HWACCEL
-AVHWAccel ff_vp9_d3d11va2_hwaccel = {
+const AVHWAccel ff_vp9_d3d11va2_hwaccel = {
     .name           = "vp9_d3d11va2",
     .type           = AVMEDIA_TYPE_VIDEO,
     .id             = AV_CODEC_ID_VP9,
diff --git a/libavcodec/hwaccels.h b/libavcodec/hwaccels.h
index 9a3008a92ca18588f1b93d3a2cdd7c96f81e644a..8a3c29e43597aab9f062f4c687d51c4358b022d1 100644
--- a/libavcodec/hwaccels.h
+++ b/libavcodec/hwaccels.h
@@ -21,54 +21,54 @@
 
 #include "avcodec.h"
 
-extern AVHWAccel ff_h263_vaapi_hwaccel;
-extern AVHWAccel ff_h263_videotoolbox_hwaccel;
-extern AVHWAccel ff_h264_d3d11va_hwaccel;
-extern AVHWAccel ff_h264_d3d11va2_hwaccel;
-extern AVHWAccel ff_h264_dxva2_hwaccel;
-extern AVHWAccel ff_h264_nvdec_hwaccel;
-extern AVHWAccel ff_h264_vaapi_hwaccel;
-extern AVHWAccel ff_h264_vdpau_hwaccel;
-extern AVHWAccel ff_h264_videotoolbox_hwaccel;
-extern AVHWAccel ff_hevc_d3d11va_hwaccel;
-extern AVHWAccel ff_hevc_d3d11va2_hwaccel;
-extern AVHWAccel ff_hevc_dxva2_hwaccel;
-extern AVHWAccel ff_hevc_nvdec_hwaccel;
-extern AVHWAccel ff_hevc_vaapi_hwaccel;
-extern AVHWAccel ff_hevc_vdpau_hwaccel;
-extern AVHWAccel ff_hevc_videotoolbox_hwaccel;
-extern AVHWAccel ff_mpeg1_nvdec_hwaccel;
-extern AVHWAccel ff_mpeg1_vdpau_hwaccel;
-extern AVHWAccel ff_mpeg1_videotoolbox_hwaccel;
-extern AVHWAccel ff_mpeg1_xvmc_hwaccel;
-extern AVHWAccel ff_mpeg2_d3d11va_hwaccel;
-extern AVHWAccel ff_mpeg2_d3d11va2_hwaccel;
-extern AVHWAccel ff_mpeg2_nvdec_hwaccel;
-extern AVHWAccel ff_mpeg2_dxva2_hwaccel;
-extern AVHWAccel ff_mpeg2_vaapi_hwaccel;
-extern AVHWAccel ff_mpeg2_vdpau_hwaccel;
-extern AVHWAccel ff_mpeg2_videotoolbox_hwaccel;
-extern AVHWAccel ff_mpeg2_xvmc_hwaccel;
-extern AVHWAccel ff_mpeg4_nvdec_hwaccel;
-extern AVHWAccel ff_mpeg4_vaapi_hwaccel;
-extern AVHWAccel ff_mpeg4_vdpau_hwaccel;
-extern AVHWAccel ff_mpeg4_videotoolbox_hwaccel;
-extern AVHWAccel ff_vc1_d3d11va_hwaccel;
-extern AVHWAccel ff_vc1_d3d11va2_hwaccel;
-extern AVHWAccel ff_vc1_dxva2_hwaccel;
-extern AVHWAccel ff_vc1_nvdec_hwaccel;
-extern AVHWAccel ff_vc1_vaapi_hwaccel;
-extern AVHWAccel ff_vc1_vdpau_hwaccel;
-extern AVHWAccel ff_vp9_d3d11va_hwaccel;
-extern AVHWAccel ff_vp9_d3d11va2_hwaccel;
-extern AVHWAccel ff_vp9_dxva2_hwaccel;
-extern AVHWAccel ff_vp9_nvdec_hwaccel;
-extern AVHWAccel ff_vp9_vaapi_hwaccel;
-extern AVHWAccel ff_wmv3_d3d11va_hwaccel;
-extern AVHWAccel ff_wmv3_d3d11va2_hwaccel;
-extern AVHWAccel ff_wmv3_dxva2_hwaccel;
-extern AVHWAccel ff_wmv3_nvdec_hwaccel;
-extern AVHWAccel ff_wmv3_vaapi_hwaccel;
-extern AVHWAccel ff_wmv3_vdpau_hwaccel;
+extern const AVHWAccel ff_h263_vaapi_hwaccel;
+extern const AVHWAccel ff_h263_videotoolbox_hwaccel;
+extern const AVHWAccel ff_h264_d3d11va_hwaccel;
+extern const AVHWAccel ff_h264_d3d11va2_hwaccel;
+extern const AVHWAccel ff_h264_dxva2_hwaccel;
+extern const AVHWAccel ff_h264_nvdec_hwaccel;
+extern const AVHWAccel ff_h264_vaapi_hwaccel;
+extern const AVHWAccel ff_h264_vdpau_hwaccel;
+extern const AVHWAccel ff_h264_videotoolbox_hwaccel;
+extern const AVHWAccel ff_hevc_d3d11va_hwaccel;
+extern const AVHWAccel ff_hevc_d3d11va2_hwaccel;
+extern const AVHWAccel ff_hevc_dxva2_hwaccel;
+extern const AVHWAccel ff_hevc_nvdec_hwaccel;
+extern const AVHWAccel ff_hevc_vaapi_hwaccel;
+extern const AVHWAccel ff_hevc_vdpau_hwaccel;
+extern const AVHWAccel ff_hevc_videotoolbox_hwaccel;
+extern const AVHWAccel ff_mpeg1_nvdec_hwaccel;
+extern const AVHWAccel ff_mpeg1_vdpau_hwaccel;
+extern const AVHWAccel ff_mpeg1_videotoolbox_hwaccel;
+extern const AVHWAccel ff_mpeg1_xvmc_hwaccel;
+extern const AVHWAccel ff_mpeg2_d3d11va_hwaccel;
+extern const AVHWAccel ff_mpeg2_d3d11va2_hwaccel;
+extern const AVHWAccel ff_mpeg2_nvdec_hwaccel;
+extern const AVHWAccel ff_mpeg2_dxva2_hwaccel;
+extern const AVHWAccel ff_mpeg2_vaapi_hwaccel;
+extern const AVHWAccel ff_mpeg2_vdpau_hwaccel;
+extern const AVHWAccel ff_mpeg2_videotoolbox_hwaccel;
+extern const AVHWAccel ff_mpeg2_xvmc_hwaccel;
+extern const AVHWAccel ff_mpeg4_nvdec_hwaccel;
+extern const AVHWAccel ff_mpeg4_vaapi_hwaccel;
+extern const AVHWAccel ff_mpeg4_vdpau_hwaccel;
+extern const AVHWAccel ff_mpeg4_videotoolbox_hwaccel;
+extern const AVHWAccel ff_vc1_d3d11va_hwaccel;
+extern const AVHWAccel ff_vc1_d3d11va2_hwaccel;
+extern const AVHWAccel ff_vc1_dxva2_hwaccel;
+extern const AVHWAccel ff_vc1_nvdec_hwaccel;
+extern const AVHWAccel ff_vc1_vaapi_hwaccel;
+extern const AVHWAccel ff_vc1_vdpau_hwaccel;
+extern const AVHWAccel ff_vp9_d3d11va_hwaccel;
+extern const AVHWAccel ff_vp9_d3d11va2_hwaccel;
+extern const AVHWAccel ff_vp9_dxva2_hwaccel;
+extern const AVHWAccel ff_vp9_nvdec_hwaccel;
+extern const AVHWAccel ff_vp9_vaapi_hwaccel;
+extern const AVHWAccel ff_wmv3_d3d11va_hwaccel;
+extern const AVHWAccel ff_wmv3_d3d11va2_hwaccel;
+extern const AVHWAccel ff_wmv3_dxva2_hwaccel;
+extern const AVHWAccel ff_wmv3_nvdec_hwaccel;
+extern const AVHWAccel ff_wmv3_vaapi_hwaccel;
+extern const AVHWAccel ff_wmv3_vdpau_hwaccel;
 
 #endif /* AVCODEC_HWACCELS_H */
diff --git a/libavcodec/mpegvideo_xvmc.c b/libavcodec/mpegvideo_xvmc.c
index 519a4481614cf6ecceb4443103578d21e4f3515e..f06583768c42f7d9e9f419ac3fbb55f22c6262e7 100644
--- a/libavcodec/mpegvideo_xvmc.c
+++ b/libavcodec/mpegvideo_xvmc.c
@@ -348,7 +348,7 @@ static void ff_xvmc_decode_mb(struct MpegEncContext *s)
 }
 
 #if CONFIG_MPEG1_XVMC_HWACCEL
-AVHWAccel ff_mpeg1_xvmc_hwaccel = {
+const AVHWAccel ff_mpeg1_xvmc_hwaccel = {
     .name           = "mpeg1_xvmc",
     .type           = AVMEDIA_TYPE_VIDEO,
     .id             = AV_CODEC_ID_MPEG1VIDEO,
@@ -362,7 +362,7 @@ AVHWAccel ff_mpeg1_xvmc_hwaccel = {
 #endif
 
 #if CONFIG_MPEG2_XVMC_HWACCEL
-AVHWAccel ff_mpeg2_xvmc_hwaccel = {
+const AVHWAccel ff_mpeg2_xvmc_hwaccel = {
     .name           = "mpeg2_xvmc",
     .type           = AVMEDIA_TYPE_VIDEO,
     .id             = AV_CODEC_ID_MPEG2VIDEO,
diff --git a/libavcodec/nvdec_h264.c b/libavcodec/nvdec_h264.c
index b0e756c7344b2da270a7b15604ecc39358c914f9..35f54f2ed5f2a07316f8cdf2f8e742124efa7099 100644
--- a/libavcodec/nvdec_h264.c
+++ b/libavcodec/nvdec_h264.c
@@ -163,7 +163,7 @@ static int nvdec_h264_frame_params(AVCodecContext *avctx,
     return ff_nvdec_frame_params(avctx, hw_frames_ctx, sps->ref_frame_count + sps->num_reorder_frames);
 }
 
-AVHWAccel ff_h264_nvdec_hwaccel = {
+const AVHWAccel ff_h264_nvdec_hwaccel = {
     .name                 = "h264_nvdec",
     .type                 = AVMEDIA_TYPE_VIDEO,
     .id                   = AV_CODEC_ID_H264,
diff --git a/libavcodec/nvdec_hevc.c b/libavcodec/nvdec_hevc.c
index f02a7a15feb960454f1ceb0f0c067eeec69b882d..58f3fa9b45adb52048178f5ac30cd18596d23f03 100644
--- a/libavcodec/nvdec_hevc.c
+++ b/libavcodec/nvdec_hevc.c
@@ -266,7 +266,7 @@ static int nvdec_hevc_frame_params(AVCodecContext *avctx,
     return ff_nvdec_frame_params(avctx, hw_frames_ctx, sps->temporal_layer[sps->max_sub_layers - 1].max_dec_pic_buffering + 1);
 }
 
-AVHWAccel ff_hevc_nvdec_hwaccel = {
+const AVHWAccel ff_hevc_nvdec_hwaccel = {
     .name                 = "hevc_nvdec",
     .type                 = AVMEDIA_TYPE_VIDEO,
     .id                   = AV_CODEC_ID_HEVC,
diff --git a/libavcodec/nvdec_mpeg12.c b/libavcodec/nvdec_mpeg12.c
index e29d085a794456f6adeb536bd3baee70b1c7c409..7293d5055548055f8ca00e72d80660f28f913a6b 100644
--- a/libavcodec/nvdec_mpeg12.c
+++ b/libavcodec/nvdec_mpeg12.c
@@ -91,7 +91,7 @@ static int nvdec_mpeg12_frame_params(AVCodecContext *avctx,
 }
 
 #if CONFIG_MPEG2_NVDEC_HWACCEL
-AVHWAccel ff_mpeg2_nvdec_hwaccel = {
+const AVHWAccel ff_mpeg2_nvdec_hwaccel = {
     .name                 = "mpeg2_nvdec",
     .type                 = AVMEDIA_TYPE_VIDEO,
     .id                   = AV_CODEC_ID_MPEG2VIDEO,
@@ -107,7 +107,7 @@ AVHWAccel ff_mpeg2_nvdec_hwaccel = {
 #endif
 
 #if CONFIG_MPEG1_NVDEC_HWACCEL
-AVHWAccel ff_mpeg1_nvdec_hwaccel = {
+const AVHWAccel ff_mpeg1_nvdec_hwaccel = {
     .name                 = "mpeg1_nvdec",
     .type                 = AVMEDIA_TYPE_VIDEO,
     .id                   = AV_CODEC_ID_MPEG1VIDEO,
diff --git a/libavcodec/nvdec_mpeg4.c b/libavcodec/nvdec_mpeg4.c
index a0f9280ea22e69692c6f6ce64c6343a9bed462a4..907af1391a929c36ce3341c682601df3a041c921 100644
--- a/libavcodec/nvdec_mpeg4.c
+++ b/libavcodec/nvdec_mpeg4.c
@@ -106,7 +106,7 @@ static int nvdec_mpeg4_frame_params(AVCodecContext *avctx,
     return ff_nvdec_frame_params(avctx, hw_frames_ctx, 2);
 }
 
-AVHWAccel ff_mpeg4_nvdec_hwaccel = {
+const AVHWAccel ff_mpeg4_nvdec_hwaccel = {
     .name                 = "mpeg4_nvdec",
     .type                 = AVMEDIA_TYPE_VIDEO,
     .id                   = AV_CODEC_ID_MPEG4,
diff --git a/libavcodec/nvdec_vc1.c b/libavcodec/nvdec_vc1.c
index c04b153a8615d5695526675f1e1d9dd13c59ba4b..7257692d66a35d67b2568d5c180b0d1e239a792d 100644
--- a/libavcodec/nvdec_vc1.c
+++ b/libavcodec/nvdec_vc1.c
@@ -110,7 +110,7 @@ static int nvdec_vc1_frame_params(AVCodecContext *avctx,
     return ff_nvdec_frame_params(avctx, hw_frames_ctx, 2);
 }
 
-AVHWAccel ff_vc1_nvdec_hwaccel = {
+const AVHWAccel ff_vc1_nvdec_hwaccel = {
     .name                 = "vc1_nvdec",
     .type                 = AVMEDIA_TYPE_VIDEO,
     .id                   = AV_CODEC_ID_VC1,
@@ -125,7 +125,7 @@ AVHWAccel ff_vc1_nvdec_hwaccel = {
 };
 
 #if CONFIG_WMV3_NVDEC_HWACCEL
-AVHWAccel ff_wmv3_nvdec_hwaccel = {
+const AVHWAccel ff_wmv3_nvdec_hwaccel = {
     .name                 = "wmv3_nvdec",
     .type                 = AVMEDIA_TYPE_VIDEO,
     .id                   = AV_CODEC_ID_WMV3,
diff --git a/libavcodec/nvdec_vp9.c b/libavcodec/nvdec_vp9.c
index ed06d9141603e78e203499a819682347919c7725..3b665a9bc701cf1d74205a95360e15e25d0837cf 100644
--- a/libavcodec/nvdec_vp9.c
+++ b/libavcodec/nvdec_vp9.c
@@ -169,7 +169,7 @@ static int nvdec_vp9_frame_params(AVCodecContext *avctx,
     return ff_nvdec_frame_params(avctx, hw_frames_ctx, 8);
 }
 
-AVHWAccel ff_vp9_nvdec_hwaccel = {
+const AVHWAccel ff_vp9_nvdec_hwaccel = {
     .name                 = "vp9_nvdec",
     .type                 = AVMEDIA_TYPE_VIDEO,
     .id                   = AV_CODEC_ID_VP9,
diff --git a/libavcodec/vaapi_h264.c b/libavcodec/vaapi_h264.c
index c7f9d7bcb416f12e33d6eb00432dce9ba56c7c5a..5854587a255a748d0f9ea9508a5b2bf88c364861 100644
--- a/libavcodec/vaapi_h264.c
+++ b/libavcodec/vaapi_h264.c
@@ -388,7 +388,7 @@ static int vaapi_h264_decode_slice(AVCodecContext *avctx,
     return 0;
 }
 
-AVHWAccel ff_h264_vaapi_hwaccel = {
+const AVHWAccel ff_h264_vaapi_hwaccel = {
     .name                 = "h264_vaapi",
     .type                 = AVMEDIA_TYPE_VIDEO,
     .id                   = AV_CODEC_ID_H264,
diff --git a/libavcodec/vaapi_hevc.c b/libavcodec/vaapi_hevc.c
index 718ccc92a2ea18fdf1b1807ec3cc01cbb080aa18..19aabcdb5218a7acbd4383d6a0259dd6eb82e5de 100644
--- a/libavcodec/vaapi_hevc.c
+++ b/libavcodec/vaapi_hevc.c
@@ -423,7 +423,7 @@ static int vaapi_hevc_decode_slice(AVCodecContext *avctx,
     return 0;
 }
 
-AVHWAccel ff_hevc_vaapi_hwaccel = {
+const AVHWAccel ff_hevc_vaapi_hwaccel = {
     .name                 = "hevc_vaapi",
     .type                 = AVMEDIA_TYPE_VIDEO,
     .id                   = AV_CODEC_ID_HEVC,
diff --git a/libavcodec/vaapi_mpeg2.c b/libavcodec/vaapi_mpeg2.c
index fd5be8d8aefafab61b8f8571ce5a60eed147c671..aaed434c88372a8e4fdae934ec757bb9aadbae25 100644
--- a/libavcodec/vaapi_mpeg2.c
+++ b/libavcodec/vaapi_mpeg2.c
@@ -172,7 +172,7 @@ static int vaapi_mpeg2_decode_slice(AVCodecContext *avctx, const uint8_t *buffer
     return 0;
 }
 
-AVHWAccel ff_mpeg2_vaapi_hwaccel = {
+const AVHWAccel ff_mpeg2_vaapi_hwaccel = {
     .name                 = "mpeg2_vaapi",
     .type                 = AVMEDIA_TYPE_VIDEO,
     .id                   = AV_CODEC_ID_MPEG2VIDEO,
diff --git a/libavcodec/vaapi_mpeg4.c b/libavcodec/vaapi_mpeg4.c
index 3fe029186e8fd39ebb0baf709cb82a4bf7835955..11860ff74742897115340017bfcc21c5c331c0f6 100644
--- a/libavcodec/vaapi_mpeg4.c
+++ b/libavcodec/vaapi_mpeg4.c
@@ -178,7 +178,7 @@ static int vaapi_mpeg4_decode_slice(AVCodecContext *avctx, const uint8_t *buffer
 }
 
 #if CONFIG_MPEG4_VAAPI_HWACCEL
-AVHWAccel ff_mpeg4_vaapi_hwaccel = {
+const AVHWAccel ff_mpeg4_vaapi_hwaccel = {
     .name                 = "mpeg4_vaapi",
     .type                 = AVMEDIA_TYPE_VIDEO,
     .id                   = AV_CODEC_ID_MPEG4,
@@ -196,7 +196,7 @@ AVHWAccel ff_mpeg4_vaapi_hwaccel = {
 #endif
 
 #if CONFIG_H263_VAAPI_HWACCEL
-AVHWAccel ff_h263_vaapi_hwaccel = {
+const AVHWAccel ff_h263_vaapi_hwaccel = {
     .name                 = "h263_vaapi",
     .type                 = AVMEDIA_TYPE_VIDEO,
     .id                   = AV_CODEC_ID_H263,
diff --git a/libavcodec/vaapi_vc1.c b/libavcodec/vaapi_vc1.c
index 49675744cdbc20742f5a9da5057bb4dd0250cbef..525376790ec3adfaf90f59d86fe22ef1e7fc5809 100644
--- a/libavcodec/vaapi_vc1.c
+++ b/libavcodec/vaapi_vc1.c
@@ -388,7 +388,7 @@ static int vaapi_vc1_decode_slice(AVCodecContext *avctx, const uint8_t *buffer,
 }
 
 #if CONFIG_WMV3_VAAPI_HWACCEL
-AVHWAccel ff_wmv3_vaapi_hwaccel = {
+const AVHWAccel ff_wmv3_vaapi_hwaccel = {
     .name                 = "wmv3_vaapi",
     .type                 = AVMEDIA_TYPE_VIDEO,
     .id                   = AV_CODEC_ID_WMV3,
@@ -405,7 +405,7 @@ AVHWAccel ff_wmv3_vaapi_hwaccel = {
 };
 #endif
 
-AVHWAccel ff_vc1_vaapi_hwaccel = {
+const AVHWAccel ff_vc1_vaapi_hwaccel = {
     .name                 = "vc1_vaapi",
     .type                 = AVMEDIA_TYPE_VIDEO,
     .id                   = AV_CODEC_ID_VC1,
diff --git a/libavcodec/vaapi_vp9.c b/libavcodec/vaapi_vp9.c
index f295dc9ebb521d57f94fa60b80d8f64c4287469e..f384ba7873ad55f5bde8b2556f5bd39ce831f53e 100644
--- a/libavcodec/vaapi_vp9.c
+++ b/libavcodec/vaapi_vp9.c
@@ -168,7 +168,7 @@ static int vaapi_vp9_decode_slice(AVCodecContext *avctx,
     return 0;
 }
 
-AVHWAccel ff_vp9_vaapi_hwaccel = {
+const AVHWAccel ff_vp9_vaapi_hwaccel = {
     .name                 = "vp9_vaapi",
     .type                 = AVMEDIA_TYPE_VIDEO,
     .id                   = AV_CODEC_ID_VP9,
diff --git a/libavcodec/vdpau_h264.c b/libavcodec/vdpau_h264.c
index 70f83d76f50a5aded3bfedad720199f7211eb958..2a260f76abae4b70d3ed3eec212f22b97b610519 100644
--- a/libavcodec/vdpau_h264.c
+++ b/libavcodec/vdpau_h264.c
@@ -262,7 +262,7 @@ static int vdpau_h264_init(AVCodecContext *avctx)
     return ff_vdpau_common_init(avctx, profile, level);
 }
 
-AVHWAccel ff_h264_vdpau_hwaccel = {
+const AVHWAccel ff_h264_vdpau_hwaccel = {
     .name           = "h264_vdpau",
     .type           = AVMEDIA_TYPE_VIDEO,
     .id             = AV_CODEC_ID_H264,
diff --git a/libavcodec/vdpau_hevc.c b/libavcodec/vdpau_hevc.c
index 70e76cfcaa98ee3b0050003de33ce9713d306eea..421135bce25bfc3eadb77bbf4f059bf349493504 100644
--- a/libavcodec/vdpau_hevc.c
+++ b/libavcodec/vdpau_hevc.c
@@ -413,7 +413,7 @@ static int vdpau_hevc_init(AVCodecContext *avctx)
     return ff_vdpau_common_init(avctx, profile, level);
 }
 
-AVHWAccel ff_hevc_vdpau_hwaccel = {
+const AVHWAccel ff_hevc_vdpau_hwaccel = {
     .name           = "hevc_vdpau",
     .type           = AVMEDIA_TYPE_VIDEO,
     .id             = AV_CODEC_ID_HEVC,
diff --git a/libavcodec/vdpau_mpeg12.c b/libavcodec/vdpau_mpeg12.c
index 71fe889abf645d855d9a3771bf19397bb5691f42..d286e7e57da2d7549a085e067edb7aedf94c691b 100644
--- a/libavcodec/vdpau_mpeg12.c
+++ b/libavcodec/vdpau_mpeg12.c
@@ -103,7 +103,7 @@ static int vdpau_mpeg1_init(AVCodecContext *avctx)
                                 VDP_DECODER_LEVEL_MPEG1_NA);
 }
 
-AVHWAccel ff_mpeg1_vdpau_hwaccel = {
+const AVHWAccel ff_mpeg1_vdpau_hwaccel = {
     .name           = "mpeg1_vdpau",
     .type           = AVMEDIA_TYPE_VIDEO,
     .id             = AV_CODEC_ID_MPEG1VIDEO,
@@ -138,7 +138,7 @@ static int vdpau_mpeg2_init(AVCodecContext *avctx)
     return ff_vdpau_common_init(avctx, profile, VDP_DECODER_LEVEL_MPEG2_HL);
 }
 
-AVHWAccel ff_mpeg2_vdpau_hwaccel = {
+const AVHWAccel ff_mpeg2_vdpau_hwaccel = {
     .name           = "mpeg2_vdpau",
     .type           = AVMEDIA_TYPE_VIDEO,
     .id             = AV_CODEC_ID_MPEG2VIDEO,
diff --git a/libavcodec/vdpau_mpeg4.c b/libavcodec/vdpau_mpeg4.c
index 653ef7e7e73f38747d91479149e61cf7ea0202ee..96f83026a8e4d2e719fa5a7ee5121b6cd8ba22f9 100644
--- a/libavcodec/vdpau_mpeg4.c
+++ b/libavcodec/vdpau_mpeg4.c
@@ -110,7 +110,7 @@ static int vdpau_mpeg4_init(AVCodecContext *avctx)
     return ff_vdpau_common_init(avctx, profile, avctx->level);
 }
 
-AVHWAccel ff_mpeg4_vdpau_hwaccel = {
+const AVHWAccel ff_mpeg4_vdpau_hwaccel = {
     .name           = "mpeg4_vdpau",
     .type           = AVMEDIA_TYPE_VIDEO,
     .id             = AV_CODEC_ID_MPEG4,
diff --git a/libavcodec/vdpau_vc1.c b/libavcodec/vdpau_vc1.c
index 73d83f65777ceabcac530dbb42792133f29f4fc9..671baf96b4d7e1a489dbb192a029230b746f6597 100644
--- a/libavcodec/vdpau_vc1.c
+++ b/libavcodec/vdpau_vc1.c
@@ -136,7 +136,7 @@ static int vdpau_vc1_init(AVCodecContext *avctx)
 }
 
 #if CONFIG_WMV3_VDPAU_HWACCEL
-AVHWAccel ff_wmv3_vdpau_hwaccel = {
+const AVHWAccel ff_wmv3_vdpau_hwaccel = {
     .name           = "wm3_vdpau",
     .type           = AVMEDIA_TYPE_VIDEO,
     .id             = AV_CODEC_ID_WMV3,
@@ -153,7 +153,7 @@ AVHWAccel ff_wmv3_vdpau_hwaccel = {
 };
 #endif
 
-AVHWAccel ff_vc1_vdpau_hwaccel = {
+const AVHWAccel ff_vc1_vdpau_hwaccel = {
     .name           = "vc1_vdpau",
     .type           = AVMEDIA_TYPE_VIDEO,
     .id             = AV_CODEC_ID_VC1,
diff --git a/libavcodec/version.h b/libavcodec/version.h
index ddab7c47a78046d2dce2d21342e02fcd1c99f26b..ba46721fb588014a55ace855ec1f146e6fa0467d 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -28,7 +28,7 @@
 #include "libavutil/version.h"
 
 #define LIBAVCODEC_VERSION_MAJOR  58
-#define LIBAVCODEC_VERSION_MINOR   5
+#define LIBAVCODEC_VERSION_MINOR   6
 #define LIBAVCODEC_VERSION_MICRO 100
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
index d29607363c0988edacab0492787d02e5aa2104b7..c275e0111ec8e511d75ad84a12760deeed747604 100644
--- a/libavcodec/videotoolbox.c
+++ b/libavcodec/videotoolbox.c
@@ -1028,7 +1028,7 @@ static int videotoolbox_frame_params(AVCodecContext *avctx,
     return 0;
 }
 
-AVHWAccel ff_h263_videotoolbox_hwaccel = {
+const AVHWAccel ff_h263_videotoolbox_hwaccel = {
     .name           = "h263_videotoolbox",
     .type           = AVMEDIA_TYPE_VIDEO,
     .id             = AV_CODEC_ID_H263,
@@ -1043,7 +1043,7 @@ AVHWAccel ff_h263_videotoolbox_hwaccel = {
     .priv_data_size = sizeof(VTContext),
 };
 
-AVHWAccel ff_hevc_videotoolbox_hwaccel = {
+const AVHWAccel ff_hevc_videotoolbox_hwaccel = {
     .name           = "hevc_videotoolbox",
     .type           = AVMEDIA_TYPE_VIDEO,
     .id             = AV_CODEC_ID_HEVC,
@@ -1059,7 +1059,7 @@ AVHWAccel ff_hevc_videotoolbox_hwaccel = {
     .priv_data_size = sizeof(VTContext),
 };
 
-AVHWAccel ff_h264_videotoolbox_hwaccel = {
+const AVHWAccel ff_h264_videotoolbox_hwaccel = {
     .name           = "h264_videotoolbox",
     .type           = AVMEDIA_TYPE_VIDEO,
     .id             = AV_CODEC_ID_H264,
@@ -1075,7 +1075,7 @@ AVHWAccel ff_h264_videotoolbox_hwaccel = {
     .priv_data_size = sizeof(VTContext),
 };
 
-AVHWAccel ff_mpeg1_videotoolbox_hwaccel = {
+const AVHWAccel ff_mpeg1_videotoolbox_hwaccel = {
     .name           = "mpeg1_videotoolbox",
     .type           = AVMEDIA_TYPE_VIDEO,
     .id             = AV_CODEC_ID_MPEG1VIDEO,
@@ -1090,7 +1090,7 @@ AVHWAccel ff_mpeg1_videotoolbox_hwaccel = {
     .priv_data_size = sizeof(VTContext),
 };
 
-AVHWAccel ff_mpeg2_videotoolbox_hwaccel = {
+const AVHWAccel ff_mpeg2_videotoolbox_hwaccel = {
     .name           = "mpeg2_videotoolbox",
     .type           = AVMEDIA_TYPE_VIDEO,
     .id             = AV_CODEC_ID_MPEG2VIDEO,
@@ -1105,7 +1105,7 @@ AVHWAccel ff_mpeg2_videotoolbox_hwaccel = {
     .priv_data_size = sizeof(VTContext),
 };
 
-AVHWAccel ff_mpeg4_videotoolbox_hwaccel = {
+const AVHWAccel ff_mpeg4_videotoolbox_hwaccel = {
     .name           = "mpeg4_videotoolbox",
     .type           = AVMEDIA_TYPE_VIDEO,
     .id             = AV_CODEC_ID_MPEG4,