summaryrefslogtreecommitdiff
path: root/libavcodec/libx264.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-03-16 21:09:54 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-03-21 01:33:09 +0100
commit20f972701806be20a77f808db332d9489343bb78 (patch)
tree8d8b588c0ca06fa652518a5685db8280b0bf532d /libavcodec/libx264.c
parenta688f3c13ce55c2ba51dbbb344564649f1bb52fe (diff)
avcodec/codec_internal: Add FFCodec, hide internal part of AVCodec
Up until now, codec.h contains both public and private parts of AVCodec. This exposes the internals of AVCodec to users and leads them into the temptation of actually using them and forces us to forward-declare structures and types that users can't use at all. This commit changes this by adding a new structure FFCodec to codec_internal.h that extends AVCodec, i.e. contains the public AVCodec as first member; the private fields of AVCodec are moved to this structure, leaving codec.h clean. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/libx264.c')
-rw-r--r--libavcodec/libx264.c62
1 files changed, 31 insertions, 31 deletions
diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index 019eb81ab7..40bdb986e0 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -1084,14 +1084,14 @@ static const enum AVPixelFormat pix_fmts_8bit_rgb[] = {
#endif
#if X264_BUILD < 153
-static av_cold void X264_init_static(AVCodec *codec)
+static av_cold void X264_init_static(FFCodec *codec)
{
if (x264_bit_depth == 8)
- codec->pix_fmts = pix_fmts_8bit;
+ codec->p.pix_fmts = pix_fmts_8bit;
else if (x264_bit_depth == 9)
- codec->pix_fmts = pix_fmts_9bit;
+ codec->p.pix_fmts = pix_fmts_9bit;
else if (x264_bit_depth == 10)
- codec->pix_fmts = pix_fmts_10bit;
+ codec->p.pix_fmts = pix_fmts_10bit;
}
#endif
@@ -1216,31 +1216,31 @@ static const AVClass x264_class = {
#if X264_BUILD >= 153
const
#endif
-AVCodec ff_libx264_encoder = {
- .name = "libx264",
- .long_name = NULL_IF_CONFIG_SMALL("libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10"),
- .type = AVMEDIA_TYPE_VIDEO,
- .id = AV_CODEC_ID_H264,
- .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY |
+FFCodec ff_libx264_encoder = {
+ .p.name = "libx264",
+ .p.long_name = NULL_IF_CONFIG_SMALL("libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10"),
+ .p.type = AVMEDIA_TYPE_VIDEO,
+ .p.id = AV_CODEC_ID_H264,
+ .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY |
AV_CODEC_CAP_OTHER_THREADS |
AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
+ .p.priv_class = &x264_class,
+ .p.wrapper_name = "libx264",
.priv_data_size = sizeof(X264Context),
.init = X264_init,
.encode2 = X264_frame,
.close = X264_close,
- .priv_class = &x264_class,
.defaults = x264_defaults,
#if X264_BUILD < 153
.init_static_data = X264_init_static,
#else
- .pix_fmts = pix_fmts_all,
+ .p.pix_fmts = pix_fmts_all,
#endif
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP | FF_CODEC_CAP_AUTO_THREADS
#if X264_BUILD >= 158
| FF_CODEC_CAP_INIT_THREADSAFE
#endif
,
- .wrapper_name = "libx264",
};
#endif
@@ -1252,27 +1252,27 @@ static const AVClass rgbclass = {
.version = LIBAVUTIL_VERSION_INT,
};
-const AVCodec ff_libx264rgb_encoder = {
- .name = "libx264rgb",
- .long_name = NULL_IF_CONFIG_SMALL("libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 RGB"),
- .type = AVMEDIA_TYPE_VIDEO,
- .id = AV_CODEC_ID_H264,
- .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY |
+const FFCodec ff_libx264rgb_encoder = {
+ .p.name = "libx264rgb",
+ .p.long_name = NULL_IF_CONFIG_SMALL("libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 RGB"),
+ .p.type = AVMEDIA_TYPE_VIDEO,
+ .p.id = AV_CODEC_ID_H264,
+ .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY |
AV_CODEC_CAP_OTHER_THREADS |
AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
+ .p.pix_fmts = pix_fmts_8bit_rgb,
+ .p.priv_class = &rgbclass,
+ .p.wrapper_name = "libx264",
.priv_data_size = sizeof(X264Context),
.init = X264_init,
.encode2 = X264_frame,
.close = X264_close,
- .priv_class = &rgbclass,
.defaults = x264_defaults,
- .pix_fmts = pix_fmts_8bit_rgb,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP | FF_CODEC_CAP_AUTO_THREADS
#if X264_BUILD >= 158
| FF_CODEC_CAP_INIT_THREADSAFE
#endif
,
- .wrapper_name = "libx264",
};
#endif
@@ -1284,22 +1284,22 @@ static const AVClass X262_class = {
.version = LIBAVUTIL_VERSION_INT,
};
-const AVCodec ff_libx262_encoder = {
- .name = "libx262",
- .long_name = NULL_IF_CONFIG_SMALL("libx262 MPEG2VIDEO"),
- .type = AVMEDIA_TYPE_VIDEO,
- .id = AV_CODEC_ID_MPEG2VIDEO,
- .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY |
+const FFCodec ff_libx262_encoder = {
+ .p.name = "libx262",
+ .p.long_name = NULL_IF_CONFIG_SMALL("libx262 MPEG2VIDEO"),
+ .p.type = AVMEDIA_TYPE_VIDEO,
+ .p.id = AV_CODEC_ID_MPEG2VIDEO,
+ .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY |
AV_CODEC_CAP_OTHER_THREADS |
AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
+ .p.pix_fmts = pix_fmts_8bit,
+ .p.priv_class = &X262_class,
+ .p.wrapper_name = "libx264",
.priv_data_size = sizeof(X264Context),
.init = X264_init,
.encode2 = X264_frame,
.close = X264_close,
- .priv_class = &X262_class,
.defaults = x264_defaults,
- .pix_fmts = pix_fmts_8bit,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP | FF_CODEC_CAP_AUTO_THREADS,
- .wrapper_name = "libx264",
};
#endif