[FFmpeg-cvslog] lavc: deprecate AV_CODEC_CAP_SUBFRAMES

Anton Khirnov git at videolan.org
Mon May 15 11:28:40 EEST 2023


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Tue May  9 12:28:10 2023 +0200| [8b20d0dcb5cfa8dc34830acdd719fc65b8b5ef67] | committer: Anton Khirnov

lavc: deprecate AV_CODEC_CAP_SUBFRAMES

There is nothing meaningful the caller can do with it.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8b20d0dcb5cfa8dc34830acdd719fc65b8b5ef67
---

 doc/APIchanges              |  3 +++
 libavcodec/alsdec.c         |  6 +++++-
 libavcodec/apac.c           |  6 ++++--
 libavcodec/apedec.c         |  6 +++++-
 libavcodec/atrac3.c         | 12 ++++++++++--
 libavcodec/atrac9dec.c      |  6 +++++-
 libavcodec/bonk.c           |  6 ++++--
 libavcodec/codec.h          |  3 +++
 libavcodec/ftr.c            |  6 +++++-
 libavcodec/g723_1dec.c      |  6 +++++-
 libavcodec/g729dec.c        | 12 ++++++++++--
 libavcodec/libspeexdec.c    |  6 +++++-
 libavcodec/misc4.c          |  5 ++++-
 libavcodec/shorten.c        |  6 ++++--
 libavcodec/tests/avcodec.c  |  3 +--
 libavcodec/version_major.h  |  1 +
 libavcodec/wavarc.c         |  2 ++
 libavcodec/wmalosslessdec.c |  6 +++++-
 libavcodec/wmaprodec.c      | 18 +++++++++++++++---
 libavcodec/wmavoice.c       |  6 +++++-
 20 files changed, 101 insertions(+), 24 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 20ab4709e7..a37fe1bb8e 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -2,6 +2,9 @@ The last version increases of all libraries were on 2023-02-09
 
 API changes, most recent first:
 
+2023-05-xx - xxxxxxxxxx - lavc 60 - codec.h
+  Depreate AV_CODEC_CAP_SUBFRAMES without replacement.
+
 2023-05-xx - xxxxxxxxxx - lavc 60.11.100 - codec_par.h
   Add AVCodecParameters.framerate.
 
diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c
index 4605b2248f..c64d1032a4 100644
--- a/libavcodec/alsdec.c
+++ b/libavcodec/alsdec.c
@@ -2190,6 +2190,10 @@ const FFCodec ff_als_decoder = {
     .close          = decode_end,
     FF_CODEC_DECODE_CB(decode_frame),
     .flush          = flush,
-    .p.capabilities = AV_CODEC_CAP_SUBFRAMES | AV_CODEC_CAP_DR1 | AV_CODEC_CAP_CHANNEL_CONF,
+    .p.capabilities =
+#if FF_API_SUBFRAMES
+                      AV_CODEC_CAP_SUBFRAMES |
+#endif
+                      AV_CODEC_CAP_DR1 | AV_CODEC_CAP_CHANNEL_CONF,
     .caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
 };
diff --git a/libavcodec/apac.c b/libavcodec/apac.c
index 3408f75292..b6cb6c669e 100644
--- a/libavcodec/apac.c
+++ b/libavcodec/apac.c
@@ -269,8 +269,10 @@ const FFCodec ff_apac_decoder = {
     FF_CODEC_DECODE_CB(apac_decode),
     .close            = apac_close,
     .p.capabilities   = AV_CODEC_CAP_DELAY |
-                        AV_CODEC_CAP_DR1 |
-                        AV_CODEC_CAP_SUBFRAMES,
+#if FF_API_SUBFRAMES
+                        AV_CODEC_CAP_SUBFRAMES |
+#endif
+                        AV_CODEC_CAP_DR1,
     .caps_internal    = FF_CODEC_CAP_INIT_CLEANUP,
     .p.sample_fmts    = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_U8P,
                                                         AV_SAMPLE_FMT_S16P,
diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c
index 772636afde..613c76df0b 100644
--- a/libavcodec/apedec.c
+++ b/libavcodec/apedec.c
@@ -1680,7 +1680,11 @@ const FFCodec ff_ape_decoder = {
     .init           = ape_decode_init,
     .close          = ape_decode_close,
     FF_CODEC_DECODE_CB(ape_decode_frame),
-    .p.capabilities = AV_CODEC_CAP_SUBFRAMES | AV_CODEC_CAP_DELAY |
+    .p.capabilities =
+#if FF_API_SUBFRAMES
+                      AV_CODEC_CAP_SUBFRAMES |
+#endif
+                      AV_CODEC_CAP_DELAY |
                       AV_CODEC_CAP_DR1,
     .caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
     .flush          = ape_flush,
diff --git a/libavcodec/atrac3.c b/libavcodec/atrac3.c
index 7415da590b..5851ee027c 100644
--- a/libavcodec/atrac3.c
+++ b/libavcodec/atrac3.c
@@ -1026,7 +1026,11 @@ const FFCodec ff_atrac3_decoder = {
     .init             = atrac3_decode_init,
     .close            = atrac3_decode_close,
     FF_CODEC_DECODE_CB(atrac3_decode_frame),
-    .p.capabilities   = AV_CODEC_CAP_SUBFRAMES | AV_CODEC_CAP_DR1,
+    .p.capabilities   =
+#if FF_API_SUBFRAMES
+                        AV_CODEC_CAP_SUBFRAMES |
+#endif
+                        AV_CODEC_CAP_DR1,
     .p.sample_fmts    = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
                                                         AV_SAMPLE_FMT_NONE },
     .caps_internal    = FF_CODEC_CAP_INIT_CLEANUP,
@@ -1041,7 +1045,11 @@ const FFCodec ff_atrac3al_decoder = {
     .init             = atrac3_decode_init,
     .close            = atrac3_decode_close,
     FF_CODEC_DECODE_CB(atrac3al_decode_frame),
-    .p.capabilities   = AV_CODEC_CAP_SUBFRAMES | AV_CODEC_CAP_DR1,
+    .p.capabilities   =
+#if FF_API_SUBFRAMES
+                        AV_CODEC_CAP_SUBFRAMES |
+#endif
+                        AV_CODEC_CAP_DR1,
     .p.sample_fmts    = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
                                                         AV_SAMPLE_FMT_NONE },
     .caps_internal    = FF_CODEC_CAP_INIT_CLEANUP,
diff --git a/libavcodec/atrac9dec.c b/libavcodec/atrac9dec.c
index 60962b1676..8a6940455d 100644
--- a/libavcodec/atrac9dec.c
+++ b/libavcodec/atrac9dec.c
@@ -1003,5 +1003,9 @@ const FFCodec ff_atrac9_decoder = {
     FF_CODEC_DECODE_CB(atrac9_decode_frame),
     .flush          = atrac9_decode_flush,
     .caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
-    .p.capabilities = AV_CODEC_CAP_SUBFRAMES | AV_CODEC_CAP_DR1 | AV_CODEC_CAP_CHANNEL_CONF,
+    .p.capabilities =
+#if FF_API_SUBFRAMES
+                      AV_CODEC_CAP_SUBFRAMES |
+#endif
+                      AV_CODEC_CAP_DR1 | AV_CODEC_CAP_CHANNEL_CONF,
 };
diff --git a/libavcodec/bonk.c b/libavcodec/bonk.c
index 4a00270392..9a91b4842e 100644
--- a/libavcodec/bonk.c
+++ b/libavcodec/bonk.c
@@ -428,8 +428,10 @@ const FFCodec ff_bonk_decoder = {
     FF_CODEC_DECODE_CB(bonk_decode),
     .close            = bonk_close,
     .p.capabilities   = AV_CODEC_CAP_DELAY |
-                        AV_CODEC_CAP_DR1 |
-                        AV_CODEC_CAP_SUBFRAMES,
+#if FF_API_SUBFRAMES
+                        AV_CODEC_CAP_SUBFRAMES |
+#endif
+                        AV_CODEC_CAP_DR1,
     .caps_internal    = FF_CODEC_CAP_INIT_CLEANUP,
     .p.sample_fmts    = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16P,
                                                         AV_SAMPLE_FMT_NONE },
diff --git a/libavcodec/codec.h b/libavcodec/codec.h
index 3b1995bcfe..7a932d75dd 100644
--- a/libavcodec/codec.h
+++ b/libavcodec/codec.h
@@ -80,6 +80,7 @@
  */
 #define AV_CODEC_CAP_SMALL_LAST_FRAME    (1 <<  6)
 
+#if FF_API_SUBFRAMES
 /**
  * Codec can output multiple frames per AVPacket
  * Normally demuxers return one frame at a time, demuxers which do not do
@@ -92,6 +93,8 @@
  * as a last resort.
  */
 #define AV_CODEC_CAP_SUBFRAMES           (1 <<  8)
+#endif
+
 /**
  * Codec is experimental and is thus avoided in favor of non experimental
  * encoders
diff --git a/libavcodec/ftr.c b/libavcodec/ftr.c
index 74a2c10b5c..7cf1b1586f 100644
--- a/libavcodec/ftr.c
+++ b/libavcodec/ftr.c
@@ -203,6 +203,10 @@ const FFCodec ff_ftr_decoder = {
     .close          = ftr_close,
     .flush          = ftr_flush,
     .priv_data_size = sizeof(FTRContext),
-    .p.capabilities = AV_CODEC_CAP_SUBFRAMES | AV_CODEC_CAP_DR1,
+    .p.capabilities =
+#if FF_API_SUBFRAMES
+                      AV_CODEC_CAP_SUBFRAMES |
+#endif
+                      AV_CODEC_CAP_DR1,
     .caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
 };
diff --git a/libavcodec/g723_1dec.c b/libavcodec/g723_1dec.c
index 55e20de5b5..5fe4a21d9b 100644
--- a/libavcodec/g723_1dec.c
+++ b/libavcodec/g723_1dec.c
@@ -1118,6 +1118,10 @@ const FFCodec ff_g723_1_decoder = {
     .priv_data_size = sizeof(G723_1_Context),
     .init           = g723_1_decode_init,
     FF_CODEC_DECODE_CB(g723_1_decode_frame),
-    .p.capabilities = AV_CODEC_CAP_SUBFRAMES | AV_CODEC_CAP_DR1,
+    .p.capabilities =
+#if FF_API_SUBFRAMES
+                      AV_CODEC_CAP_SUBFRAMES |
+#endif
+                      AV_CODEC_CAP_DR1,
     .p.priv_class   = &g723_1dec_class,
 };
diff --git a/libavcodec/g729dec.c b/libavcodec/g729dec.c
index f783812cc7..33e1fb9c29 100644
--- a/libavcodec/g729dec.c
+++ b/libavcodec/g729dec.c
@@ -760,7 +760,11 @@ const FFCodec ff_g729_decoder = {
     .init           = decoder_init,
     FF_CODEC_DECODE_CB(decode_frame),
     .close          = decode_close,
-    .p.capabilities = AV_CODEC_CAP_SUBFRAMES | AV_CODEC_CAP_DR1,
+    .p.capabilities =
+#if FF_API_SUBFRAMES
+                      AV_CODEC_CAP_SUBFRAMES |
+#endif
+                      AV_CODEC_CAP_DR1,
 };
 
 const FFCodec ff_acelp_kelvin_decoder = {
@@ -772,5 +776,9 @@ const FFCodec ff_acelp_kelvin_decoder = {
     .init           = decoder_init,
     FF_CODEC_DECODE_CB(decode_frame),
     .close          = decode_close,
-    .p.capabilities = AV_CODEC_CAP_SUBFRAMES | AV_CODEC_CAP_DR1,
+    .p.capabilities =
+#if FF_API_SUBFRAMES
+                      AV_CODEC_CAP_SUBFRAMES |
+#endif
+                      AV_CODEC_CAP_DR1,
 };
diff --git a/libavcodec/libspeexdec.c b/libavcodec/libspeexdec.c
index 47fc5d6a4b..84b308490a 100644
--- a/libavcodec/libspeexdec.c
+++ b/libavcodec/libspeexdec.c
@@ -195,7 +195,11 @@ const FFCodec ff_libspeex_decoder = {
     CODEC_LONG_NAME("libspeex Speex"),
     .p.type         = AVMEDIA_TYPE_AUDIO,
     .p.id           = AV_CODEC_ID_SPEEX,
-    .p.capabilities = AV_CODEC_CAP_SUBFRAMES | AV_CODEC_CAP_DELAY | AV_CODEC_CAP_DR1 | AV_CODEC_CAP_CHANNEL_CONF,
+    .p.capabilities =
+#if FF_API_SUBFRAMES
+                      AV_CODEC_CAP_SUBFRAMES |
+#endif
+                      AV_CODEC_CAP_DELAY | AV_CODEC_CAP_DR1 | AV_CODEC_CAP_CHANNEL_CONF,
     .p.wrapper_name = "libspeex",
     .caps_internal  = FF_CODEC_CAP_NOT_INIT_THREADSAFE,
     .priv_data_size = sizeof(LibSpeexContext),
diff --git a/libavcodec/misc4.c b/libavcodec/misc4.c
index 1bf162e120..72ac944e54 100644
--- a/libavcodec/misc4.c
+++ b/libavcodec/misc4.c
@@ -179,7 +179,10 @@ const FFCodec ff_misc4_decoder = {
     .priv_data_size   = sizeof(MISC4Context),
     .init             = misc4_init,
     FF_CODEC_DECODE_CB(misc4_decode),
-    .p.capabilities   = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_SUBFRAMES |
+    .p.capabilities   = AV_CODEC_CAP_DR1 |
+#if FF_API_SUBFRAMES
+                        AV_CODEC_CAP_SUBFRAMES |
+#endif
                         AV_CODEC_CAP_CHANNEL_CONF,
     .p.sample_fmts    = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16,
                                                         AV_SAMPLE_FMT_NONE },
diff --git a/libavcodec/shorten.c b/libavcodec/shorten.c
index 1b2abd76b1..eca0c4e85a 100644
--- a/libavcodec/shorten.c
+++ b/libavcodec/shorten.c
@@ -814,8 +814,10 @@ const FFCodec ff_shorten_decoder = {
     FF_CODEC_DECODE_CB(shorten_decode_frame),
     .p.capabilities = AV_CODEC_CAP_CHANNEL_CONF |
                       AV_CODEC_CAP_DELAY |
-                      AV_CODEC_CAP_DR1 |
-                      AV_CODEC_CAP_SUBFRAMES ,
+#if FF_API_SUBFRAMES
+                      AV_CODEC_CAP_SUBFRAMES |
+#endif
+                      AV_CODEC_CAP_DR1,
     .p.sample_fmts  = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16P,
                                                       AV_SAMPLE_FMT_U8P,
                                                       AV_SAMPLE_FMT_NONE },
diff --git a/libavcodec/tests/avcodec.c b/libavcodec/tests/avcodec.c
index 4c1730425d..d78447d0fc 100644
--- a/libavcodec/tests/avcodec.c
+++ b/libavcodec/tests/avcodec.c
@@ -149,8 +149,7 @@ int main(void){
                                         FF_CODEC_CAP_SETS_FRAME_PROPS) ||
                 codec->capabilities  & (AV_CODEC_CAP_AVOID_PROBING |
                                         AV_CODEC_CAP_CHANNEL_CONF  |
-                                        AV_CODEC_CAP_DRAW_HORIZ_BAND |
-                                        AV_CODEC_CAP_SUBFRAMES))
+                                        AV_CODEC_CAP_DRAW_HORIZ_BAND))
                 ERR("Encoder %s has decoder-only capabilities set\n");
             if (codec->capabilities & AV_CODEC_CAP_FRAME_THREADS &&
                 codec->capabilities & AV_CODEC_CAP_ENCODER_FLUSH)
diff --git a/libavcodec/version_major.h b/libavcodec/version_major.h
index 40db213499..8c3ce43165 100644
--- a/libavcodec/version_major.h
+++ b/libavcodec/version_major.h
@@ -46,6 +46,7 @@
 #define FF_API_VT_HWACCEL_CONTEXT  (LIBAVCODEC_VERSION_MAJOR < 61)
 #define FF_API_AVCTX_FRAME_NUMBER  (LIBAVCODEC_VERSION_MAJOR < 61)
 #define FF_API_SLICE_OFFSET        (LIBAVCODEC_VERSION_MAJOR < 61)
+#define FF_API_SUBFRAMES           (LIBAVCODEC_VERSION_MAJOR < 61)
 
 // reminder to remove CrystalHD decoders on next major bump
 #define FF_CODEC_CRYSTAL_HD        (LIBAVCODEC_VERSION_MAJOR < 61)
diff --git a/libavcodec/wavarc.c b/libavcodec/wavarc.c
index 827803c91d..7bfc276df4 100644
--- a/libavcodec/wavarc.c
+++ b/libavcodec/wavarc.c
@@ -499,7 +499,9 @@ const FFCodec ff_wavarc_decoder = {
     FF_CODEC_DECODE_CB(wavarc_decode),
     .close            = wavarc_close,
     .p.capabilities   = AV_CODEC_CAP_DR1 |
+#if FF_API_SUBFRAMES
                         AV_CODEC_CAP_SUBFRAMES |
+#endif
                         AV_CODEC_CAP_DELAY,
     .p.sample_fmts    = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_U8P,
                                                         AV_SAMPLE_FMT_S16P,
diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c
index d545d848e2..5d1c7ac66b 100644
--- a/libavcodec/wmalosslessdec.c
+++ b/libavcodec/wmalosslessdec.c
@@ -1334,7 +1334,11 @@ const FFCodec ff_wmalossless_decoder = {
     .close          = decode_close,
     FF_CODEC_DECODE_CB(decode_packet),
     .flush          = flush,
-    .p.capabilities = AV_CODEC_CAP_SUBFRAMES | AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY,
+    .p.capabilities =
+#if FF_API_SUBFRAMES
+                      AV_CODEC_CAP_SUBFRAMES |
+#endif
+                      AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY,
     .caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
     .p.sample_fmts  = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16P,
                                                       AV_SAMPLE_FMT_S32P,
diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c
index 35e9caec56..f523f3637f 100644
--- a/libavcodec/wmaprodec.c
+++ b/libavcodec/wmaprodec.c
@@ -2094,7 +2094,11 @@ const FFCodec ff_wmapro_decoder = {
     .init           = wmapro_decode_init,
     .close          = wmapro_decode_end,
     FF_CODEC_DECODE_CB(wmapro_decode_packet),
-    .p.capabilities = AV_CODEC_CAP_SUBFRAMES | AV_CODEC_CAP_DR1,
+    .p.capabilities =
+#if FF_API_SUBFRAMES
+                      AV_CODEC_CAP_SUBFRAMES |
+#endif
+                      AV_CODEC_CAP_DR1,
     .flush          = wmapro_flush,
     .p.sample_fmts  = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
                                                       AV_SAMPLE_FMT_NONE },
@@ -2111,7 +2115,11 @@ const FFCodec ff_xma1_decoder = {
     .close          = xma_decode_end,
     FF_CODEC_DECODE_CB(xma_decode_packet),
     .flush          = xma_flush,
-    .p.capabilities = AV_CODEC_CAP_SUBFRAMES | AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY,
+    .p.capabilities =
+#if FF_API_SUBFRAMES
+                      AV_CODEC_CAP_SUBFRAMES |
+#endif
+                      AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY,
     .p.sample_fmts  = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
                                                       AV_SAMPLE_FMT_NONE },
     .caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
@@ -2127,7 +2135,11 @@ const FFCodec ff_xma2_decoder = {
     .close          = xma_decode_end,
     FF_CODEC_DECODE_CB(xma_decode_packet),
     .flush          = xma_flush,
-    .p.capabilities = AV_CODEC_CAP_SUBFRAMES | AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY,
+    .p.capabilities =
+#if FF_API_SUBFRAMES
+                      AV_CODEC_CAP_SUBFRAMES |
+#endif
+                      AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY,
     .p.sample_fmts  = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
                                                       AV_SAMPLE_FMT_NONE },
     .caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
diff --git a/libavcodec/wmavoice.c b/libavcodec/wmavoice.c
index bb98f841a5..44fda0e2d6 100644
--- a/libavcodec/wmavoice.c
+++ b/libavcodec/wmavoice.c
@@ -2004,7 +2004,11 @@ const FFCodec ff_wmavoice_decoder = {
     .init             = wmavoice_decode_init,
     .close            = wmavoice_decode_end,
     FF_CODEC_DECODE_CB(wmavoice_decode_packet),
-    .p.capabilities   = AV_CODEC_CAP_SUBFRAMES | AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY,
+    .p.capabilities   =
+#if FF_API_SUBFRAMES
+                        AV_CODEC_CAP_SUBFRAMES |
+#endif
+                        AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY,
     .caps_internal    = FF_CODEC_CAP_INIT_CLEANUP,
     .flush            = wmavoice_flush,
 };



More information about the ffmpeg-cvslog mailing list