Re: [FFmpeg-devel] [PATCH 07/17] lavc: Mark all AVHWAccel structures as const
On Fri, 24 Nov 2017 00:51:24 + Mark Thompsonwrote: > --- > libavcodec/avcodec.h| 2 +- > libavcodec/decode.c | 2 +- > libavcodec/dxva2_h264.c | 6 +-- > libavcodec/dxva2_hevc.c | 6 +-- > libavcodec/dxva2_mpeg2.c| 6 +-- > libavcodec/dxva2_vc1.c | 12 +++--- > libavcodec/dxva2_vp9.c | 6 +-- > libavcodec/hwaccels.h | 98 > ++--- > libavcodec/mpegvideo_xvmc.c | 4 +- libavcodec/nvdec_h264.c | 2 > +- libavcodec/nvdec_hevc.c | 2 +- > libavcodec/nvdec_mpeg12.c | 2 +- > libavcodec/nvdec_vc1.c | 4 +- > libavcodec/nvdec_vp9.c | 2 +- > libavcodec/vaapi_h264.c | 2 +- > libavcodec/vaapi_hevc.c | 2 +- > libavcodec/vaapi_mpeg2.c| 2 +- > libavcodec/vaapi_mpeg4.c| 4 +- > libavcodec/vaapi_vc1.c | 4 +- > libavcodec/vaapi_vp9.c | 2 +- > libavcodec/vdpau_h264.c | 2 +- > libavcodec/vdpau_hevc.c | 2 +- > libavcodec/vdpau_mpeg12.c | 4 +- > libavcodec/vdpau_mpeg4.c| 2 +- > libavcodec/vdpau_vc1.c | 4 +- > libavcodec/videotoolbox.c | 12 +++--- > 26 files changed, 98 insertions(+), 98 deletions(-) You're missing nvdec_mpeg4. > diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h > index 1ae0344bb2..0972df0bde 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 dd6fce86eb..3feaa6c426 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; > err = hwaccel->init(avctx); > if (err < 0) { > av_log(avctx, AV_LOG_ERROR, "Failed setup for format %s: " > diff --git a/libavcodec/dxva2_h264.c b/libavcodec/dxva2_h264.c > index ee35b20e82..a4278c80b5 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 542afc383a..0ae07d304f 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 df5fe59a7d..a57778b427 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 =
Re: [FFmpeg-devel] [PATCH 07/17] lavc: Mark all AVHWAccel structures as const
2017-11-24 12:42 GMT+01:00 Mark Thompson: > On 24/11/17 11:29, Carl Eugen Hoyos wrote: >> 2017-11-24 1:51 GMT+01:00 Mark Thompson : >> >>> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h >>> index 1ae0344bb2..0972df0bde 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; >> >> Please bump minor (and perhaps add a note for api), > > Sure. > > """ > 2017-xx-xx - xxx - lavc 58.x+1.100 - avcodec.h > Add const to AVCodecContext.hwaccel. > """ > >> iirc this has an impact for some toolchains, no? > > I don't think so? C requires that const-qualified and > unqualified versions of a type have the same representation. > Adding const could affect C++ name mangling, but we don't > support building directly with C++ ("extern \"C\"" is needed). I thought that this is an issue, but I may misremember. Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 07/17] lavc: Mark all AVHWAccel structures as const
On 24/11/17 11:29, Carl Eugen Hoyos wrote: > 2017-11-24 1:51 GMT+01:00 Mark Thompson: > >> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h >> index 1ae0344bb2..0972df0bde 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; > > Please bump minor (and perhaps add a note for api), Sure. """ 2017-xx-xx - xxx - lavc 58.x+1.100 - avcodec.h Add const to AVCodecContext.hwaccel. """ > iirc this has an impact for some toolchains, no? I don't think so? C requires that const-qualified and unqualified versions of a type have the same representation. Adding const could affect C++ name mangling, but we don't support building directly with C++ ("extern \"C\"" is needed). - Mark ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 07/17] lavc: Mark all AVHWAccel structures as const
2017-11-24 1:51 GMT+01:00 Mark Thompson: > diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h > index 1ae0344bb2..0972df0bde 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; Please bump minor (and perhaps add a note for api), iirc this has an impact for some toolchains, no? Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 07/17] lavc: Mark all AVHWAccel structures as const
--- libavcodec/avcodec.h| 2 +- libavcodec/decode.c | 2 +- libavcodec/dxva2_h264.c | 6 +-- libavcodec/dxva2_hevc.c | 6 +-- libavcodec/dxva2_mpeg2.c| 6 +-- libavcodec/dxva2_vc1.c | 12 +++--- libavcodec/dxva2_vp9.c | 6 +-- libavcodec/hwaccels.h | 98 ++--- libavcodec/mpegvideo_xvmc.c | 4 +- libavcodec/nvdec_h264.c | 2 +- libavcodec/nvdec_hevc.c | 2 +- libavcodec/nvdec_mpeg12.c | 2 +- libavcodec/nvdec_vc1.c | 4 +- libavcodec/nvdec_vp9.c | 2 +- libavcodec/vaapi_h264.c | 2 +- libavcodec/vaapi_hevc.c | 2 +- libavcodec/vaapi_mpeg2.c| 2 +- libavcodec/vaapi_mpeg4.c| 4 +- libavcodec/vaapi_vc1.c | 4 +- libavcodec/vaapi_vp9.c | 2 +- libavcodec/vdpau_h264.c | 2 +- libavcodec/vdpau_hevc.c | 2 +- libavcodec/vdpau_mpeg12.c | 4 +- libavcodec/vdpau_mpeg4.c| 2 +- libavcodec/vdpau_vc1.c | 4 +- libavcodec/videotoolbox.c | 12 +++--- 26 files changed, 98 insertions(+), 98 deletions(-) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 1ae0344bb2..0972df0bde 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 dd6fce86eb..3feaa6c426 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; err = hwaccel->init(avctx); if (err < 0) { av_log(avctx, AV_LOG_ERROR, "Failed setup for format %s: " diff --git a/libavcodec/dxva2_h264.c b/libavcodec/dxva2_h264.c index ee35b20e82..a4278c80b5 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 542afc383a..0ae07d304f 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 df5fe59a7d..a57778b427 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