Re: [FFmpeg-devel] [PATCH 3/3] lavu/vulkan: only request beta extensions if we detected they're present

2023-02-04 Thread Lynne
5 Feb 2023, 00:17 by rco...@rcombs.me:

> Fixes build on systems where vulkan_beta.h is absent (e.g. Android)
> ---
>  libavutil/hwcontext_vulkan.c | 5 -
>  libavutil/vulkan_functions.h | 4 
>  2 files changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c
> index 589a7a7d9a..67802a850d 100644
> --- a/libavutil/hwcontext_vulkan.c
> +++ b/libavutil/hwcontext_vulkan.c
> @@ -16,8 +16,12 @@
>  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 
> USA
>  */
>  
> +#include "config.h"
> +
>  #define VK_NO_PROTOTYPES
> +#if HAVE_VULKAN_BETA
>  #define VK_ENABLE_BETA_EXTENSIONS
> +#endif
>  
>  #ifdef _WIN32
>  #include  /* Included to prevent conflicts with CreateSemaphore */
> @@ -29,7 +33,6 @@
>  
>  #include 
>  
> -#include "config.h"
>  #include "pixdesc.h"
>  #include "avstring.h"
>  #include "imgutils.h"
> diff --git a/libavutil/vulkan_functions.h b/libavutil/vulkan_functions.h
> index d15a5d9a42..4d80322540 100644
> --- a/libavutil/vulkan_functions.h
> +++ b/libavutil/vulkan_functions.h
> @@ -19,8 +19,12 @@
>  #ifndef AVUTIL_VULKAN_FUNCTIONS_H
>  #define AVUTIL_VULKAN_FUNCTIONS_H
>  
> +#include "config.h"
> +
>  #define VK_NO_PROTOTYPES
> +#if HAVE_VULKAN_BETA
>  #define VK_ENABLE_BETA_EXTENSIONS
> +#endif
>  
>  #include "hwcontext.h"
>  #include "hwcontext_vulkan.h"
> -- 
> 2.39.1
>

I've fixed this and a few other issues in my vulkan branch.
Could this wait a little longer until it's merged?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v3 2/3] avcodec/pngdec: read colorspace info when decoding with AVDISCARD_ALL

2023-02-04 Thread Leo Izen

On 2/4/23 22:47, Andreas Rheinhardt wrote:

Leo Izen:

These chunks are lightweight and it's useful information to have when
running ffmpeg -i or ffprobe, for example.
---
  libavcodec/pngdec.c  | 103 ++-
  tests/ref/fate/png-icc   |   8 +--
  tests/ref/fate/png-side-data |   2 +-
  3 files changed, 59 insertions(+), 54 deletions(-)

diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
index 0d969decf2..a80e0d15bb 100644
--- a/libavcodec/pngdec.c
+++ b/libavcodec/pngdec.c
@@ -1203,7 +1203,7 @@ static int decode_frame_common(AVCodecContext *avctx, 
PNGDecContext *s,
  
  if (avctx->codec_id == AV_CODEC_ID_PNG &&

  avctx->skip_frame == AVDISCARD_ALL) {
-return 0;
+goto exit_loop;
  }
  
  if (CONFIG_APNG_DECODER && avctx->codec_id == AV_CODEC_ID_APNG && length == 0) {

@@ -1256,6 +1256,9 @@ static int decode_frame_common(AVCodecContext *avctx, 
PNGDecContext *s,
  case MKTAG('t', 'E', 'X', 't'):
  case MKTAG('I', 'D', 'A', 'T'):
  case MKTAG('t', 'R', 'N', 'S'):
+case MKTAG('s', 'R', 'G', 'B'):
+case MKTAG('c', 'I', 'C', 'P'):
+case MKTAG('c', 'H', 'R', 'M'):
  break;
  default:
  continue;
@@ -1382,6 +1385,56 @@ static int decode_frame_common(AVCodecContext *avctx, 
PNGDecContext *s,
  }
  exit_loop:
  
+if (s->have_cicp) {

+if (s->cicp_primaries >= AVCOL_PRI_NB)
+av_log(avctx, AV_LOG_WARNING, "unrecognized cICP primaries\n");
+else
+avctx->color_primaries = p->color_primaries = s->cicp_primaries;
+if (s->cicp_trc >= AVCOL_TRC_NB)
+av_log(avctx, AV_LOG_WARNING, "unrecognized cICP transfer\n");
+else
+avctx->color_trc = p->color_trc = s->cicp_trc;


This code (both the new code as well as the old code in output_frame()
added in 6f79f0971e8 and f7bab37c8e6 and 2548c32cc10) modify avctx
fields after ff_thread_finish_setup() and are racy with respect to the
generic copying of AVCodecContext fields in update_context_from_thread()
in pthread_frame.c.



Where should I update these fields instead to prevent races? I'm not 
sure where else to set it.




+/* we don't support tv-range RGB */
+avctx->color_range = p->color_range = AVCOL_RANGE_JPEG;


You set this unconditionally below, too.


Shouldn't be set twice, good catch. Can remove this one.




+if (s->cicp_range == 0)
+av_log(avctx, AV_LOG_WARNING, "unsupported tv-range cICP chunk\n");
+} else if (s->iccp_data) {
+AVFrameSideData *sd = av_frame_new_side_data(p, 
AV_FRAME_DATA_ICC_PROFILE, s->iccp_data_len);
+if (!sd) {
+ret = AVERROR(ENOMEM);
+goto fail;
+}
+memcpy(sd->data, s->iccp_data, s->iccp_data_len);
+
+av_dict_set(>metadata, "name", s->iccp_name, 0);
+} else if (s->have_srgb) {
+avctx->color_primaries = p->color_primaries = AVCOL_PRI_BT709;
+avctx->color_trc = p->color_trc = AVCOL_TRC_IEC61966_2_1;
+} else if (s->have_chrm) {
+AVColorPrimariesDesc desc;
+enum AVColorPrimaries prim;
+desc.wp.x = av_make_q(s->white_point[0], 10);
+desc.wp.y = av_make_q(s->white_point[1], 10);
+desc.prim.r.x = av_make_q(s->display_primaries[0][0], 10);
+desc.prim.r.y = av_make_q(s->display_primaries[0][1], 10);
+desc.prim.g.x = av_make_q(s->display_primaries[1][0], 10);
+desc.prim.g.y = av_make_q(s->display_primaries[1][1], 10);
+desc.prim.b.x = av_make_q(s->display_primaries[2][0], 10);
+desc.prim.b.y = av_make_q(s->display_primaries[2][1], 10);
+prim = av_csp_primaries_id_from_desc();
+if (prim != AVCOL_PRI_UNSPECIFIED)
+avctx->color_primaries = p->color_primaries = prim;
+else
+av_log(avctx, AV_LOG_WARNING, "unknown cHRM primaries\n");
+}
+
+/* these chunks override gAMA */
+if (s->iccp_data || s->have_srgb || s->have_cicp)
+av_dict_set(>frame_metadata, "gamma", NULL, 0);
+
+avctx->colorspace = p->colorspace = AVCOL_SPC_RGB;
+avctx->color_range = p->color_range = AVCOL_RANGE_JPEG;


This is new in this patch; it changes behaviour even when nothing is
discarded. Is this intended?


Yes. These are the only values supported by our PNG decoder so it makes 
sense to set them unconditionally.


The color range is already set in the init function, but it's also set 
here for clarity. I could possibly move the unconditional colorspace 
setting to the init function as well and remove both of these lines.


- Leo Izen (thebombzen)

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email

Re: [FFmpeg-devel] [PATCH v3 2/3] avcodec/pngdec: read colorspace info when decoding with AVDISCARD_ALL

2023-02-04 Thread Andreas Rheinhardt
Leo Izen:
> These chunks are lightweight and it's useful information to have when
> running ffmpeg -i or ffprobe, for example.
> ---
>  libavcodec/pngdec.c  | 103 ++-
>  tests/ref/fate/png-icc   |   8 +--
>  tests/ref/fate/png-side-data |   2 +-
>  3 files changed, 59 insertions(+), 54 deletions(-)
> 
> diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
> index 0d969decf2..a80e0d15bb 100644
> --- a/libavcodec/pngdec.c
> +++ b/libavcodec/pngdec.c
> @@ -1203,7 +1203,7 @@ static int decode_frame_common(AVCodecContext *avctx, 
> PNGDecContext *s,
>  
>  if (avctx->codec_id == AV_CODEC_ID_PNG &&
>  avctx->skip_frame == AVDISCARD_ALL) {
> -return 0;
> +goto exit_loop;
>  }
>  
>  if (CONFIG_APNG_DECODER && avctx->codec_id == AV_CODEC_ID_APNG 
> && length == 0) {
> @@ -1256,6 +1256,9 @@ static int decode_frame_common(AVCodecContext *avctx, 
> PNGDecContext *s,
>  case MKTAG('t', 'E', 'X', 't'):
>  case MKTAG('I', 'D', 'A', 'T'):
>  case MKTAG('t', 'R', 'N', 'S'):
> +case MKTAG('s', 'R', 'G', 'B'):
> +case MKTAG('c', 'I', 'C', 'P'):
> +case MKTAG('c', 'H', 'R', 'M'):
>  break;
>  default:
>  continue;
> @@ -1382,6 +1385,56 @@ static int decode_frame_common(AVCodecContext *avctx, 
> PNGDecContext *s,
>  }
>  exit_loop:
>  
> +if (s->have_cicp) {
> +if (s->cicp_primaries >= AVCOL_PRI_NB)
> +av_log(avctx, AV_LOG_WARNING, "unrecognized cICP primaries\n");
> +else
> +avctx->color_primaries = p->color_primaries = s->cicp_primaries;
> +if (s->cicp_trc >= AVCOL_TRC_NB)
> +av_log(avctx, AV_LOG_WARNING, "unrecognized cICP transfer\n");
> +else
> +avctx->color_trc = p->color_trc = s->cicp_trc;

This code (both the new code as well as the old code in output_frame()
added in 6f79f0971e8 and f7bab37c8e6 and 2548c32cc10) modify avctx
fields after ff_thread_finish_setup() and are racy with respect to the
generic copying of AVCodecContext fields in update_context_from_thread()
in pthread_frame.c.

> +/* we don't support tv-range RGB */
> +avctx->color_range = p->color_range = AVCOL_RANGE_JPEG;

You set this unconditionally below, too.

> +if (s->cicp_range == 0)
> +av_log(avctx, AV_LOG_WARNING, "unsupported tv-range cICP 
> chunk\n");
> +} else if (s->iccp_data) {
> +AVFrameSideData *sd = av_frame_new_side_data(p, 
> AV_FRAME_DATA_ICC_PROFILE, s->iccp_data_len);
> +if (!sd) {
> +ret = AVERROR(ENOMEM);
> +goto fail;
> +}
> +memcpy(sd->data, s->iccp_data, s->iccp_data_len);
> +
> +av_dict_set(>metadata, "name", s->iccp_name, 0);
> +} else if (s->have_srgb) {
> +avctx->color_primaries = p->color_primaries = AVCOL_PRI_BT709;
> +avctx->color_trc = p->color_trc = AVCOL_TRC_IEC61966_2_1;
> +} else if (s->have_chrm) {
> +AVColorPrimariesDesc desc;
> +enum AVColorPrimaries prim;
> +desc.wp.x = av_make_q(s->white_point[0], 10);
> +desc.wp.y = av_make_q(s->white_point[1], 10);
> +desc.prim.r.x = av_make_q(s->display_primaries[0][0], 10);
> +desc.prim.r.y = av_make_q(s->display_primaries[0][1], 10);
> +desc.prim.g.x = av_make_q(s->display_primaries[1][0], 10);
> +desc.prim.g.y = av_make_q(s->display_primaries[1][1], 10);
> +desc.prim.b.x = av_make_q(s->display_primaries[2][0], 10);
> +desc.prim.b.y = av_make_q(s->display_primaries[2][1], 10);
> +prim = av_csp_primaries_id_from_desc();
> +if (prim != AVCOL_PRI_UNSPECIFIED)
> +avctx->color_primaries = p->color_primaries = prim;
> +else
> +av_log(avctx, AV_LOG_WARNING, "unknown cHRM primaries\n");
> +}
> +
> +/* these chunks override gAMA */
> +if (s->iccp_data || s->have_srgb || s->have_cicp)
> +av_dict_set(>frame_metadata, "gamma", NULL, 0);
> +
> +avctx->colorspace = p->colorspace = AVCOL_SPC_RGB;
> +avctx->color_range = p->color_range = AVCOL_RANGE_JPEG;

This is new in this patch; it changes behaviour even when nothing is
discarded. Is this intended?

> +
>  if (avctx->codec_id == AV_CODEC_ID_PNG &&
>  avctx->skip_frame == AVDISCARD_ALL) {
>  return 0;
> @@ -1499,56 +1552,8 @@ static void clear_frame_metadata(PNGDecContext *s)
>  
>  static int output_frame(PNGDecContext *s, AVFrame *f)
>  {
> -AVCodecContext *avctx = s->avctx;
>  int ret;
>  
> -if (s->have_cicp) {
> -if (s->cicp_primaries >= AVCOL_PRI_NB)
> -av_log(avctx, AV_LOG_WARNING, "unrecognized cICP primaries\n");
> -else
> -avctx->color_primaries = f->color_primaries = s->cicp_primaries;
> -if (s->cicp_trc >= 

Re: [FFmpeg-devel] [PATCH] avcodec/libjxl: add #ifdef guards for libjxl >= 0.8.0 features

2023-02-04 Thread Leo Izen

On 2/4/23 18:28, Leo Izen wrote:
> Since many distributions ship libjxl 0.7.0 still, we'd still prefer to
> compile against that, but don't want to lose the features that require
> libjxl 0.8.0 or greater. For this reason I've added preprocessor #ifdef
> guards around the features that aren't necessarily in libjxl 0.7.0.
>
> Signed-off-by: Leo Izen 

This is an alternative to the above patch. I replied it to the previous 
patch so they can be compared but only one should be applied.


- Leo Izen (thebombzen)

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH] avcodec/libjxl: add #ifdef guards for libjxl >= 0.8.0 features

2023-02-04 Thread Leo Izen
Since many distributions ship libjxl 0.7.0 still, we'd still prefer to
compile against that, but don't want to lose the features that require
libjxl 0.8.0 or greater. For this reason I've added preprocessor #ifdef
guards around the features that aren't necessarily in libjxl 0.7.0.

Signed-off-by: Leo Izen 
---
 libavcodec/libjxl.h| 12 
 libavcodec/libjxldec.c | 19 +--
 libavcodec/libjxlenc.c | 18 ++
 3 files changed, 39 insertions(+), 10 deletions(-)

diff --git a/libavcodec/libjxl.h b/libavcodec/libjxl.h
index 5387c438fd..e305b6e758 100644
--- a/libavcodec/libjxl.h
+++ b/libavcodec/libjxl.h
@@ -27,8 +27,20 @@
 #ifndef AVCODEC_LIBJXL_H
 #define AVCODEC_LIBJXL_H
 
+#include 
 #include 
 
+/*
+ * libjxl version 0.7.0 and earlier doesn't contain these macros at all
+ * so to detect version 0.7.0 versus 0.8.0 we need to define them ourselves
+ */
+#ifndef JPEGXL_COMPUTE_NUMERIC_VERSION
+#define JPEGXL_COMPUTE_NUMERIC_VERSION(major,minor,patch) ((major<<24) | 
(minor<<16) | (patch<<8) | 0)
+#endif
+#ifndef JPEGXL_NUMERIC_VERSION
+#define JPEGXL_NUMERIC_VERSION JPEGXL_COMPUTE_NUMERIC_VERSION(0, 7, 0)
+#endif
+
 /**
  * Transform threadcount in ffmpeg to one used by libjxl.
  *
diff --git a/libavcodec/libjxldec.c b/libavcodec/libjxldec.c
index abe08eb400..045a1535f9 100644
--- a/libavcodec/libjxldec.c
+++ b/libavcodec/libjxldec.c
@@ -47,7 +47,9 @@ typedef struct LibJxlDecodeContext {
 JxlDecoder *decoder;
 JxlBasicInfo basic_info;
 JxlPixelFormat jxl_pixfmt;
+#if JPEGXL_NUMERIC_VERSION >= JPEGXL_COMPUTE_NUMERIC_VERSION(0, 8, 0)
 JxlBitDepth jxl_bit_depth;
+#endif
 JxlDecoderStatus events;
 AVBufferRef *iccp;
 } LibJxlDecodeContext;
@@ -94,14 +96,17 @@ static av_cold int libjxl_decode_init(AVCodecContext *avctx)
 return libjxl_init_jxl_decoder(avctx);
 }
 
-static enum AVPixelFormat libjxl_get_pix_fmt(AVCodecContext *avctx, const 
JxlBasicInfo *basic_info,
- JxlPixelFormat *format, 
JxlBitDepth *depth)
+static enum AVPixelFormat libjxl_get_pix_fmt(AVCodecContext *avctx, 
LibJxlDecodeContext *ctx)
 {
+const JxlBasicInfo *basic_info = >basic_info;
+JxlPixelFormat *format = >jxl_pixfmt;
 format->endianness = JXL_NATIVE_ENDIAN;
 format->num_channels = basic_info->num_color_channels + 
(basic_info->alpha_bits > 0);
-depth->bits_per_sample = avctx->bits_per_raw_sample = 
basic_info->bits_per_sample;
-depth->type = JXL_BIT_DEPTH_FROM_PIXEL_FORMAT;
-depth->exponent_bits_per_sample = basic_info->exponent_bits_per_sample;
+#if JPEGXL_NUMERIC_VERSION >= JPEGXL_COMPUTE_NUMERIC_VERSION(0, 8, 0)
+ctx->jxl_bit_depth.bits_per_sample = avctx->bits_per_raw_sample = 
basic_info->bits_per_sample;
+ctx->jxl_bit_depth.type = JXL_BIT_DEPTH_FROM_PIXEL_FORMAT;
+ctx->jxl_bit_depth.exponent_bits_per_sample = 
basic_info->exponent_bits_per_sample;
+#endif
 /* Gray */
 if (basic_info->num_color_channels == 1) {
 if (basic_info->bits_per_sample <= 8) {
@@ -372,7 +377,7 @@ static int libjxl_decode_frame(AVCodecContext *avctx, 
AVFrame *frame, int *got_f
 av_log(avctx, AV_LOG_ERROR, "Bad libjxl basic info event\n");
 return AVERROR_EXTERNAL;
 }
-avctx->pix_fmt = libjxl_get_pix_fmt(avctx, >basic_info, 
>jxl_pixfmt, >jxl_bit_depth);
+avctx->pix_fmt = libjxl_get_pix_fmt(avctx, ctx);
 if (avctx->pix_fmt == AV_PIX_FMT_NONE) {
 av_log(avctx, AV_LOG_ERROR, "Bad libjxl pixel format\n");
 return AVERROR_EXTERNAL;
@@ -395,10 +400,12 @@ static int libjxl_decode_frame(AVCodecContext *avctx, 
AVFrame *frame, int *got_f
 av_log(avctx, AV_LOG_ERROR, "Bad libjxl dec need image out 
buffer event\n");
 return AVERROR_EXTERNAL;
 }
+#if JPEGXL_NUMERIC_VERSION >= JPEGXL_COMPUTE_NUMERIC_VERSION(0, 8, 0)
 if (JxlDecoderSetImageOutBitDepth(ctx->decoder, 
>jxl_bit_depth) != JXL_DEC_SUCCESS) {
 av_log(avctx, AV_LOG_ERROR, "Error setting output bit 
depth\n");
 return AVERROR_EXTERNAL;
 }
+#endif
 continue;
 case JXL_DEC_FULL_IMAGE:
 /* full image is one frame, even if animated */
diff --git a/libavcodec/libjxlenc.c b/libavcodec/libjxlenc.c
index c51024f180..897452f575 100644
--- a/libavcodec/libjxlenc.c
+++ b/libavcodec/libjxlenc.c
@@ -250,7 +250,10 @@ static int libjxl_encode_frame(AVCodecContext *avctx, 
AVPacket *pkt, const AVFra
 JxlBasicInfo info;
 JxlColorEncoding jxl_color;
 JxlPixelFormat jxl_fmt;
+int bits_per_sample;
+#if JPEGXL_NUMERIC_VERSION >= JPEGXL_COMPUTE_NUMERIC_VERSION(0, 8, 0)
 JxlBitDepth jxl_bit_depth;
+#endif
 JxlEncoderStatus jret;
 int ret;
 size_t available = ctx->buffer_size;
@@ -270,22 +273,26 @@ static int libjxl_encode_frame(AVCodecContext *avctx, 
AVPacket *pkt, const AVFra
 

[FFmpeg-devel] [PATCH 3/3] lavu/vulkan: only request beta extensions if we detected they're present

2023-02-04 Thread rcombs
Fixes build on systems where vulkan_beta.h is absent (e.g. Android)
---
 libavutil/hwcontext_vulkan.c | 5 -
 libavutil/vulkan_functions.h | 4 
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c
index 589a7a7d9a..67802a850d 100644
--- a/libavutil/hwcontext_vulkan.c
+++ b/libavutil/hwcontext_vulkan.c
@@ -16,8 +16,12 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include "config.h"
+
 #define VK_NO_PROTOTYPES
+#if HAVE_VULKAN_BETA
 #define VK_ENABLE_BETA_EXTENSIONS
+#endif
 
 #ifdef _WIN32
 #include  /* Included to prevent conflicts with CreateSemaphore */
@@ -29,7 +33,6 @@
 
 #include 
 
-#include "config.h"
 #include "pixdesc.h"
 #include "avstring.h"
 #include "imgutils.h"
diff --git a/libavutil/vulkan_functions.h b/libavutil/vulkan_functions.h
index d15a5d9a42..4d80322540 100644
--- a/libavutil/vulkan_functions.h
+++ b/libavutil/vulkan_functions.h
@@ -19,8 +19,12 @@
 #ifndef AVUTIL_VULKAN_FUNCTIONS_H
 #define AVUTIL_VULKAN_FUNCTIONS_H
 
+#include "config.h"
+
 #define VK_NO_PROTOTYPES
+#if HAVE_VULKAN_BETA
 #define VK_ENABLE_BETA_EXTENSIONS
+#endif
 
 #include "hwcontext.h"
 #include "hwcontext_vulkan.h"
-- 
2.39.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 2/3] configure: check for vulkan beta extension support

2023-02-04 Thread rcombs
Some systems (e.g. android) provide vulkan.h, but not vulkan_beta.h.
In that case, compiling vulkan.h with VK_ENABLE_BETA_EXTENSIONS enabled
will result in a preprocessor error. We can check for this up-front.
---
 configure | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/configure b/configure
index d67855c729..8c7311ce74 100755
--- a/configure
+++ b/configure
@@ -2408,6 +2408,7 @@ HAVE_LIST="
 perl
 pod2man
 texi2html
+vulkan_beta
 xmllint
 zlib_gzip
 "
@@ -7008,6 +7009,8 @@ enabled crystalhd && check_lib crystalhd "stdint.h 
libcrystalhd/libcrystalhd_if.
 if enabled vulkan; then
 check_pkg_config_header_only vulkan "vulkan >= 1.2.189" "vulkan/vulkan.h" 
"defined VK_VERSION_1_2" ||
 check_cpp_condition vulkan "vulkan/vulkan.h" "defined(VK_VERSION_1_3) 
|| (defined(VK_VERSION_1_2) && VK_HEADER_VERSION >= 189)"
+test_cflags_cc "-DVK_ENABLE_BETA_EXTENSIONS" "vulkan/vulkan.h" "1" &&
+enable vulkan_beta
 fi
 
 if enabled x86; then
-- 
2.39.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 1/3] lavu/hwcontext_vulkan: check for encode/decode queue extensions

2023-02-04 Thread rcombs
These are currently beta features, and aren't always present.
---
 libavutil/hwcontext_vulkan.c | 16 
 1 file changed, 16 insertions(+)

diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c
index 2a9b5f4aac..589a7a7d9a 100644
--- a/libavutil/hwcontext_vulkan.c
+++ b/libavutil/hwcontext_vulkan.c
@@ -954,8 +954,16 @@ static int setup_queue_families(AVHWDeviceContext *ctx, 
VkDeviceCreateInfo *cd)
((qf[i].queueFlags) & VK_QUEUE_GRAPHICS_BIT) ? " graphics" : "",
((qf[i].queueFlags) & VK_QUEUE_COMPUTE_BIT) ? " compute" : "",
((qf[i].queueFlags) & VK_QUEUE_TRANSFER_BIT) ? " transfer" : "",
+#ifdef VK_KHR_video_encode_queue
((qf[i].queueFlags) & VK_QUEUE_VIDEO_ENCODE_BIT_KHR) ? " 
encode" : "",
+#else
+   "",
+#endif
+#ifdef VK_KHR_video_decode_queue
((qf[i].queueFlags) & VK_QUEUE_VIDEO_DECODE_BIT_KHR) ? " 
decode" : "",
+#else
+   "",
+#endif
((qf[i].queueFlags) & VK_QUEUE_SPARSE_BINDING_BIT) ? " sparse" 
: "",
((qf[i].queueFlags) & VK_QUEUE_PROTECTED_BIT) ? " protected" : 
"",
qf[i].queueCount);
@@ -969,8 +977,16 @@ static int setup_queue_families(AVHWDeviceContext *ctx, 
VkDeviceCreateInfo *cd)
 graph_index = pick_queue_family(qf, num, VK_QUEUE_GRAPHICS_BIT);
 comp_index  = pick_queue_family(qf, num, VK_QUEUE_COMPUTE_BIT);
 tx_index= pick_queue_family(qf, num, VK_QUEUE_TRANSFER_BIT);
+#ifdef VK_KHR_video_encode_queue
 enc_index   = pick_queue_family(qf, num, VK_QUEUE_VIDEO_ENCODE_BIT_KHR);
+#else
+enc_index   = -1;
+#endif
+#ifdef VK_KHR_video_decode_queue
 dec_index   = pick_queue_family(qf, num, VK_QUEUE_VIDEO_DECODE_BIT_KHR);
+#else
+dec_index   = -1;
+#endif
 
 /* Signalling the transfer capabilities on a queue family is optional */
 if (tx_index < 0) {
-- 
2.39.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH] avfilter: fix af_pan regression

2023-02-04 Thread Paul B Mahol
Patch attached.
From b53fa290876af0f540a99f733193f270103bf8ad Mon Sep 17 00:00:00 2001
From: Paul B Mahol 
Date: Sat, 4 Feb 2023 21:46:15 +0100
Subject: [PATCH] avfilter/af_pan: fix regression introduced with switch to new
 channel layout API

Fixes #10168

Signed-off-by: Paul B Mahol 
---
 libavfilter/af_pan.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavfilter/af_pan.c b/libavfilter/af_pan.c
index 067f646805..504e0fb5d3 100644
--- a/libavfilter/af_pan.c
+++ b/libavfilter/af_pan.c
@@ -313,6 +313,7 @@ static int config_props(AVFilterLink *link)
 pan->channel_map[i] = ch_id;
 }
 
+av_opt_set_chlayout(pan->swr, "ichl", >out_channel_layout, 0);
 av_opt_set_int(pan->swr, "uch", pan->nb_output_channels, 0);
 swr_set_channel_mapping(pan->swr, pan->channel_map);
 } else {
@@ -333,6 +334,8 @@ static int config_props(AVFilterLink *link)
 for (j = 0; j < link->ch_layout.nb_channels; j++)
 pan->gain[i][j] /= t;
 }
+av_opt_set_chlayout(pan->swr, "ichl", >ch_layout, 0);
+av_opt_set_chlayout(pan->swr, "ochl", >out_channel_layout, 0);
 swr_set_matrix(pan->swr, pan->gain[0], pan->gain[1] - pan->gain[0]);
 }
 
-- 
2.39.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH] mswindres: Use '-' instead of '/' for rc.exe options

2023-02-04 Thread Ziemowit Laski
Hello Gentlefolk,

I've been bringing up FFMPEG using Visual Studio 2022 and the MINGW64 
environment, and came across sundry things that absolutely needed fixes, so I 
thought I'd submit them as a series of small patches for you to consider.  Here 
is the first patch.

--Zem
===
When building FFMPEG from the MINGW/MSYS shell under Windows, one must not use 
forward slashes ('/') for command-line options.  MINGW/MSYS interprets these as 
absolute paths and then automatically rewrites them into equivalent Windows 
paths.  For example, the '/logo' switch below gets rewritten to something like 
'C:/Program Files/Git/logo', and this obviously breaks the build.  Thankfully, 
most M$ tools accept dashes ('-') as well.

Signed-off-by: Ziemowit Łąski <15880281+zla...@users.noreply.github.com>
---
 compat/windows/mswindres | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/compat/windows/mswindres b/compat/windows/mswindres
index 450525a33e..ed32796230 100755
--- a/compat/windows/mswindres
+++ b/compat/windows/mswindres
@@ -10,12 +10,12 @@ if [ $# -lt 2 ]; then
 exit 0
 fi
 
-EXTRA_OPTS="/nologo"
+EXTRA_OPTS="-nologo"
 
 while [ $# -gt 2 ]; do
 case $1 in
--D*) EXTRA_OPTS="$EXTRA_OPTS /d$(echo $1 | sed -e "s/^..//" -e "s/ / 
/g")" ;;
--I*) EXTRA_OPTS="$EXTRA_OPTS /i$(echo $1 | sed -e "s/^..//" -e "s/ / 
/g")" ;;
+-D*) EXTRA_OPTS="$EXTRA_OPTS -d$(echo $1 | sed -e "s/^..//" -e "s/ / 
/g")" ;;
+-I*) EXTRA_OPTS="$EXTRA_OPTS -i$(echo $1 | sed -e "s/^..//" -e "s/ / 
/g")" ;;
 -o)  OPT_OUT="$2"; shift ;;
 esac
 shift
@@ -29,4 +29,4 @@ else
 fi
 
 eval set -- $EXTRA_OPTS
-rc.exe "$@" /fo "$OUT" "$IN"
+rc.exe "$@" -fo "$OUT" "$IN"
-- 
2.39.1.windows.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH] configure: update libjxl pkg-config versions

2023-02-04 Thread Jan Ekström
On Sat, Feb 4, 2023 at 6:59 PM Leo Izen  wrote:
>
> On 2/4/23 10:24, Andreas Rheinhardt wrote:
> > Leo Izen:
> >> Commit fb823161a8e3dfc864a7bd83a9b968f4912c5b1d added a dependency of
> >> JxlBitDepth, which wasn't present in 0.7.0. This updates the library
> >> versions in ./configure required to match 0.8.0, the new required
> >> version.
> >> ---
> >>   configure | 4 ++--
> >>   1 file changed, 2 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/configure b/configure
> >> index d67855c729..013bd3dcfd 100755
> >> --- a/configure
> >> +++ b/configure
> >> @@ -6596,8 +6596,8 @@ enabled libgsm&& { for gsm_hdr in 
> >> "gsm.h" "gsm/gsm.h"; do
> >>  check_lib libgsm "${gsm_hdr}" 
> >> gsm_create -lgsm && break;
> >>  done || die "ERROR: libgsm not found"; }
> >>   enabled libilbc   && require libilbc ilbc.h 
> >> WebRtcIlbcfix_InitDecode -lilbc $pthreads_extralibs
> >> -enabled libjxl&& require_pkg_config libjxl "libjxl >= 0.7.0" 
> >> jxl/decode.h JxlDecoderVersion &&
> >> - require_pkg_config libjxl_threads 
> >> "libjxl_threads >= 0.7.0" jxl/thread_parallel_runner.h 
> >> JxlThreadParallelRunner
> >> +enabled libjxl&& require_pkg_config libjxl "libjxl >= 0.8.0" 
> >> jxl/decode.h JxlDecoderVersion &&
> >> + require_pkg_config libjxl_threads 
> >> "libjxl_threads >= 0.8.0" jxl/thread_parallel_runner.h 
> >> JxlThreadParallelRunner
> >>   enabled libklvanc && require libklvanc libklvanc/vanc.h 
> >> klvanc_context_create -lklvanc
> >>   enabled libkvazaar&& require_pkg_config libkvazaar "kvazaar >= 
> >> 0.8.1" kvazaar.h kvz_api_get
> >>   enabled liblensfun&& require_pkg_config liblensfun lensfun 
> >> lensfun.h lf_db_new
> >
> > How recent is this?
> >
> > - Andreas
> >
>
> Version 0.8.0 was released about two weeks ago. Is this too recent?
>
> - Leo Izen (thebombzen)

Generally keeping backwards compatibility becomes more relevant when either:

1. the library is already stable and well-established
2. some addition can be easily #ifdef'd or so with version guards.

At this point the lack of this bump is failing compilation on my
Fedora 37 system as it currently still packages libjxl version 0.7.0,
so as it seems like libjxl is still in the process of adding basic
APIs, I'd maybe edge on the side of just bumping the requirement, even
if the bit depth feature itself isn't that critical and could in
theory be ifdef'd around (if libjxl even has useful defines for such
checks).

Jan
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH] configure: update libjxl pkg-config versions

2023-02-04 Thread Leo Izen

On 2/4/23 10:24, Andreas Rheinhardt wrote:

Leo Izen:

Commit fb823161a8e3dfc864a7bd83a9b968f4912c5b1d added a dependency of
JxlBitDepth, which wasn't present in 0.7.0. This updates the library
versions in ./configure required to match 0.8.0, the new required
version.
---
  configure | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index d67855c729..013bd3dcfd 100755
--- a/configure
+++ b/configure
@@ -6596,8 +6596,8 @@ enabled libgsm&& { for gsm_hdr in "gsm.h" 
"gsm/gsm.h"; do
 check_lib libgsm "${gsm_hdr}" gsm_create -lgsm 
&& break;
 done || die "ERROR: libgsm not found"; }
  enabled libilbc   && require libilbc ilbc.h WebRtcIlbcfix_InitDecode 
-lilbc $pthreads_extralibs
-enabled libjxl&& require_pkg_config libjxl "libjxl >= 0.7.0" jxl/decode.h 
JxlDecoderVersion &&
- require_pkg_config libjxl_threads "libjxl_threads >= 
0.7.0" jxl/thread_parallel_runner.h JxlThreadParallelRunner
+enabled libjxl&& require_pkg_config libjxl "libjxl >= 0.8.0" jxl/decode.h 
JxlDecoderVersion &&
+ require_pkg_config libjxl_threads "libjxl_threads >= 
0.8.0" jxl/thread_parallel_runner.h JxlThreadParallelRunner
  enabled libklvanc && require libklvanc libklvanc/vanc.h 
klvanc_context_create -lklvanc
  enabled libkvazaar&& require_pkg_config libkvazaar "kvazaar >= 0.8.1" 
kvazaar.h kvz_api_get
  enabled liblensfun&& require_pkg_config liblensfun lensfun lensfun.h 
lf_db_new


How recent is this?

- Andreas



Version 0.8.0 was released about two weeks ago. Is this too recent?

- Leo Izen (thebombzen)

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v2 29/33] avutil/{color_utils, csp}: merge color_utils into csp and expose API

2023-02-04 Thread Ronald S. Bultje
Hi,

On Sat, Feb 4, 2023 at 11:50 AM Anton Khirnov  wrote:

> From: Leo Izen 
>
> libavutil/color_utils contains some avpriv_ symbols that map
> enum AVTransferCharacteristic values to gamma-curve approximations and
> to the actual transfer functions to invert them (i.e. -> linear).
>
> There's two issues with this:
> (1) avpriv is evil and should be avoided whenever possible
> (2) libavutil/csp.h exposes a public API for handling color that
> already handles primaries and matricies
>
> I don't see any reason this API has to be private, so this commit takes
> the functionality from avutil/color_utils and merges it into avutil/csp
> with an exposed av_ API rather than the previous avpriv_ API.
>
> Every reference to the previous API has been updated to point to the
> new one. color_utils.h has been deleted as well. This should not break
> any applications as it only contained avpriv_ symbols in the first
> place, so nothing in that header could be referenced by other
> applications.
>

Ok with me.

Ronald
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH] lavfi: get rid of FF_INTERNAL_FIELDS

2023-02-04 Thread Andreas Rheinhardt
Nicolas George:
> Andreas Rheinhardt (12023-02-01):
>> "One special guarantee is made in order to simplify the use of unions:
>> if a union contains several structures that share a common initial
>> sequence (see below), and if the union object currently contains one of
>> these structures, it is permitted to inspect the common initial part of
>> any of them anywhere that a declaration of the completed type of the
>> union is visible. Two structures share a common initial sequence if
>> corresponding members have compatible types (and, for bit-fields, the
>> same widths) for a sequence of one or more initial members."
>>
>> But there just is no union between the FF_INTERNAL_FIELDS
>> !defined(FF_INTERNAL_FIELDS) structures in the whole codebase.
> 
> It is not necessary that there is one: it is enough that there could be
> one in another compilation unit, the code that handles these structures
> does not know what exists in the rest of the code base. This guarantee
> was made FOR unions, but it does not REQUIRE unions, it applies to
> anything that is semantically equivalent to a union.
> 

1. The common initial sequence rule indeed forced traditional compilers
to use the same offsets for the members of the common initial sequence
of two arbitrary structs, because there might be a union of these two in
another translation unit. But this is no longer true for lto compilers
that see the whole program at once (although I don't think that they
will deviate from the behaviour of traditional compilers in this regard).
2. But even if the offsets are fine, does not mean that the accesses are
fine. Notice the clause "anywhere that a declaration of the completed
type of the union is visible" above? It is accompanied with the
following example:

"The following is not a valid fragment (because the union type is not
visible within function f):
struct t1 { int m; };
struct t2 { int m; };
int f(struct t1 *p1, struct t2 *p2)
{
if (p1->m < 0)
p2->m = -p2->m;
return p1->m;
}
int g()
{
union {
struct t1 s1;
struct t2 s2;
} u;
/* ... */
return f(, );
}"


>> Furthermore, said guarantee is only for inspecting, i.e. reading. For
>> example, for the following two structs sharing a common initial sequence,
>>
>> struct Small {
>> uint64_t foo;
>> uint32_t bar;
>> };
>> struct Big {
>> uint64_t foo;
>> uint32_t bar;
>> uint32_t baz;
>> };
>>
>> if one had a union { struct Small; struct Big; }, a write to Small.bar
>> may clobber Big.baz.
> 
> That is a good point. It does not apply when the first field of Big is
> Small itself, which is the case that I absolutely know is supported,
> because in that case Big will embed the padding of Small. I had not
> thought of this.
> 
> Fortunately, even if we are not 100% in the case that is officially
> supported, there are multiple reasons that each should be enough to
> guarantee that our code will work:
> 

I'd rather have something that is actually supported and spec-compliant.
Anyway, I worry more about lto-compilers than about traditional
compilers accidentally clobbering something (after all, most of our
fields are sizeof(int)-sized or a multiple (double) thereof, so CPU
instruction sets can write this natively and there is no advantage in
touching padding).

> - Between the public part of the structure and the #ifede
>   FF_INTERNAL_FIELDS, there are a lot of "not part of the public API"
>   fields", changing ch_layout will not clobber incfg because incfg is
>   known at this point.
> 
> - Even if there was no fields in between, reserved[] offers the same
>   protection.
> 
> - And even if there was no gap, we are good because applications, and
>   even filters, are not supposed to modify AVFilterLink, only the
>   framework and the framework knows the whole structure.
> 
> In fact, that last remark makes me think of another solution, for the
> slightly longer term: make AVFilterLink entirely opaque. The only
> documented reason for application to access AVFilterLink was to get the
> parameters of buffersink, but buffersink has a real API to get this
> since 2016.
> 
> Anyway, if you prefer using a compilation option, I have no objection.
> My only concern is that when a developer writes:
> 
>   if (link->x == ... &&
>   link->y == ... &&
>   link->status_in == ... &&
>   link->min_samples == ..)
> 
> they have to remember that no, status_in is different from all the
> others.
> 
> And it is especially bad in this particular case because the distinction
> is not public / private, which makes some semantic sense and might be
> easier to remember, the distinction is actually
> public-or-private-because-of-a-comment / private-because-of-a-ifdef.
> 
> But even if the distinction really was public / private, I consider it
> unacceptable if we can do otherwise. And we can.
> 
> Regards,
> 

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org

Re: [FFmpeg-devel] [PATCH] configure: update libjxl pkg-config versions

2023-02-04 Thread Andreas Rheinhardt
Leo Izen:
> Commit fb823161a8e3dfc864a7bd83a9b968f4912c5b1d added a dependency of
> JxlBitDepth, which wasn't present in 0.7.0. This updates the library
> versions in ./configure required to match 0.8.0, the new required
> version.
> ---
>  configure | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/configure b/configure
> index d67855c729..013bd3dcfd 100755
> --- a/configure
> +++ b/configure
> @@ -6596,8 +6596,8 @@ enabled libgsm&& { for gsm_hdr in "gsm.h" 
> "gsm/gsm.h"; do
> check_lib libgsm "${gsm_hdr}" gsm_create 
> -lgsm && break;
> done || die "ERROR: libgsm not found"; }
>  enabled libilbc   && require libilbc ilbc.h WebRtcIlbcfix_InitDecode 
> -lilbc $pthreads_extralibs
> -enabled libjxl&& require_pkg_config libjxl "libjxl >= 0.7.0" 
> jxl/decode.h JxlDecoderVersion &&
> - require_pkg_config libjxl_threads 
> "libjxl_threads >= 0.7.0" jxl/thread_parallel_runner.h JxlThreadParallelRunner
> +enabled libjxl&& require_pkg_config libjxl "libjxl >= 0.8.0" 
> jxl/decode.h JxlDecoderVersion &&
> + require_pkg_config libjxl_threads 
> "libjxl_threads >= 0.8.0" jxl/thread_parallel_runner.h JxlThreadParallelRunner
>  enabled libklvanc && require libklvanc libklvanc/vanc.h 
> klvanc_context_create -lklvanc
>  enabled libkvazaar&& require_pkg_config libkvazaar "kvazaar >= 
> 0.8.1" kvazaar.h kvz_api_get
>  enabled liblensfun&& require_pkg_config liblensfun lensfun lensfun.h 
> lf_db_new

How recent is this?

- Andreas

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH] configure: update libjxl pkg-config versions

2023-02-04 Thread Leo Izen
Commit fb823161a8e3dfc864a7bd83a9b968f4912c5b1d added a dependency of
JxlBitDepth, which wasn't present in 0.7.0. This updates the library
versions in ./configure required to match 0.8.0, the new required
version.
---
 configure | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index d67855c729..013bd3dcfd 100755
--- a/configure
+++ b/configure
@@ -6596,8 +6596,8 @@ enabled libgsm&& { for gsm_hdr in "gsm.h" 
"gsm/gsm.h"; do
check_lib libgsm "${gsm_hdr}" gsm_create 
-lgsm && break;
done || die "ERROR: libgsm not found"; }
 enabled libilbc   && require libilbc ilbc.h WebRtcIlbcfix_InitDecode 
-lilbc $pthreads_extralibs
-enabled libjxl&& require_pkg_config libjxl "libjxl >= 0.7.0" 
jxl/decode.h JxlDecoderVersion &&
- require_pkg_config libjxl_threads "libjxl_threads 
>= 0.7.0" jxl/thread_parallel_runner.h JxlThreadParallelRunner
+enabled libjxl&& require_pkg_config libjxl "libjxl >= 0.8.0" 
jxl/decode.h JxlDecoderVersion &&
+ require_pkg_config libjxl_threads "libjxl_threads 
>= 0.8.0" jxl/thread_parallel_runner.h JxlThreadParallelRunner
 enabled libklvanc && require libklvanc libklvanc/vanc.h 
klvanc_context_create -lklvanc
 enabled libkvazaar&& require_pkg_config libkvazaar "kvazaar >= 0.8.1" 
kvazaar.h kvz_api_get
 enabled liblensfun&& require_pkg_config liblensfun lensfun lensfun.h 
lf_db_new
-- 
2.39.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH] lavfi: get rid of FF_INTERNAL_FIELDS

2023-02-04 Thread Uoti Urpala
On Fri, 2023-02-03 at 15:45 +0100, Nicolas George wrote:
> Andreas Rheinhardt (12023-02-01):
> > "One special guarantee is made in order to simplify the use of unions:
> > if a union contains several structures that share a common initial
> > sequence (see below), and if the union object currently contains one of
> > these structures, it is permitted to inspect the common initial part of
> > any of them anywhere that a declaration of the completed type of the
> > union is visible. Two structures share a common initial sequence if
> > corresponding members have compatible types (and, for bit-fields, the
> > same widths) for a sequence of one or more initial members."
> > 
> > But there just is no union between the FF_INTERNAL_FIELDS
> > !defined(FF_INTERNAL_FIELDS) structures in the whole codebase.
> 
> It is not necessary that there is one: it is enough that there could be
> one in another compilation unit, the code that handles these structures
> does not know what exists in the rest of the code base. This guarantee
> was made FOR unions, but it does not REQUIRE unions, it applies to
> anything that is semantically equivalent to a union.

This is not valid reasoning. Consider code such as

int f(struct s1 *p1, struct s2 *p2) {
p1->abc = 0;
p2->abc = 42;
return p1->abc;
}

where the field abc belongs to a shared initial sequence in s1 and s2.
If there is no common union visible when this code is compiled, it
seems valid for the compiler to hardcode this to return 0, even if it
may be called with p1 and p2 pointing to the same address. LTO may
generate the equivalent of this code when compiling a combination of
assignments and reads from files using different definitions for a
struct.

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v2 29/33] avutil/{color_utils, csp}: merge color_utils into csp and expose API

2023-02-04 Thread Anton Khirnov
From: Leo Izen 

libavutil/color_utils contains some avpriv_ symbols that map
enum AVTransferCharacteristic values to gamma-curve approximations and
to the actual transfer functions to invert them (i.e. -> linear).

There's two issues with this:
(1) avpriv is evil and should be avoided whenever possible
(2) libavutil/csp.h exposes a public API for handling color that
already handles primaries and matricies

I don't see any reason this API has to be private, so this commit takes
the functionality from avutil/color_utils and merges it into avutil/csp
with an exposed av_ API rather than the previous avpriv_ API.

Every reference to the previous API has been updated to point to the
new one. color_utils.h has been deleted as well. This should not break
any applications as it only contained avpriv_ symbols in the first
place, so nothing in that header could be referenced by other
applications.

Signed-off-by: Leo Izen 
Signed-off-by: Anton Khirnov 
---
 doc/APIchanges|   4 +
 libavcodec/exr.c  |   8 +-
 libavcodec/fflcms2.c  |   1 -
 libavcodec/pngenc.c   |   3 +-
 libavformat/movenc.c  |   7 +-
 libavutil/Makefile|   1 -
 libavutil/color_utils.c   | 234 --
 libavutil/color_utils.h   |  56 
 libavutil/csp.c   | 172 +
 libavutil/csp.h   |  39 ++
 libavutil/tests/color_utils.c |   4 +-
 11 files changed, 225 insertions(+), 304 deletions(-)
 delete mode 100644 libavutil/color_utils.c
 delete mode 100644 libavutil/color_utils.h

diff --git a/doc/APIchanges b/doc/APIchanges
index b1181ec60a3..385385bda8d 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -14,6 +14,10 @@ libavutil: 2021-04-27
 
 API changes, most recent first:
 
+2023-02-xx - xx - lavu 58.0.100 - csp.h
+  Add av_csp_approximate_trc_gamma() and av_csp_trc_func_from_id().
+  Add av_csp_trc_function.
+
 2023-02-xx - xx - lavc 60.0.100 - avcodec.h
   avcodec_decode_subtitle2() now accepts const AVPacket*.
 
diff --git a/libavcodec/exr.c b/libavcodec/exr.c
index 6a0af96ce4f..2f1766c17bf 100644
--- a/libavcodec/exr.c
+++ b/libavcodec/exr.c
@@ -36,11 +36,11 @@
 
 #include "libavutil/avassert.h"
 #include "libavutil/common.h"
+#include "libavutil/csp.h"
 #include "libavutil/imgutils.h"
 #include "libavutil/intfloat.h"
 #include "libavutil/avstring.h"
 #include "libavutil/opt.h"
-#include "libavutil/color_utils.h"
 #include "libavutil/half2float.h"
 
 #include "avcodec.h"
@@ -1189,7 +1189,7 @@ static int decode_block(AVCodecContext *avctx, void 
*tdata,
 int i, x, buf_size = s->buf_size;
 int c, rgb_channel_count;
 float one_gamma = 1.0f / s->gamma;
-avpriv_trc_function trc_func = 
avpriv_get_trc_function_from_trc(s->apply_trc_type);
+av_csp_trc_function trc_func = av_csp_trc_func_from_id(s->apply_trc_type);
 int ret;
 
 line_offset = AV_RL64(s->gb.buffer + jobnr * 8);
@@ -2215,7 +2215,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
 uint32_t i;
 union av_intfloat32 t;
 float one_gamma = 1.0f / s->gamma;
-avpriv_trc_function trc_func = NULL;
+av_csp_trc_function trc_func = NULL;
 
 ff_init_half2float_tables(>h2f_tables);
 
@@ -2227,7 +2227,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
 ff_bswapdsp_init(>bbdsp);
 #endif
 
-trc_func = avpriv_get_trc_function_from_trc(s->apply_trc_type);
+trc_func = av_csp_trc_func_from_id(s->apply_trc_type);
 if (trc_func) {
 for (i = 0; i < 65536; ++i) {
 t.i = half2float(i, >h2f_tables);
diff --git a/libavcodec/fflcms2.c b/libavcodec/fflcms2.c
index fd370fb310f..5443f178bc9 100644
--- a/libavcodec/fflcms2.c
+++ b/libavcodec/fflcms2.c
@@ -17,7 +17,6 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include "libavutil/color_utils.h"
 #include "libavutil/csp.h"
 
 #include "fflcms2.h"
diff --git a/libavcodec/pngenc.c b/libavcodec/pngenc.c
index 2393161c3b9..ac27eebf3a7 100644
--- a/libavcodec/pngenc.c
+++ b/libavcodec/pngenc.c
@@ -29,7 +29,6 @@
 #include "zlib_wrapper.h"
 
 #include "libavutil/avassert.h"
-#include "libavutil/color_utils.h"
 #include "libavutil/crc.h"
 #include "libavutil/csp.h"
 #include "libavutil/libm.h"
@@ -317,7 +316,7 @@ static int png_get_chrm(enum AVColorPrimaries prim,  
uint8_t *buf)
 
 static int png_get_gama(enum AVColorTransferCharacteristic trc, uint8_t *buf)
 {
-double gamma = avpriv_get_gamma_from_trc(trc);
+double gamma = av_csp_approximate_trc_gamma(trc);
 if (gamma <= 1e-6)
 return 0;
 
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 87ee7a921f0..aca8b9d5853 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -47,6 +47,7 @@
 #include "internal.h"
 #include "libavutil/avstring.h"
 #include "libavutil/channel_layout.h"
+#include "libavutil/csp.h"
 #include "libavutil/intfloat.h"
 #include 

[FFmpeg-devel] [PATCH v2 32/33] avformat/version: postpone the remaining API deprecations

2023-02-04 Thread Anton Khirnov
From: James Almer 

They are either too recent, or still need work like FF_API_COMPUTE_PKT_FIELDS2.

Signed-off-by: James Almer 
---
 libavformat/version_major.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavformat/version_major.h b/libavformat/version_major.h
index 1db8e7600eb..b11f8113838 100644
--- a/libavformat/version_major.h
+++ b/libavformat/version_major.h
@@ -41,9 +41,9 @@
  * at once through the bump. This improves the git bisect-ability of the 
change.
  *
  */
-#define FF_API_COMPUTE_PKT_FIELDS2  (LIBAVFORMAT_VERSION_MAJOR < 60)
-#define FF_API_GET_END_PTS  (LIBAVFORMAT_VERSION_MAJOR < 60)
-#define FF_API_AVIODIRCONTEXT   (LIBAVFORMAT_VERSION_MAJOR < 60)
+#define FF_API_COMPUTE_PKT_FIELDS2  (LIBAVFORMAT_VERSION_MAJOR < 61)
+#define FF_API_GET_END_PTS  (LIBAVFORMAT_VERSION_MAJOR < 61)
+#define FF_API_AVIODIRCONTEXT   (LIBAVFORMAT_VERSION_MAJOR < 61)
 
 
 #define FF_API_R_FRAME_RATE1
-- 
2.35.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v2 06/33] avcodec/avcodec: Remove AV_CODEC_FLAG2_DROP_FRAME_TIMECODE

2023-02-04 Thread Anton Khirnov
From: Andreas Rheinhardt 

It has been deprecated in 94d68a41fabb55dd8c7e59b88fe4a28a637d1e5f
and can't be set via AVOptions. The only codecs that use it
(the MPEG-1/2 encoders) have private options for this.
So remove it.

Signed-off-by: Andreas Rheinhardt 
Signed-off-by: Anton Khirnov 
---
 libavcodec/avcodec.h   | 5 -
 libavcodec/mpeg12enc.c | 1 -
 2 files changed, 6 deletions(-)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index b9bd69a2ec7..d8f22f58007 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -343,11 +343,6 @@ typedef struct RcOverride{
  */
 #define AV_CODEC_FLAG2_LOCAL_HEADER   (1 <<  3)
 
-/**
- * timecode is in drop frame format. DEPRECATED
- */
-#define AV_CODEC_FLAG2_DROP_FRAME_TIMECODE (1 << 13)
-
 /**
  * Input bitstream might be truncated at a packet boundaries
  * instead of only at frame boundaries.
diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
index b5951e43070..26cf33a3c68 100644
--- a/libavcodec/mpeg12enc.c
+++ b/libavcodec/mpeg12enc.c
@@ -249,7 +249,6 @@ static av_cold int encode_init(AVCodecContext *avctx)
 }
 }
 
-mpeg12->drop_frame_timecode = mpeg12->drop_frame_timecode || 
!!(avctx->flags2 & AV_CODEC_FLAG2_DROP_FRAME_TIMECODE);
 if (mpeg12->drop_frame_timecode)
 mpeg12->tc.flags |= AV_TIMECODE_FLAG_DROPFRAME;
 if (mpeg12->drop_frame_timecode && mpeg12->frame_rate_index != 4) {
-- 
2.35.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v2 22/33] avfilter: remove FF_API_BUFFERSINK_ALLOC

2023-02-04 Thread Anton Khirnov
From: James Almer 

Signed-off-by: James Almer 
---
 libavfilter/buffersink.c| 22 --
 libavfilter/buffersink.h| 36 
 libavfilter/version_major.h |  1 -
 3 files changed, 59 deletions(-)

diff --git a/libavfilter/buffersink.c b/libavfilter/buffersink.c
index e269cf72d1b..306c283f775 100644
--- a/libavfilter/buffersink.c
+++ b/libavfilter/buffersink.c
@@ -154,28 +154,6 @@ int attribute_align_arg 
av_buffersink_get_samples(AVFilterContext *ctx,
 return get_frame_internal(ctx, frame, 0, nb_samples);
 }
 
-#if FF_API_BUFFERSINK_ALLOC
-AVBufferSinkParams *av_buffersink_params_alloc(void)
-{
-static const int pixel_fmts[] = { AV_PIX_FMT_NONE };
-AVBufferSinkParams *params = av_malloc(sizeof(AVBufferSinkParams));
-if (!params)
-return NULL;
-
-params->pixel_fmts = pixel_fmts;
-return params;
-}
-
-AVABufferSinkParams *av_abuffersink_params_alloc(void)
-{
-AVABufferSinkParams *params = av_mallocz(sizeof(AVABufferSinkParams));
-
-if (!params)
-return NULL;
-return params;
-}
-#endif
-
 static av_cold int common_init(AVFilterContext *ctx)
 {
 BufferSinkContext *buf = ctx->priv;
diff --git a/libavfilter/buffersink.h b/libavfilter/buffersink.h
index 01e7c747d8e..64e08de53ee 100644
--- a/libavfilter/buffersink.h
+++ b/libavfilter/buffersink.h
@@ -94,42 +94,6 @@ int av_buffersink_get_frame_flags(AVFilterContext *ctx, 
AVFrame *frame, int flag
  */
 #define AV_BUFFERSINK_FLAG_NO_REQUEST 2
 
-#if FF_API_BUFFERSINK_ALLOC
-/**
- * Deprecated and unused struct to use for initializing a buffersink context.
- */
-typedef struct AVBufferSinkParams {
-const enum AVPixelFormat *pixel_fmts; ///< list of allowed pixel formats, 
terminated by AV_PIX_FMT_NONE
-} AVBufferSinkParams;
-
-/**
- * Create an AVBufferSinkParams structure.
- *
- * Must be freed with av_free().
- */
-attribute_deprecated
-AVBufferSinkParams *av_buffersink_params_alloc(void);
-
-/**
- * Deprecated and unused struct to use for initializing an abuffersink context.
- */
-typedef struct AVABufferSinkParams {
-const enum AVSampleFormat *sample_fmts; ///< list of allowed sample 
formats, terminated by AV_SAMPLE_FMT_NONE
-const int64_t *channel_layouts; ///< list of allowed channel 
layouts, terminated by -1
-const int *channel_counts;  ///< list of allowed channel 
counts, terminated by -1
-int all_channel_counts; ///< if not 0, accept any channel 
count or layout
-int *sample_rates;  ///< list of allowed sample rates, 
terminated by -1
-} AVABufferSinkParams;
-
-/**
- * Create an AVABufferSinkParams structure.
- *
- * Must be freed with av_free().
- */
-attribute_deprecated
-AVABufferSinkParams *av_abuffersink_params_alloc(void);
-#endif
-
 /**
  * Set the frame size for an audio buffer sink.
  *
diff --git a/libavfilter/version_major.h b/libavfilter/version_major.h
index 655e3d119d2..5a8bf4eda21 100644
--- a/libavfilter/version_major.h
+++ b/libavfilter/version_major.h
@@ -35,7 +35,6 @@
  * the public API and may change, break or disappear at any time.
  */
 
-#define FF_API_BUFFERSINK_ALLOC (LIBAVFILTER_VERSION_MAJOR < 9)
 #define FF_API_PAD_COUNT(LIBAVFILTER_VERSION_MAJOR < 9)
 
 #endif /* AVFILTER_VERSION_MAJOR_H */
-- 
2.35.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v2 19/33] avformat: remove FF_HLS_TS_OPTIONS

2023-02-04 Thread Anton Khirnov
From: James Almer 

Signed-off-by: James Almer 
---
 libavformat/hlsenc.c| 3 ---
 libavformat/version_major.h | 1 -
 2 files changed, 4 deletions(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index adf06ec7643..dcc363b42e3 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -3116,9 +3116,6 @@ static const AVOption options[] = {
 {"hls_init_time", "set segment length at init list", 
OFFSET(init_time), AV_OPT_TYPE_DURATION, {.i64 = 0},   0, INT64_MAX, E},
 {"hls_list_size", "set maximum number of playlist entries",  
OFFSET(max_nb_segments),AV_OPT_TYPE_INT,{.i64 = 5}, 0, INT_MAX, E},
 {"hls_delete_threshold", "set number of unreferenced segments to keep 
before deleting",  OFFSET(hls_delete_threshold),AV_OPT_TYPE_INT,{.i64 = 
1}, 1, INT_MAX, E},
-#if FF_HLS_TS_OPTIONS
-{"hls_ts_options","set hls mpegts list of options for the container format 
used for hls (deprecated, use hls_segment_options instead of it.)", 
OFFSET(format_options), AV_OPT_TYPE_DICT, {.str = NULL},  0, 0,E | 
AV_OPT_FLAG_DEPRECATED},
-#endif
 {"hls_vtt_options","set hls vtt list of options for the container format 
used for hls", OFFSET(vtt_format_options_str), AV_OPT_TYPE_STRING, {.str = 
NULL},  0, 0,E},
 {"hls_allow_cache", "explicitly set whether the client MAY (1) or MUST NOT 
(0) cache media segments", OFFSET(allowcache), AV_OPT_TYPE_INT, {.i64 = -1}, 
INT_MIN, INT_MAX, E},
 {"hls_base_url",  "url to prepend to each playlist entry",   
OFFSET(baseurl), AV_OPT_TYPE_STRING, {.str = NULL},  0, 0,   E},
diff --git a/libavformat/version_major.h b/libavformat/version_major.h
index 044af1ebf6f..057d1ac0fb0 100644
--- a/libavformat/version_major.h
+++ b/libavformat/version_major.h
@@ -42,7 +42,6 @@
  *
  */
 #define FF_API_COMPUTE_PKT_FIELDS2  (LIBAVFORMAT_VERSION_MAJOR < 60)
-#define FF_HLS_TS_OPTIONS   (LIBAVFORMAT_VERSION_MAJOR < 60)
 #define FF_API_AVSTREAM_CLASS   (LIBAVFORMAT_VERSION_MAJOR > 59)
 #define FF_API_GET_END_PTS  (LIBAVFORMAT_VERSION_MAJOR < 60)
 #define FF_API_AVIODIRCONTEXT   (LIBAVFORMAT_VERSION_MAJOR < 60)
-- 
2.35.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v2 26/33] avutil: remove FF_API_DECLARE_ALIGNED

2023-02-04 Thread Anton Khirnov
From: James Almer 

Signed-off-by: James Almer 
---
 libavcodec/qdmc.c|  1 +
 libavutil/mem.h  | 80 
 libavutil/mem_internal.h |  2 -
 libavutil/version.h  |  1 -
 4 files changed, 1 insertion(+), 83 deletions(-)

diff --git a/libavcodec/qdmc.c b/libavcodec/qdmc.c
index 4b582dc3491..081c4dd46f0 100644
--- a/libavcodec/qdmc.c
+++ b/libavcodec/qdmc.c
@@ -25,6 +25,7 @@
 #define BITSTREAM_READER_LE
 
 #include "libavutil/channel_layout.h"
+#include "libavutil/mem_internal.h"
 #include "libavutil/thread.h"
 #include "libavutil/tx.h"
 
diff --git a/libavutil/mem.h b/libavutil/mem.h
index c9c4fcf1ff0..b093b3b5cb0 100644
--- a/libavutil/mem.h
+++ b/libavutil/mem.h
@@ -51,86 +51,6 @@
  * @{
  */
 
-#if FF_API_DECLARE_ALIGNED
-/**
- *
- * @defgroup lavu_mem_macros Alignment Macros
- * Helper macros for declaring aligned variables.
- * @{
- */
-
-/**
- * @def DECLARE_ALIGNED(n,t,v)
- * Declare a variable that is aligned in memory.
- *
- * @code{.c}
- * DECLARE_ALIGNED(16, uint16_t, aligned_int) = 42;
- * DECLARE_ALIGNED(32, uint8_t, aligned_array)[128];
- *
- * // The default-alignment equivalent would be
- * uint16_t aligned_int = 42;
- * uint8_t aligned_array[128];
- * @endcode
- *
- * @param n Minimum alignment in bytes
- * @param t Type of the variable (or array element)
- * @param v Name of the variable
- */
-
-/**
- * @def DECLARE_ASM_ALIGNED(n,t,v)
- * Declare an aligned variable appropriate for use in inline assembly code.
- *
- * @code{.c}
- * DECLARE_ASM_ALIGNED(16, uint64_t, pw_08) = UINT64_C(0x0008000800080008);
- * @endcode
- *
- * @param n Minimum alignment in bytes
- * @param t Type of the variable (or array element)
- * @param v Name of the variable
- */
-
-/**
- * @def DECLARE_ASM_CONST(n,t,v)
- * Declare a static constant aligned variable appropriate for use in inline
- * assembly code.
- *
- * @code{.c}
- * DECLARE_ASM_CONST(16, uint64_t, pw_08) = UINT64_C(0x0008000800080008);
- * @endcode
- *
- * @param n Minimum alignment in bytes
- * @param t Type of the variable (or array element)
- * @param v Name of the variable
- */
-
-#if defined(__INTEL_COMPILER) && __INTEL_COMPILER < 1110 || defined(__SUNPRO_C)
-#define DECLARE_ALIGNED(n,t,v)  t __attribute__ ((aligned (n))) v
-#define DECLARE_ASM_ALIGNED(n,t,v)  t __attribute__ ((aligned (n))) v
-#define DECLARE_ASM_CONST(n,t,v)const t __attribute__ ((aligned (n))) v
-#elif defined(__DJGPP__)
-#define DECLARE_ALIGNED(n,t,v)  t __attribute__ ((aligned (FFMIN(n, 
16 v
-#define DECLARE_ASM_ALIGNED(n,t,v)  t av_used __attribute__ ((aligned 
(FFMIN(n, 16 v
-#define DECLARE_ASM_CONST(n,t,v)static const t av_used __attribute__ 
((aligned (FFMIN(n, 16 v
-#elif defined(__GNUC__) || defined(__clang__)
-#define DECLARE_ALIGNED(n,t,v)  t __attribute__ ((aligned (n))) v
-#define DECLARE_ASM_ALIGNED(n,t,v)  t av_used __attribute__ ((aligned 
(n))) v
-#define DECLARE_ASM_CONST(n,t,v)static const t av_used __attribute__ 
((aligned (n))) v
-#elif defined(_MSC_VER)
-#define DECLARE_ALIGNED(n,t,v)  __declspec(align(n)) t v
-#define DECLARE_ASM_ALIGNED(n,t,v)  __declspec(align(n)) t v
-#define DECLARE_ASM_CONST(n,t,v)__declspec(align(n)) static const t v
-#else
-#define DECLARE_ALIGNED(n,t,v)  t v
-#define DECLARE_ASM_ALIGNED(n,t,v)  t v
-#define DECLARE_ASM_CONST(n,t,v)static const t v
-#endif
-
-/**
- * @}
- */
-#endif
-
 /**
  * @defgroup lavu_mem_attrs Function Attributes
  * Function attributes applicable to memory handling functions.
diff --git a/libavutil/mem_internal.h b/libavutil/mem_internal.h
index 955e31a6981..2448c606f19 100644
--- a/libavutil/mem_internal.h
+++ b/libavutil/mem_internal.h
@@ -30,7 +30,6 @@
 #include "mem.h"
 #include "version.h"
 
-#if !FF_API_DECLARE_ALIGNED
 /**
  * @def DECLARE_ALIGNED(n,t,v)
  * Declare a variable that is aligned in memory.
@@ -97,7 +96,6 @@
 #define DECLARE_ASM_ALIGNED(n,t,v)  t v
 #define DECLARE_ASM_CONST(n,t,v)static const t v
 #endif
-#endif
 
 // Some broken preprocessors need a second expansion
 // to be forced to tokenize __VA_ARGS__
diff --git a/libavutil/version.h b/libavutil/version.h
index 38769962cc3..6014743947c 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -105,7 +105,6 @@
  * @{
  */
 
-#define FF_API_DECLARE_ALIGNED  (LIBAVUTIL_VERSION_MAJOR < 58)
 #define FF_API_COLORSPACE_NAME  (LIBAVUTIL_VERSION_MAJOR < 58)
 #define FF_API_AV_MALLOCZ_ARRAY (LIBAVUTIL_VERSION_MAJOR < 58)
 #define FF_API_FIFO_PEEK2   (LIBAVUTIL_VERSION_MAJOR < 58)
-- 
2.35.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v2 28/33] avutil: remove FF_API_AV_MALLOCZ_ARRAY

2023-02-04 Thread Anton Khirnov
From: James Almer 

Signed-off-by: James Almer 
---
 libavutil/mem.c | 10 --
 libavutil/mem.h |  8 
 libavutil/version.h |  1 -
 3 files changed, 19 deletions(-)

diff --git a/libavutil/mem.c b/libavutil/mem.c
index 18aff5291f0..36b8940a0cf 100644
--- a/libavutil/mem.c
+++ b/libavutil/mem.c
@@ -212,16 +212,6 @@ void *av_malloc_array(size_t nmemb, size_t size)
 return av_malloc(result);
 }
 
-#if FF_API_AV_MALLOCZ_ARRAY
-void *av_mallocz_array(size_t nmemb, size_t size)
-{
-size_t result;
-if (size_mult(nmemb, size, ) < 0)
-return NULL;
-return av_mallocz(result);
-}
-#endif
-
 void *av_realloc_array(void *ptr, size_t nmemb, size_t size)
 {
 size_t result;
diff --git a/libavutil/mem.h b/libavutil/mem.h
index b093b3b5cb0..62b4ca6e50e 100644
--- a/libavutil/mem.h
+++ b/libavutil/mem.h
@@ -159,14 +159,6 @@ av_alloc_size(1, 2) void *av_malloc_array(size_t nmemb, 
size_t size);
  */
 void *av_calloc(size_t nmemb, size_t size) av_malloc_attrib av_alloc_size(1, 
2);
 
-#if FF_API_AV_MALLOCZ_ARRAY
-/**
- * @deprecated use av_calloc()
- */
-attribute_deprecated
-void *av_mallocz_array(size_t nmemb, size_t size) av_malloc_attrib 
av_alloc_size(1, 2);
-#endif
-
 /**
  * Allocate, reallocate, or free a block of memory.
  *
diff --git a/libavutil/version.h b/libavutil/version.h
index 700af5d8749..3bad472227a 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -105,7 +105,6 @@
  * @{
  */
 
-#define FF_API_AV_MALLOCZ_ARRAY (LIBAVUTIL_VERSION_MAJOR < 58)
 #define FF_API_FIFO_PEEK2   (LIBAVUTIL_VERSION_MAJOR < 58)
 #define FF_API_FIFO_OLD_API (LIBAVUTIL_VERSION_MAJOR < 58)
 #define FF_API_XVMC (LIBAVUTIL_VERSION_MAJOR < 58)
-- 
2.35.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v2 20/33] avformat: remove FF_API_AVSTREAM_CLASS

2023-02-04 Thread Anton Khirnov
From: James Almer 

Signed-off-by: James Almer 
---
 fftools/ffmpeg_mux_init.c   | 11 ---
 libavformat/avformat.h  |  2 --
 libavformat/options.c   |  3 ---
 libavformat/version_major.h |  1 -
 4 files changed, 17 deletions(-)

diff --git a/fftools/ffmpeg_mux_init.c b/fftools/ffmpeg_mux_init.c
index f8ccf4a3e9b..34172406394 100644
--- a/fftools/ffmpeg_mux_init.c
+++ b/fftools/ffmpeg_mux_init.c
@@ -1983,18 +1983,7 @@ static int set_dispositions(Muxer *mux, const 
OptionsContext *o)
 if (!disp)
 continue;
 
-#if LIBAVFORMAT_VERSION_MAJOR >= 60
 ret = av_opt_set(ost->st, "disposition", disp, 0);
-#else
-{
-const AVClass *class = av_stream_get_class();
-const AVOption*o = av_opt_find(, "disposition", 
NULL, 0, AV_OPT_SEARCH_FAKE_OBJ);
-
-av_assert0(o);
-ret = av_opt_eval_flags(, o, disp, 
>st->disposition);
-}
-#endif
-
 if (ret < 0)
 goto finish;
 }
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index ac40e197f62..b986aacc785 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -838,12 +838,10 @@ const char *av_disposition_to_string(int disposition);
  * sizeof(AVStream) must not be used outside libav*.
  */
 typedef struct AVStream {
-#if FF_API_AVSTREAM_CLASS
 /**
  * A class for @ref avoptions. Set on stream creation.
  */
 const AVClass *av_class;
-#endif
 
 int index;/**< stream index in AVFormatContext */
 /**
diff --git a/libavformat/options.c b/libavformat/options.c
index 0079a06d9a5..c7681122cd7 100644
--- a/libavformat/options.c
+++ b/libavformat/options.c
@@ -257,10 +257,7 @@ AVStream *avformat_new_stream(AVFormatContext *s, const 
AVCodec *c)
 return NULL;
 st = >pub;
 
-#if FF_API_AVSTREAM_CLASS
 st->av_class = _class;
-#endif
-
 st->codecpar = avcodec_parameters_alloc();
 if (!st->codecpar)
 goto fail;
diff --git a/libavformat/version_major.h b/libavformat/version_major.h
index 057d1ac0fb0..1db8e7600eb 100644
--- a/libavformat/version_major.h
+++ b/libavformat/version_major.h
@@ -42,7 +42,6 @@
  *
  */
 #define FF_API_COMPUTE_PKT_FIELDS2  (LIBAVFORMAT_VERSION_MAJOR < 60)
-#define FF_API_AVSTREAM_CLASS   (LIBAVFORMAT_VERSION_MAJOR > 59)
 #define FF_API_GET_END_PTS  (LIBAVFORMAT_VERSION_MAJOR < 60)
 #define FF_API_AVIODIRCONTEXT   (LIBAVFORMAT_VERSION_MAJOR < 60)
 
-- 
2.35.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v2 24/33] avdevice: remove FF_API_DEVICE_CAPABILITIES

2023-02-04 Thread Anton Khirnov
From: James Almer 

Signed-off-by: James Almer 
---
 libavdevice/avdevice.c  |  19 --
 libavdevice/avdevice.h  | 130 
 libavdevice/version_major.h |   1 -
 3 files changed, 150 deletions(-)

diff --git a/libavdevice/avdevice.c b/libavdevice/avdevice.c
index b47f89c4bf2..38110ddfdb2 100644
--- a/libavdevice/avdevice.c
+++ b/libavdevice/avdevice.c
@@ -21,12 +21,6 @@
 #include "internal.h"
 #include "libavformat/mux.h"
 
-#if FF_API_DEVICE_CAPABILITIES
-const AVOption av_device_capabilities[] = {
-{ NULL }
-};
-#endif
-
 int avdevice_app_to_dev_control_message(struct AVFormatContext *s, enum 
AVAppToDevMessageType type,
 void *data, size_t data_size)
 {
@@ -43,19 +37,6 @@ int avdevice_dev_to_app_control_message(struct 
AVFormatContext *s, enum AVDevToA
 return s->control_message_cb(s, type, data, data_size);
 }
 
-#if FF_API_DEVICE_CAPABILITIES
-int avdevice_capabilities_create(AVDeviceCapabilitiesQuery **caps, 
AVFormatContext *s,
- AVDictionary **device_options)
-{
-return AVERROR(ENOSYS);
-}
-
-void avdevice_capabilities_free(AVDeviceCapabilitiesQuery **caps, 
AVFormatContext *s)
-{
-return;
-}
-#endif
-
 int avdevice_list_devices(AVFormatContext *s, AVDeviceInfoList **device_list)
 {
 int ret;
diff --git a/libavdevice/avdevice.h b/libavdevice/avdevice.h
index 185593053f7..887fd5e3c80 100644
--- a/libavdevice/avdevice.h
+++ b/libavdevice/avdevice.h
@@ -327,136 +327,6 @@ int avdevice_dev_to_app_control_message(struct 
AVFormatContext *s,
 enum AVDevToAppMessageType type,
 void *data, size_t data_size);
 
-#if FF_API_DEVICE_CAPABILITIES
-/**
- * Following API allows user to probe device capabilities (supported codecs,
- * pixel formats, sample formats, resolutions, channel counts, etc).
- * It is build on top op AVOption API.
- * Queried capabilities make it possible to set up converters of video or audio
- * parameters that fit to the device.
- *
- * List of capabilities that can be queried:
- *  - Capabilities valid for both audio and video devices:
- *- codec:  supported audio/video codecs.
- *  type: AV_OPT_TYPE_INT (AVCodecID value)
- *  - Capabilities valid for audio devices:
- *- sample_format:  supported sample formats.
- *  type: AV_OPT_TYPE_INT (AVSampleFormat value)
- *- sample_rate:supported sample rates.
- *  type: AV_OPT_TYPE_INT
- *- channels:   supported number of channels.
- *  type: AV_OPT_TYPE_INT
- *- channel_layout: supported channel layouts.
- *  type: AV_OPT_TYPE_INT64
- *  - Capabilities valid for video devices:
- *- pixel_format:   supported pixel formats.
- *  type: AV_OPT_TYPE_INT (AVPixelFormat value)
- *- window_size:supported window sizes (describes size of the window 
size presented to the user).
- *  type: AV_OPT_TYPE_IMAGE_SIZE
- *- frame_size: supported frame sizes (describes size of provided 
video frames).
- *  type: AV_OPT_TYPE_IMAGE_SIZE
- *- fps:supported fps values
- *  type: AV_OPT_TYPE_RATIONAL
- *
- * Value of the capability may be set by user using av_opt_set() function
- * and AVDeviceCapabilitiesQuery object. Following queries will
- * limit results to the values matching already set capabilities.
- * For example, setting a codec may impact number of formats or fps values
- * returned during next query. Setting invalid value may limit results to zero.
- *
- * Example of the usage basing on opengl output device:
- *
- * @code
- *  AVFormatContext *oc = NULL;
- *  AVDeviceCapabilitiesQuery *caps = NULL;
- *  AVOptionRanges *ranges;
- *  int ret;
- *
- *  if ((ret = avformat_alloc_output_context2(, NULL, "opengl", NULL)) < 0)
- *  goto fail;
- *  if (avdevice_capabilities_create(, oc, NULL) < 0)
- *  goto fail;
- *
- *  //query codecs
- *  if (av_opt_query_ranges(, caps, "codec", 
AV_OPT_MULTI_COMPONENT_RANGE)) < 0)
- *  goto fail;
- *  //pick codec here and set it
- *  av_opt_set(caps, "codec", AV_CODEC_ID_RAWVIDEO, 0);
- *
- *  //query format
- *  if (av_opt_query_ranges(, caps, "pixel_format", 
AV_OPT_MULTI_COMPONENT_RANGE)) < 0)
- *  goto fail;
- *  //pick format here and set it
- *  av_opt_set(caps, "pixel_format", AV_PIX_FMT_YUV420P, 0);
- *
- *  //query and set more capabilities
- *
- * fail:
- *  //clean up code
- *  avdevice_capabilities_free(, oc);
- *  avformat_free_context(oc);
- * @endcode
- */
-
-/**
- * Structure describes device capabilities.
- *
- * It is used by devices in conjunction with av_device_capabilities AVOption 
table
- * to implement capabilities probing API based on AVOption API. Should not be 
used directly.
- */
-typedef struct AVDeviceCapabilitiesQuery {

[FFmpeg-devel] [PATCH v2 15/33] avcodec: remove FF_API_FLAG_TRUNCATED

2023-02-04 Thread Anton Khirnov
From: James Almer 

Signed-off-by: James Almer 
---
 libavcodec/avcodec.h   |  9 -
 libavcodec/codec.h |  6 
 libavcodec/decode.c|  4 ---
 libavcodec/h263_parser.c   | 11 --
 libavcodec/h263_parser.h   | 29 ---
 libavcodec/h263dec.c   | 42 --
 libavcodec/mpeg12.c| 66 --
 libavcodec/mpeg12.h|  9 -
 libavcodec/mpeg12dec.c | 31 
 libavcodec/mpeg4video_parser.c | 12 ---
 libavcodec/mpeg4video_parser.h | 34 --
 libavcodec/mpeg4videodec.c |  3 --
 libavcodec/mpegvideo.c |  9 -
 libavcodec/mpegvideo.h |  7 
 libavcodec/mpegvideo_dec.c |  8 -
 libavcodec/mpegvideo_parser.c  |  7 +---
 libavcodec/options_table.h |  3 --
 libavcodec/pthread.c   |  3 --
 libavcodec/version_major.h |  1 -
 19 files changed, 1 insertion(+), 293 deletions(-)
 delete mode 100644 libavcodec/h263_parser.h
 delete mode 100644 libavcodec/mpeg4video_parser.h

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index f82608561ac..9066f6c5297 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -294,15 +294,6 @@ typedef struct RcOverride{
  * error[?] variables will be set during encoding.
  */
 #define AV_CODEC_FLAG_PSNR(1 << 15)
-#if FF_API_FLAG_TRUNCATED
-/**
- * Input bitstream might be truncated at a random location
- * instead of only at frame boundaries.
- *
- * @deprecated use codec parsers for packetizing input
- */
-#define AV_CODEC_FLAG_TRUNCATED   (1 << 16)
-#endif
 /**
  * Use interlaced DCT.
  */
diff --git a/libavcodec/codec.h b/libavcodec/codec.h
index 8bf85b2f9c8..035bcd080b5 100644
--- a/libavcodec/codec.h
+++ b/libavcodec/codec.h
@@ -50,12 +50,6 @@
  * avcodec_default_get_buffer2 or avcodec_default_get_encode_buffer.
  */
 #define AV_CODEC_CAP_DR1 (1 <<  1)
-#if FF_API_FLAG_TRUNCATED
-/**
- * @deprecated Use parsers to always send proper frames.
- */
-#define AV_CODEC_CAP_TRUNCATED   (1 <<  3)
-#endif
 /**
  * Encoder or decoder requires flushing with NULL input at the end in order to
  * give the complete and correct output.
diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index bc6966d454a..c37d607e27f 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -427,11 +427,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
 if (!got_frame)
 av_frame_unref(frame);
 
-#if FF_API_FLAG_TRUNCATED
-if (ret >= 0 && avctx->codec->type == AVMEDIA_TYPE_VIDEO && !(avctx->flags 
& AV_CODEC_FLAG_TRUNCATED))
-#else
 if (ret >= 0 && avctx->codec->type == AVMEDIA_TYPE_VIDEO)
-#endif
 ret = pkt->size;
 
 /* do not stop draining when actual_got_frame != 0 or ret < 0 */
diff --git a/libavcodec/h263_parser.c b/libavcodec/h263_parser.c
index 7a742caa80b..f70a7911777 100644
--- a/libavcodec/h263_parser.c
+++ b/libavcodec/h263_parser.c
@@ -25,16 +25,9 @@
  */
 
 #include "parser.h"
-#if FF_API_FLAG_TRUNCATED
-/* Nuke this header when removing FF_API_FLAG_TRUNCATED */
-#include "h263_parser.h"
-
-int ff_h263_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size){
-#else
 
 static int h263_find_frame_end(ParseContext *pc, const uint8_t *buf, int 
buf_size)
 {
-#endif
 int vop_found, i;
 uint32_t state;
 
@@ -80,11 +73,7 @@ static int h263_parse(AVCodecParserContext *s,
 if (s->flags & PARSER_FLAG_COMPLETE_FRAMES) {
 next = buf_size;
 } else {
-#if FF_API_FLAG_TRUNCATED
-next= ff_h263_find_frame_end(pc, buf, buf_size);
-#else
 next = h263_find_frame_end(pc, buf, buf_size);
-#endif
 
 if (ff_combine_frame(pc, next, , _size) < 0) {
 *poutbuf = NULL;
diff --git a/libavcodec/h263_parser.h b/libavcodec/h263_parser.h
deleted file mode 100644
index 565a222bc1e..000
--- a/libavcodec/h263_parser.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * H.263 parser
- * Copyright (c) 2002-2004 Michael Niedermayer 
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_H263_PARSER_H
-#define AVCODEC_H263_PARSER_H
-
-#include "parser.h"
-
-int ff_h263_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size);
-
-#endif /* 

[FFmpeg-devel] [PATCH v2 18/33] avformat: remove FF_API_AVIOCONTEXT_WRITTEN

2023-02-04 Thread Anton Khirnov
From: James Almer 

Signed-off-by: James Almer 
---
 libavformat/avio.h  | 10 --
 libavformat/aviobuf.c   | 10 --
 libavformat/version_major.h |  1 -
 3 files changed, 21 deletions(-)

diff --git a/libavformat/avio.h b/libavformat/avio.h
index 4bf6b1fbdaa..5f13e0622d3 100644
--- a/libavformat/avio.h
+++ b/libavformat/avio.h
@@ -295,16 +295,6 @@ typedef struct AVIOContext {
  */
 int ignore_boundary_point;
 
-#if FF_API_AVIOCONTEXT_WRITTEN
-/**
- * @deprecated field utilized privately by libavformat. For a public
- * statistic of how many bytes were written out, see
- * AVIOContext::bytes_written.
- */
-attribute_deprecated
-int64_t written;
-#endif
-
 /**
  * Maximum reached position before a backward seek in the write buffer,
  * used keeping track of already written data for a later flush.
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index 257535a9642..4ad734a3c3e 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -125,11 +125,6 @@ void ffio_init_context(FFIOContext *ctx,
 ctx->current_type= AVIO_DATA_MARKER_UNKNOWN;
 ctx->last_time   = AV_NOPTS_VALUE;
 ctx->short_seek_get  = NULL;
-#if FF_API_AVIOCONTEXT_WRITTEN
-FF_DISABLE_DEPRECATION_WARNINGS
-s->written   = 0;
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
 }
 
 AVIOContext *avio_alloc_context(
@@ -174,11 +169,6 @@ static void writeout(AVIOContext *s, const uint8_t *data, 
int len)
 
 if (s->pos + len > ctx->written_output_size) {
 ctx->written_output_size = s->pos + len;
-#if FF_API_AVIOCONTEXT_WRITTEN
-FF_DISABLE_DEPRECATION_WARNINGS
-s->written = ctx->written_output_size;
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
 }
 }
 }
diff --git a/libavformat/version_major.h b/libavformat/version_major.h
index abc1699685a..044af1ebf6f 100644
--- a/libavformat/version_major.h
+++ b/libavformat/version_major.h
@@ -42,7 +42,6 @@
  *
  */
 #define FF_API_COMPUTE_PKT_FIELDS2  (LIBAVFORMAT_VERSION_MAJOR < 60)
-#define FF_API_AVIOCONTEXT_WRITTEN  (LIBAVFORMAT_VERSION_MAJOR < 60)
 #define FF_HLS_TS_OPTIONS   (LIBAVFORMAT_VERSION_MAJOR < 60)
 #define FF_API_AVSTREAM_CLASS   (LIBAVFORMAT_VERSION_MAJOR > 59)
 #define FF_API_GET_END_PTS  (LIBAVFORMAT_VERSION_MAJOR < 60)
-- 
2.35.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v2 14/33] avcodec: remove FF_API_AVCTX_TIMEBASE

2023-02-04 Thread Anton Khirnov
From: James Almer 

Signed-off-by: James Almer 
---
 libavcodec/av1_parser.c|  3 ---
 libavcodec/avcodec.c   |  5 -
 libavcodec/avcodec.h   |  3 +--
 libavcodec/avs2_parser.c   |  4 ++--
 libavcodec/avs3_parser.c   |  4 ++--
 libavcodec/cpia.c  |  8 ---
 libavcodec/decode.c|  5 -
 libavcodec/h264_parser.c   |  7 +++---
 libavcodec/h264dec.c   |  6 -
 libavcodec/mjpegdec.c  |  2 +-
 libavcodec/mpeg4video_parser.c |  4 ++--
 libavcodec/mpeg4videodec.c |  3 ---
 libavcodec/mpegvideo_parser.c  |  5 -
 libavcodec/vc1_parser.c|  2 --
 libavcodec/version_major.h |  1 -
 libavformat/avformat.c | 33 ---
 libavformat/demux.c| 41 +++---
 17 files changed, 55 insertions(+), 81 deletions(-)

diff --git a/libavcodec/av1_parser.c b/libavcodec/av1_parser.c
index e57e382757e..14dae92fe9f 100644
--- a/libavcodec/av1_parser.c
+++ b/libavcodec/av1_parser.c
@@ -168,9 +168,6 @@ static int av1_parser_parse(AVCodecParserContext *ctx,
   timing->num_units_in_display_tick, timing->time_scale, 
INT_MAX);
 }
 
-if (avctx->framerate.num)
-avctx->time_base = av_inv_q(av_mul_q(avctx->framerate, 
(AVRational){avctx->ticks_per_frame, 1}));
-
 end:
 ff_cbs_fragment_reset(td);
 
diff --git a/libavcodec/avcodec.c b/libavcodec/avcodec.c
index efa76d2740a..00a58518071 100644
--- a/libavcodec/avcodec.c
+++ b/libavcodec/avcodec.c
@@ -349,11 +349,6 @@ FF_ENABLE_DEPRECATION_WARNINGS
 ret = AVERROR(EINVAL);
 goto free_and_end;
 }
-
-#if FF_API_AVCTX_TIMEBASE
-if (avctx->framerate.num > 0 && avctx->framerate.den > 0)
-avctx->time_base = av_inv_q(av_mul_q(avctx->framerate, 
(AVRational){avctx->ticks_per_frame, 1}));
-#endif
 }
 if (codec->priv_class)
 av_assert0(*(const AVClass **)avctx->priv_data == codec->priv_class);
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 8aa08500a46..f82608561ac 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -543,8 +543,7 @@ typedef struct AVCodecContext {
  * (fixed_vop_rate == 0 implies that it is different from the framerate)
  *
  * - encoding: MUST be set by user.
- * - decoding: the use of this field for decoding is deprecated.
- * Use framerate instead.
+ * - decoding: unused.
  */
 AVRational time_base;
 
diff --git a/libavcodec/avs2_parser.c b/libavcodec/avs2_parser.c
index 0350517493a..200134f91db 100644
--- a/libavcodec/avs2_parser.c
+++ b/libavcodec/avs2_parser.c
@@ -112,9 +112,9 @@ static void parse_avs2_seq_header(AVCodecParserContext *s, 
const uint8_t *buf,
 s->height = height;
 s->coded_width = FFALIGN(width, 8);
 s->coded_height = FFALIGN(height, 8);
-avctx->framerate.num = avctx->time_base.den =
+avctx->framerate.num =
 ff_avs2_frame_rate_tab[frame_rate_code].num;
-avctx->framerate.den = avctx->time_base.num =
+avctx->framerate.den =
 ff_avs2_frame_rate_tab[frame_rate_code].den;
 avctx->has_b_frames = FFMAX(avctx->has_b_frames, !low_delay);
 
diff --git a/libavcodec/avs3_parser.c b/libavcodec/avs3_parser.c
index a9fd879e9de..a819b5783d6 100644
--- a/libavcodec/avs3_parser.c
+++ b/libavcodec/avs3_parser.c
@@ -117,8 +117,8 @@ static void parse_avs3_nal_units(AVCodecParserContext *s, 
const uint8_t *buf,
 low_delay = get_bits(, 1);
 avctx->has_b_frames = FFMAX(avctx->has_b_frames, !low_delay);
 
-avctx->framerate.num = avctx->time_base.den = 
ff_avs3_frame_rate_tab[ratecode].num;
-avctx->framerate.den = avctx->time_base.num = 
ff_avs3_frame_rate_tab[ratecode].den;
+avctx->framerate.num = ff_avs3_frame_rate_tab[ratecode].num;
+avctx->framerate.den = ff_avs3_frame_rate_tab[ratecode].den;
 
 s->width  = s->coded_width = avctx->width;
 s->height = s->coded_height = avctx->height;
diff --git a/libavcodec/cpia.c b/libavcodec/cpia.c
index 99362e73f07..bfd270dae2b 100644
--- a/libavcodec/cpia.c
+++ b/libavcodec/cpia.c
@@ -198,14 +198,6 @@ static av_cold int cpia_decode_init(AVCodecContext *avctx)
 // output pixel format
 avctx->pix_fmt = AV_PIX_FMT_YUV420P;
 
-/* The default timebase set by the v4l2 demuxer leads to probing which is 
buggy.
- * Set some reasonable time_base to skip this.
- */
-if (avctx->time_base.num == 1 && avctx->time_base.den == 100) {
-avctx->time_base.num = 1;
-avctx->time_base.den = 60;
-}
-
 s->frame = av_frame_alloc();
 if (!s->frame)
 return AVERROR(ENOMEM);
diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index 8e790102136..bc6966d454a 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -434,11 +434,6 @@ FF_ENABLE_DEPRECATION_WARNINGS
 #endif
 ret = pkt->size;
 
-#if FF_API_AVCTX_TIMEBASE
-if 

[FFmpeg-devel] [PATCH v2 33/33] Bump major versions of all libraries

2023-02-04 Thread Anton Khirnov
From: James Almer 

Signed-off-by: James Almer 
---
 doc/APIchanges  | 14 +-
 libavcodec/version.h|  2 +-
 libavcodec/version_major.h  |  2 +-
 libavdevice/version.h   |  4 ++--
 libavdevice/version_major.h |  2 +-
 libavfilter/version.h   |  2 +-
 libavfilter/version_major.h |  2 +-
 libavformat/version.h   |  2 +-
 libavformat/version_major.h |  2 +-
 libavutil/version.h |  4 ++--
 libpostproc/version.h   |  2 +-
 libpostproc/version_major.h |  2 +-
 libswscale/version.h|  4 ++--
 libswscale/version_major.h  |  2 +-
 14 files changed, 17 insertions(+), 29 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 385385bda8d..9600e0c2d6e 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -1,16 +1,4 @@
-Never assume the API of libav* to be stable unless at least 1 month has passed
-since the last major version increase or the API was added.
-
-The last version increases were:
-libavcodec:2021-04-27
-libavdevice:   2021-04-27
-libavfilter:   2021-04-27
-libavformat:   2021-04-27
-libpostproc:   2021-04-27
-libswresample: 2021-04-27
-libswscale:2021-04-27
-libavutil: 2021-04-27
-
+The last version increases of all lbiraries were on 2023-02-xx
 
 API changes, most recent first:
 
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 2ed4ef5547f..8c3d476003e 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@
 
 #include "version_major.h"
 
-#define LIBAVCODEC_VERSION_MINOR  60
+#define LIBAVCODEC_VERSION_MINOR   0
 #define LIBAVCODEC_VERSION_MICRO 100
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
diff --git a/libavcodec/version_major.h b/libavcodec/version_major.h
index bcea37d7977..dacbbbf3453 100644
--- a/libavcodec/version_major.h
+++ b/libavcodec/version_major.h
@@ -25,7 +25,7 @@
  * Libavcodec version macros.
  */
 
-#define LIBAVCODEC_VERSION_MAJOR  59
+#define LIBAVCODEC_VERSION_MAJOR  60
 
 /**
  * FF_API_* defines may be placed below to indicate public API that will be
diff --git a/libavdevice/version.h b/libavdevice/version.h
index 3e654fff892..25befdead12 100644
--- a/libavdevice/version.h
+++ b/libavdevice/version.h
@@ -29,8 +29,8 @@
 
 #include "version_major.h"
 
-#define LIBAVDEVICE_VERSION_MINOR   8
-#define LIBAVDEVICE_VERSION_MICRO 101
+#define LIBAVDEVICE_VERSION_MINOR   0
+#define LIBAVDEVICE_VERSION_MICRO 100
 
 #define LIBAVDEVICE_VERSION_INT AV_VERSION_INT(LIBAVDEVICE_VERSION_MAJOR, \
LIBAVDEVICE_VERSION_MINOR, \
diff --git a/libavdevice/version_major.h b/libavdevice/version_major.h
index 571257f31d7..b884fd42246 100644
--- a/libavdevice/version_major.h
+++ b/libavdevice/version_major.h
@@ -25,7 +25,7 @@
  * Libavdevice version macros
  */
 
-#define LIBAVDEVICE_VERSION_MAJOR  59
+#define LIBAVDEVICE_VERSION_MAJOR  60
 
 /**
  * FF_API_* defines may be placed below to indicate public API that will be
diff --git a/libavfilter/version.h b/libavfilter/version.h
index 057ab634157..d5a6bc143a9 100644
--- a/libavfilter/version.h
+++ b/libavfilter/version.h
@@ -31,7 +31,7 @@
 
 #include "version_major.h"
 
-#define LIBAVFILTER_VERSION_MINOR  56
+#define LIBAVFILTER_VERSION_MINOR   0
 #define LIBAVFILTER_VERSION_MICRO 100
 
 
diff --git a/libavfilter/version_major.h b/libavfilter/version_major.h
index cb2238ffdd0..899dfdb27db 100644
--- a/libavfilter/version_major.h
+++ b/libavfilter/version_major.h
@@ -27,7 +27,7 @@
  * Libavfilter version macros
  */
 
-#define LIBAVFILTER_VERSION_MAJOR   8
+#define LIBAVFILTER_VERSION_MAJOR   9
 
 /**
  * FF_API_* defines may be placed below to indicate public API that will be
diff --git a/libavformat/version.h b/libavformat/version.h
index 789859fbe29..752aac16f7b 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -31,7 +31,7 @@
 
 #include "version_major.h"
 
-#define LIBAVFORMAT_VERSION_MINOR  37
+#define LIBAVFORMAT_VERSION_MINOR   0
 #define LIBAVFORMAT_VERSION_MICRO 100
 
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
diff --git a/libavformat/version_major.h b/libavformat/version_major.h
index b11f8113838..9ccf40bdc17 100644
--- a/libavformat/version_major.h
+++ b/libavformat/version_major.h
@@ -29,7 +29,7 @@
 
 // Major bumping may affect Ticket5467, 5421, 5451(compatibility with Chromium)
 // Also please add any ticket numbers that you believe might be affected here
-#define LIBAVFORMAT_VERSION_MAJOR  59
+#define LIBAVFORMAT_VERSION_MAJOR  60
 
 /**
  * FF_API_* defines may be placed below to indicate public API that will be
diff --git a/libavutil/version.h b/libavutil/version.h
index 24b9980601d..eef270f66a2 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -78,8 +78,8 @@
  * @{
  */
 
-#define LIBAVUTIL_VERSION_MAJOR  57
-#define LIBAVUTIL_VERSION_MINOR  44
+#define LIBAVUTIL_VERSION_MAJOR  58
+#define LIBAVUTIL_VERSION_MINOR   0
 #define LIBAVUTIL_VERSION_MICRO 100
 
 #define 

[FFmpeg-devel] [PATCH v2 13/33] avcodec: remove FF_API_AUTO_THREADS

2023-02-04 Thread Anton Khirnov
From: James Almer 

Signed-off-by: James Almer 
---
 libavcodec/codec.h | 3 ---
 libavcodec/version_major.h | 1 -
 2 files changed, 4 deletions(-)

diff --git a/libavcodec/codec.h b/libavcodec/codec.h
index e10fcb9c7c2..8bf85b2f9c8 100644
--- a/libavcodec/codec.h
+++ b/libavcodec/codec.h
@@ -125,9 +125,6 @@
  * multithreading-capable external libraries.
  */
 #define AV_CODEC_CAP_OTHER_THREADS   (1 << 15)
-#if FF_API_AUTO_THREADS
-#define AV_CODEC_CAP_AUTO_THREADSAV_CODEC_CAP_OTHER_THREADS
-#endif
 /**
  * Audio encoder supports receiving a different number of samples in each call.
  */
diff --git a/libavcodec/version_major.h b/libavcodec/version_major.h
index 1a6a60942fc..1b96c4c8fe9 100644
--- a/libavcodec/version_major.h
+++ b/libavcodec/version_major.h
@@ -37,7 +37,6 @@
  * at once through the bump. This improves the git bisect-ability of the 
change.
  */
 
-#define FF_API_AUTO_THREADS(LIBAVCODEC_VERSION_MAJOR < 60)
 #define FF_API_INIT_PACKET (LIBAVCODEC_VERSION_MAJOR < 60)
 #define FF_API_AVCTX_TIMEBASE(LIBAVCODEC_VERSION_MAJOR < 60)
 #define FF_API_FLAG_TRUNCATED  (LIBAVCODEC_VERSION_MAJOR < 60)
-- 
2.35.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v2 09/33] avcodec: remove FF_API_UNUSED_CODEC_CAPS

2023-02-04 Thread Anton Khirnov
From: James Almer 

Signed-off-by: James Almer 
---
 libavcodec/codec.h | 11 ---
 libavcodec/version_major.h |  1 -
 2 files changed, 12 deletions(-)

diff --git a/libavcodec/codec.h b/libavcodec/codec.h
index 77a1a3f5a29..e10fcb9c7c2 100644
--- a/libavcodec/codec.h
+++ b/libavcodec/codec.h
@@ -143,17 +143,6 @@
  */
 #define AV_CODEC_CAP_AVOID_PROBING   (1 << 17)
 
-#if FF_API_UNUSED_CODEC_CAPS
-/**
- * Deprecated and unused. Use AVCodecDescriptor.props instead
- */
-#define AV_CODEC_CAP_INTRA_ONLY   0x4000
-/**
- * Deprecated and unused. Use AVCodecDescriptor.props instead
- */
-#define AV_CODEC_CAP_LOSSLESS 0x8000
-#endif
-
 /**
  * Codec is backed by a hardware implementation. Typically used to
  * identify a non-hwaccel hardware decoder. For information about hwaccels, use
diff --git a/libavcodec/version_major.h b/libavcodec/version_major.h
index cd4830c69ae..7b561940b0c 100644
--- a/libavcodec/version_major.h
+++ b/libavcodec/version_major.h
@@ -37,7 +37,6 @@
  * at once through the bump. This improves the git bisect-ability of the 
change.
  */
 
-#define FF_API_UNUSED_CODEC_CAPS   (LIBAVCODEC_VERSION_MAJOR < 60)
 #define FF_API_THREAD_SAFE_CALLBACKS (LIBAVCODEC_VERSION_MAJOR < 60)
 #define FF_API_DEBUG_MV  (LIBAVCODEC_VERSION_MAJOR < 60)
 #define FF_API_GET_FRAME_CLASS (LIBAVCODEC_VERSION_MAJOR < 60)
-- 
2.35.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v2 11/33] avcodec: remove FF_API_DEBUG_MV

2023-02-04 Thread Anton Khirnov
From: James Almer 

Signed-off-by: James Almer 
---
 libavcodec/avcodec.h   | 11 ---
 libavcodec/version_major.h |  1 -
 2 files changed, 12 deletions(-)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 6cf6031705b..25c4b4eacc3 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -1812,17 +1812,6 @@ typedef struct AVCodecContext {
  */
 int seek_preroll;
 
-#if FF_API_DEBUG_MV
-/**
- * @deprecated unused
- */
-attribute_deprecated
-int debug_mv;
-#define FF_DEBUG_VIS_MV_P_FOR  0x0001 //visualize forward predicted MVs of 
P frames
-#define FF_DEBUG_VIS_MV_B_FOR  0x0002 //visualize forward predicted MVs of 
B frames
-#define FF_DEBUG_VIS_MV_B_BACK 0x0004 //visualize backward predicted MVs 
of B frames
-#endif
-
 /**
  * custom intra quantization matrix
  * - encoding: Set by user, can be NULL.
diff --git a/libavcodec/version_major.h b/libavcodec/version_major.h
index dbb5606c147..d5d55c6dad0 100644
--- a/libavcodec/version_major.h
+++ b/libavcodec/version_major.h
@@ -37,7 +37,6 @@
  * at once through the bump. This improves the git bisect-ability of the 
change.
  */
 
-#define FF_API_DEBUG_MV  (LIBAVCODEC_VERSION_MAJOR < 60)
 #define FF_API_GET_FRAME_CLASS (LIBAVCODEC_VERSION_MAJOR < 60)
 #define FF_API_AUTO_THREADS(LIBAVCODEC_VERSION_MAJOR < 60)
 #define FF_API_INIT_PACKET (LIBAVCODEC_VERSION_MAJOR < 60)
-- 
2.35.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v2 03/33] avcodec: Make avcodec_decode_subtitle2 accept a const AVPacket*

2023-02-04 Thread Anton Khirnov
From: Andreas Rheinhardt 

Signed-off-by: Andreas Rheinhardt 
Signed-off-by: Anton Khirnov 
---
 doc/APIchanges| 3 +++
 fftools/ffmpeg.c  | 4 ++--
 fftools/ffprobe.c | 2 +-
 libavcodec/avcodec.h  | 3 +--
 libavcodec/decode.c   | 9 -
 tools/target_dec_fuzzer.c | 4 ++--
 6 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index bc52a079644..b1181ec60a3 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -14,6 +14,9 @@ libavutil: 2021-04-27
 
 API changes, most recent first:
 
+2023-02-xx - xx - lavc 60.0.100 - avcodec.h
+  avcodec_decode_subtitle2() now accepts const AVPacket*.
+
 2023-01-29 - xx - lavc 59.59.100 - avcodec.h
   Add AV_CODEC_FLAG_COPY_OPAQUE and AV_CODEC_FLAG_FRAME_DURATION.
 
diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 92fd61f3158..257f319550c 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -2296,8 +2296,8 @@ fail:
 return err < 0 ? err : ret;
 }
 
-static int transcode_subtitles(InputStream *ist, AVPacket *pkt, int 
*got_output,
-   int *decode_failed)
+static int transcode_subtitles(InputStream *ist, const AVPacket *pkt,
+   int *got_output, int *decode_failed)
 {
 AVSubtitle subtitle;
 int free_sub = 1;
diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index dfa7ff1b241..5beaece094f 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -2733,7 +2733,7 @@ static void show_frame(WriterContext *w, AVFrame *frame, 
AVStream *stream,
 
 static av_always_inline int process_frame(WriterContext *w,
   InputFile *ifile,
-  AVFrame *frame, AVPacket *pkt,
+  AVFrame *frame, const AVPacket *pkt,
   int *packet_new)
 {
 AVFormatContext *fmt_ctx = ifile->fmt_ctx;
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 90b437ccbe2..b9bd69a2ec7 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -2601,8 +2601,7 @@ enum AVChromaLocation avcodec_chroma_pos_to_enum(int 
xpos, int ypos);
  * @param[in] avpkt The input AVPacket containing the input buffer.
  */
 int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
-int *got_sub_ptr,
-AVPacket *avpkt);
+ int *got_sub_ptr, const AVPacket *avpkt);
 
 /**
  * Supply raw packet data as input to a decoder.
diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index 0abc88737b2..45c1f085792 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -780,8 +780,8 @@ static void get_subtitle_defaults(AVSubtitle *sub)
 }
 
 #define UTF8_MAX_BYTES 4 /* 5 and 6 bytes sequences should not be used */
-static int recode_subtitle(AVCodecContext *avctx, AVPacket **outpkt,
-   AVPacket *inpkt, AVPacket *buf_pkt)
+static int recode_subtitle(AVCodecContext *avctx, const AVPacket **outpkt,
+   const AVPacket *inpkt, AVPacket *buf_pkt)
 {
 #if CONFIG_ICONV
 iconv_t cd = (iconv_t)-1;
@@ -861,8 +861,7 @@ static int utf8_check(const uint8_t *str)
 }
 
 int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
- int *got_sub_ptr,
- AVPacket *avpkt)
+ int *got_sub_ptr, const AVPacket *avpkt)
 {
 int ret = 0;
 
@@ -882,7 +881,7 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, 
AVSubtitle *sub,
 
 if ((avctx->codec->capabilities & AV_CODEC_CAP_DELAY) || avpkt->size) {
 AVCodecInternal *avci = avctx->internal;
-AVPacket *pkt;
+const AVPacket *pkt;
 
 ret = recode_subtitle(avctx, , avpkt, avci->buffer_pkt);
 if (ret < 0)
diff --git a/tools/target_dec_fuzzer.c b/tools/target_dec_fuzzer.c
index a20345db5c6..8e89b613c07 100644
--- a/tools/target_dec_fuzzer.c
+++ b/tools/target_dec_fuzzer.c
@@ -81,8 +81,8 @@ static const FFCodec *AVCodecInitialize(enum AVCodecID 
codec_id)
 return ffcodec(res);
 }
 
-static int subtitle_handler(AVCodecContext *avctx, void *frame,
-int *got_sub_ptr, AVPacket *avpkt)
+static int subtitle_handler(AVCodecContext *avctx, AVFrame *unused,
+int *got_sub_ptr, const AVPacket *avpkt)
 {
 AVSubtitle sub;
 int ret = avcodec_decode_subtitle2(avctx, , got_sub_ptr, avpkt);
-- 
2.35.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v2 16/33] avcodec: remove FF_API_SUB_TEXT_FORMAT

2023-02-04 Thread Anton Khirnov
From: James Almer 

Signed-off-by: James Almer 
---
 libavcodec/avcodec.h   | 9 -
 libavcodec/options_table.h | 4 
 libavcodec/version_major.h | 1 -
 3 files changed, 14 deletions(-)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 9066f6c5297..ecd02ff4747 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -1868,15 +1868,6 @@ typedef struct AVCodecContext {
  */
 AVBufferRef *hw_frames_ctx;
 
-#if FF_API_SUB_TEXT_FORMAT
-/**
- * @deprecated unused
- */
-attribute_deprecated
-int sub_text_format;
-#define FF_SUB_TEXT_FMT_ASS  0
-#endif
-
 /**
  * Audio only. The amount of padding (in samples) appended by the encoder 
to
  * the end of the audio. I.e. this number of decoded samples must be
diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h
index 52ecc25cf9b..bcd6f381917 100644
--- a/libavcodec/options_table.h
+++ b/libavcodec/options_table.h
@@ -376,10 +376,6 @@ static const AVOption avcodec_options[] = {
 {"auto",NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 
FF_SUB_CHARENC_MODE_AUTOMATIC},   INT_MIN, INT_MAX, S|D, "sub_charenc_mode"},
 {"pre_decoder", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 
FF_SUB_CHARENC_MODE_PRE_DECODER}, INT_MIN, INT_MAX, S|D, "sub_charenc_mode"},
 {"ignore",  NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 
FF_SUB_CHARENC_MODE_IGNORE},  INT_MIN, INT_MAX, S|D, "sub_charenc_mode"},
-#if FF_API_SUB_TEXT_FORMAT
-{"sub_text_format", "Deprecated, does nothing", OFFSET(sub_text_format), 
AV_OPT_TYPE_INT, {.i64 = FF_SUB_TEXT_FMT_ASS}, 0, 1, S|D | 
AV_OPT_FLAG_DEPRECATED, "sub_text_format"},
-{"ass",  NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_SUB_TEXT_FMT_ASS}, 
 INT_MIN, INT_MAX, S|D, "sub_text_format"},
-#endif
 {"apply_cropping", NULL, OFFSET(apply_cropping), AV_OPT_TYPE_BOOL, { .i64 = 1 
}, 0, 1, V | D },
 {"skip_alpha", "Skip processing alpha", OFFSET(skip_alpha), AV_OPT_TYPE_BOOL, 
{.i64 = 0 }, 0, 1, V|D },
 {"field_order", "Field order", OFFSET(field_order), AV_OPT_TYPE_INT, {.i64 = 
AV_FIELD_UNKNOWN }, 0, 5, V|D|E, "field_order" },
diff --git a/libavcodec/version_major.h b/libavcodec/version_major.h
index eea761c7dd6..04e6225f9b3 100644
--- a/libavcodec/version_major.h
+++ b/libavcodec/version_major.h
@@ -38,7 +38,6 @@
  */
 
 #define FF_API_INIT_PACKET (LIBAVCODEC_VERSION_MAJOR < 60)
-#define FF_API_SUB_TEXT_FORMAT (LIBAVCODEC_VERSION_MAJOR < 60)
 #define FF_API_IDCT_NONE   (LIBAVCODEC_VERSION_MAJOR < 60)
 #define FF_API_SVTAV1_OPTS (LIBAVCODEC_VERSION_MAJOR < 60)
 #define FF_API_AYUV_CODECID(LIBAVCODEC_VERSION_MAJOR < 60)
-- 
2.35.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v2 27/33] avutil: remove FF_API_COLORSPACE_NAME

2023-02-04 Thread Anton Khirnov
From: James Almer 

Signed-off-by: James Almer 
---
 libavutil/frame.c   | 17 -
 libavutil/frame.h   |  9 -
 libavutil/version.h |  1 -
 3 files changed, 27 deletions(-)

diff --git a/libavutil/frame.c b/libavutil/frame.c
index fa9b11aa543..3198a50f67f 100644
--- a/libavutil/frame.c
+++ b/libavutil/frame.c
@@ -35,23 +35,6 @@
av_get_channel_layout_nb_channels((frame)->channel_layout))
 #endif
 
-#if FF_API_COLORSPACE_NAME
-const char *av_get_colorspace_name(enum AVColorSpace val)
-{
-static const char * const name[] = {
-[AVCOL_SPC_RGB]   = "GBR",
-[AVCOL_SPC_BT709] = "bt709",
-[AVCOL_SPC_FCC]   = "fcc",
-[AVCOL_SPC_BT470BG]   = "bt470bg",
-[AVCOL_SPC_SMPTE170M] = "smpte170m",
-[AVCOL_SPC_SMPTE240M] = "smpte240m",
-[AVCOL_SPC_YCOCG] = "YCgCo",
-};
-if ((unsigned)val >= FF_ARRAY_ELEMS(name))
-return NULL;
-return name[val];
-}
-#endif
 static void get_frame_defaults(AVFrame *frame)
 {
 memset(frame, 0, sizeof(*frame));
diff --git a/libavutil/frame.h b/libavutil/frame.h
index bbe909ee2da..1172d013a3d 100644
--- a/libavutil/frame.h
+++ b/libavutil/frame.h
@@ -720,15 +720,6 @@ typedef struct AVFrame {
 } AVFrame;
 
 
-#if FF_API_COLORSPACE_NAME
-/**
- * Get the name of a colorspace.
- * @return a static string identifying the colorspace; can be NULL.
- * @deprecated use av_color_space_name()
- */
-attribute_deprecated
-const char *av_get_colorspace_name(enum AVColorSpace val);
-#endif
 /**
  * Allocate an AVFrame and set its fields to default values.  The resulting
  * struct must be freed using av_frame_free().
diff --git a/libavutil/version.h b/libavutil/version.h
index 6014743947c..700af5d8749 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -105,7 +105,6 @@
  * @{
  */
 
-#define FF_API_COLORSPACE_NAME  (LIBAVUTIL_VERSION_MAJOR < 58)
 #define FF_API_AV_MALLOCZ_ARRAY (LIBAVUTIL_VERSION_MAJOR < 58)
 #define FF_API_FIFO_PEEK2   (LIBAVUTIL_VERSION_MAJOR < 58)
 #define FF_API_FIFO_OLD_API (LIBAVUTIL_VERSION_MAJOR < 58)
-- 
2.35.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v2 21/33] avfilter: remove FF_API_SWS_PARAM_OPTION

2023-02-04 Thread Anton Khirnov
From: James Almer 

Signed-off-by: James Almer 
---
 libavfilter/buffersrc.c | 11 ---
 libavfilter/version_major.h |  1 -
 2 files changed, 12 deletions(-)

diff --git a/libavfilter/buffersrc.c b/libavfilter/buffersrc.c
index ae8bba19b07..ba17450b937 100644
--- a/libavfilter/buffersrc.c
+++ b/libavfilter/buffersrc.c
@@ -50,9 +50,6 @@ typedef struct BufferSourceContext {
 int   w, h;
 enum AVPixelFormat  pix_fmt;
 AVRationalpixel_aspect;
-#if FF_API_SWS_PARAM_OPTION
-char  *sws_param;
-#endif
 
 AVBufferRef *hw_frames_ctx;
 
@@ -287,11 +284,6 @@ static av_cold int init_video(AVFilterContext *ctx)
c->time_base.num, c->time_base.den, c->frame_rate.num, 
c->frame_rate.den,
c->pixel_aspect.num, c->pixel_aspect.den);
 
-#if FF_API_SWS_PARAM_OPTION
-if (c->sws_param)
-av_log(ctx, AV_LOG_WARNING, "sws_param option is deprecated and 
ignored\n");
-#endif
-
 return 0;
 }
 
@@ -313,9 +305,6 @@ static const AVOption buffer_options[] = {
 { "pixel_aspect",  "sample aspect ratio",OFFSET(pixel_aspect), 
AV_OPT_TYPE_RATIONAL, { .dbl = 0 }, 0, DBL_MAX, V },
 { "time_base", NULL, OFFSET(time_base),
AV_OPT_TYPE_RATIONAL, { .dbl = 0 }, 0, DBL_MAX, V },
 { "frame_rate",NULL, OFFSET(frame_rate),   
AV_OPT_TYPE_RATIONAL, { .dbl = 0 }, 0, DBL_MAX, V },
-#if FF_API_SWS_PARAM_OPTION
-{ "sws_param", NULL, OFFSET(sws_param),
AV_OPT_TYPE_STRING,.flags = V },
-#endif
 { NULL },
 };
 
diff --git a/libavfilter/version_major.h b/libavfilter/version_major.h
index de0cf6e9793..655e3d119d2 100644
--- a/libavfilter/version_major.h
+++ b/libavfilter/version_major.h
@@ -35,7 +35,6 @@
  * the public API and may change, break or disappear at any time.
  */
 
-#define FF_API_SWS_PARAM_OPTION (LIBAVFILTER_VERSION_MAJOR < 9)
 #define FF_API_BUFFERSINK_ALLOC (LIBAVFILTER_VERSION_MAJOR < 9)
 #define FF_API_PAD_COUNT(LIBAVFILTER_VERSION_MAJOR < 9)
 
-- 
2.35.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v2 08/33] avcodec: remove FF_API_OPENH264_CABAC

2023-02-04 Thread Anton Khirnov
From: James Almer 

Signed-off-by: James Almer 
---
 libavcodec/libopenh264enc.c | 6 --
 libavcodec/version_major.h  | 1 -
 2 files changed, 7 deletions(-)

diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c
index 4dd15b0afe5..8b4755f5ba4 100644
--- a/libavcodec/libopenh264enc.c
+++ b/libavcodec/libopenh264enc.c
@@ -50,9 +50,6 @@ typedef struct SVCContext {
 int max_nal_size;
 int skip_frames;
 int skipped;
-#if FF_API_OPENH264_CABAC
-int cabac;  // deprecated
-#endif
 int coder;
 
 // rate control mode
@@ -72,9 +69,6 @@ static const AVOption options[] = {
 #undef PROFILE
 { "max_nal_size", "set maximum NAL size in bytes", OFFSET(max_nal_size), 
AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE },
 { "allow_skip_frames", "allow skipping frames to hit the target bitrate", 
OFFSET(skip_frames), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
-#if FF_API_OPENH264_CABAC
-{ "cabac", "Enable cabac(deprecated, use coder)", OFFSET(cabac), 
AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE|DEPRECATED },
-#endif
 { "coder", "Coder type",  OFFSET(coder), AV_OPT_TYPE_INT, { .i64 = -1 }, 
-1, 1, VE, "coder" },
 { "default",  NULL, 0, AV_OPT_TYPE_CONST, { .i64 = -1 }, 
INT_MIN, INT_MAX, VE, "coder" },
 { "cavlc",NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0 },  
INT_MIN, INT_MAX, VE, "coder" },
diff --git a/libavcodec/version_major.h b/libavcodec/version_major.h
index e9a4910df0d..cd4830c69ae 100644
--- a/libavcodec/version_major.h
+++ b/libavcodec/version_major.h
@@ -37,7 +37,6 @@
  * at once through the bump. This improves the git bisect-ability of the 
change.
  */
 
-#define FF_API_OPENH264_CABAC  (LIBAVCODEC_VERSION_MAJOR < 60)
 #define FF_API_UNUSED_CODEC_CAPS   (LIBAVCODEC_VERSION_MAJOR < 60)
 #define FF_API_THREAD_SAFE_CALLBACKS (LIBAVCODEC_VERSION_MAJOR < 60)
 #define FF_API_DEBUG_MV  (LIBAVCODEC_VERSION_MAJOR < 60)
-- 
2.35.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v2 23/33] avfilter: remove FF_API_PAD_COUNT

2023-02-04 Thread Anton Khirnov
From: James Almer 

Signed-off-by: James Almer 
---
 libavfilter/avfilter.c  | 21 -
 libavfilter/avfilter.h  | 10 --
 libavfilter/version_major.h |  2 --
 3 files changed, 33 deletions(-)

diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index c2ecdffa6f5..ed363351add 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -560,27 +560,6 @@ int avfilter_process_command(AVFilterContext *filter, 
const char *cmd, const cha
 return AVERROR(ENOSYS);
 }
 
-#if FF_API_PAD_COUNT
-int avfilter_pad_count(const AVFilterPad *pads)
-{
-const AVFilter *filter;
-void *opaque = NULL;
-
-if (!pads)
-return 0;
-
-while (filter = av_filter_iterate()) {
-if (pads == filter->inputs)
-return filter->nb_inputs;
-if (pads == filter->outputs)
-return filter->nb_outputs;
-}
-
-av_assert0(!"AVFilterPad list not from a filter");
-return AVERROR_BUG;
-}
-#endif
-
 unsigned avfilter_filter_pad_count(const AVFilter *filter, int is_output)
 {
 return is_output ? filter->nb_outputs : filter->nb_inputs;
diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
index c2ec7a4b5fc..333eeb31c3d 100644
--- a/libavfilter/avfilter.h
+++ b/libavfilter/avfilter.h
@@ -76,16 +76,6 @@ typedef struct AVFilterPad AVFilterPad;
 typedef struct AVFilterFormats AVFilterFormats;
 typedef struct AVFilterChannelLayouts AVFilterChannelLayouts;
 
-#if FF_API_PAD_COUNT
-/**
- * Get the number of elements in an AVFilter's inputs or outputs array.
- *
- * @deprecated Use avfilter_filter_pad_count() instead.
- */
-attribute_deprecated
-int avfilter_pad_count(const AVFilterPad *pads);
-#endif
-
 /**
  * Get the name of an AVFilterPad.
  *
diff --git a/libavfilter/version_major.h b/libavfilter/version_major.h
index 5a8bf4eda21..cb2238ffdd0 100644
--- a/libavfilter/version_major.h
+++ b/libavfilter/version_major.h
@@ -35,6 +35,4 @@
  * the public API and may change, break or disappear at any time.
  */
 
-#define FF_API_PAD_COUNT(LIBAVFILTER_VERSION_MAJOR < 9)
-
 #endif /* AVFILTER_VERSION_MAJOR_H */
-- 
2.35.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v2 31/33] avcodec/version: postpone the remaining API deprecations

2023-02-04 Thread Anton Khirnov
From: James Almer 

They are either too recent, or still need work like FF_API_INIT_PACKET.

Signed-off-by: James Almer 
---
 libavcodec/version_major.h | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/libavcodec/version_major.h b/libavcodec/version_major.h
index 04e6225f9b3..bcea37d7977 100644
--- a/libavcodec/version_major.h
+++ b/libavcodec/version_major.h
@@ -37,12 +37,12 @@
  * at once through the bump. This improves the git bisect-ability of the 
change.
  */
 
-#define FF_API_INIT_PACKET (LIBAVCODEC_VERSION_MAJOR < 60)
-#define FF_API_IDCT_NONE   (LIBAVCODEC_VERSION_MAJOR < 60)
-#define FF_API_SVTAV1_OPTS (LIBAVCODEC_VERSION_MAJOR < 60)
-#define FF_API_AYUV_CODECID(LIBAVCODEC_VERSION_MAJOR < 60)
-#define FF_API_VT_OUTPUT_CALLBACK  (LIBAVCODEC_VERSION_MAJOR < 60)
-#define FF_API_VT_HWACCEL_CONTEXT  (LIBAVCODEC_VERSION_MAJOR < 60)
-#define FF_API_AVCODEC_CHROMA_POS  (LIBAVCODEC_VERSION_MAJOR < 60)
+#define FF_API_INIT_PACKET (LIBAVCODEC_VERSION_MAJOR < 61)
+#define FF_API_IDCT_NONE   (LIBAVCODEC_VERSION_MAJOR < 61)
+#define FF_API_SVTAV1_OPTS (LIBAVCODEC_VERSION_MAJOR < 61)
+#define FF_API_AYUV_CODECID(LIBAVCODEC_VERSION_MAJOR < 61)
+#define FF_API_VT_OUTPUT_CALLBACK  (LIBAVCODEC_VERSION_MAJOR < 61)
+#define FF_API_AVCODEC_CHROMA_POS  (LIBAVCODEC_VERSION_MAJOR < 61)
+#define FF_API_VT_HWACCEL_CONTEXT  (LIBAVCODEC_VERSION_MAJOR < 61)
 
 #endif /* AVCODEC_VERSION_MAJOR_H */
-- 
2.35.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v2 30/33] avutil/version: postpone the remaining API deprecations

2023-02-04 Thread Anton Khirnov
From: James Almer 

They are too recent.

Signed-off-by: James Almer 
---
 fftools/ffprobe.c   |  2 +-
 libavutil/version.h | 12 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index 5beaece094f..db37ec52f49 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -2588,7 +2588,7 @@ static void show_frame(WriterContext *w, AVFrame *frame, 
AVStream *stream,
 print_time("pkt_dts_time",  frame->pkt_dts, >time_base);
 print_ts  ("best_effort_timestamp", frame->best_effort_timestamp);
 print_time("best_effort_timestamp_time", frame->best_effort_timestamp, 
>time_base);
-#if LIBAVUTIL_VERSION_MAJOR < 58
+#if LIBAVUTIL_VERSION_MAJOR < 59
 AV_NOWARN_DEPRECATED(
 print_duration_ts  ("pkt_duration",  frame->pkt_duration);
 print_duration_time("pkt_duration_time", frame->pkt_duration, 
>time_base);
diff --git a/libavutil/version.h b/libavutil/version.h
index 3bad472227a..24b9980601d 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -105,12 +105,12 @@
  * @{
  */
 
-#define FF_API_FIFO_PEEK2   (LIBAVUTIL_VERSION_MAJOR < 58)
-#define FF_API_FIFO_OLD_API (LIBAVUTIL_VERSION_MAJOR < 58)
-#define FF_API_XVMC (LIBAVUTIL_VERSION_MAJOR < 58)
-#define FF_API_OLD_CHANNEL_LAYOUT   (LIBAVUTIL_VERSION_MAJOR < 58)
-#define FF_API_AV_FOPEN_UTF8(LIBAVUTIL_VERSION_MAJOR < 58)
-#define FF_API_PKT_DURATION (LIBAVUTIL_VERSION_MAJOR < 58)
+#define FF_API_FIFO_PEEK2   (LIBAVUTIL_VERSION_MAJOR < 59)
+#define FF_API_FIFO_OLD_API (LIBAVUTIL_VERSION_MAJOR < 59)
+#define FF_API_XVMC (LIBAVUTIL_VERSION_MAJOR < 59)
+#define FF_API_OLD_CHANNEL_LAYOUT   (LIBAVUTIL_VERSION_MAJOR < 59)
+#define FF_API_AV_FOPEN_UTF8(LIBAVUTIL_VERSION_MAJOR < 59)
+#define FF_API_PKT_DURATION (LIBAVUTIL_VERSION_MAJOR < 59)
 
 /**
  * @}
-- 
2.35.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v2 12/33] avcodec: remove FF_API_GET_FRAME_CLASS

2023-02-04 Thread Anton Khirnov
From: James Almer 

Signed-off-by: James Almer 
---
 libavcodec/avcodec.h   |  8 
 libavcodec/options.c   | 33 -
 libavcodec/version_major.h |  1 -
 3 files changed, 42 deletions(-)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 25c4b4eacc3..8aa08500a46 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -2370,14 +2370,6 @@ void avcodec_free_context(AVCodecContext **avctx);
  */
 const AVClass *avcodec_get_class(void);
 
-#if FF_API_GET_FRAME_CLASS
-/**
- * @deprecated This function should not be used.
- */
-attribute_deprecated
-const AVClass *avcodec_get_frame_class(void);
-#endif
-
 /**
  * Get the AVClass for AVSubtitleRect. It can be used in combination with
  * AV_OPT_SEARCH_FAKE_OBJ for examining options.
diff --git a/libavcodec/options.c b/libavcodec/options.c
index 2e05d29e1ee..fdfbc0ababd 100644
--- a/libavcodec/options.c
+++ b/libavcodec/options.c
@@ -185,39 +185,6 @@ const AVClass *avcodec_get_class(void)
 return _codec_context_class;
 }
 
-#if FF_API_GET_FRAME_CLASS
-FF_DISABLE_DEPRECATION_WARNINGS
-#define FOFFSET(x) offsetof(AVFrame,x)
-
-static const AVOption frame_options[]={
-{"best_effort_timestamp", "", FOFFSET(best_effort_timestamp), 
AV_OPT_TYPE_INT64, {.i64 = AV_NOPTS_VALUE }, INT64_MIN, INT64_MAX, 0},
-{"pkt_pos", "", FOFFSET(pkt_pos), AV_OPT_TYPE_INT64, {.i64 = -1 }, INT64_MIN, 
INT64_MAX, 0},
-{"pkt_size", "", FOFFSET(pkt_size), AV_OPT_TYPE_INT64, {.i64 = -1 }, 
INT64_MIN, INT64_MAX, 0},
-{"sample_aspect_ratio", "", FOFFSET(sample_aspect_ratio), 
AV_OPT_TYPE_RATIONAL, {.dbl = 0 }, 0, INT_MAX, 0},
-{"width", "", FOFFSET(width), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, INT_MAX, 0},
-{"height", "", FOFFSET(height), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, INT_MAX, 0},
-{"format", "", FOFFSET(format), AV_OPT_TYPE_INT, {.i64 = -1 }, 0, INT_MAX, 0},
-#if FF_API_OLD_CHANNEL_LAYOUT
-{"channel_layout", "", FOFFSET(channel_layout), AV_OPT_TYPE_INT64, {.i64 = 0 
}, 0, INT64_MAX, 0},
-#endif
-{"sample_rate", "", FOFFSET(sample_rate), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 
INT_MAX, 0},
-{NULL},
-};
-
-static const AVClass av_frame_class = {
-.class_name  = "AVFrame",
-.item_name   = NULL,
-.option  = frame_options,
-.version = LIBAVUTIL_VERSION_INT,
-};
-
-const AVClass *avcodec_get_frame_class(void)
-{
-return _frame_class;
-}
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
-
 #define SROFFSET(x) offsetof(AVSubtitleRect,x)
 
 static const AVOption subtitle_rect_options[]={
diff --git a/libavcodec/version_major.h b/libavcodec/version_major.h
index d5d55c6dad0..1a6a60942fc 100644
--- a/libavcodec/version_major.h
+++ b/libavcodec/version_major.h
@@ -37,7 +37,6 @@
  * at once through the bump. This improves the git bisect-ability of the 
change.
  */
 
-#define FF_API_GET_FRAME_CLASS (LIBAVCODEC_VERSION_MAJOR < 60)
 #define FF_API_AUTO_THREADS(LIBAVCODEC_VERSION_MAJOR < 60)
 #define FF_API_INIT_PACKET (LIBAVCODEC_VERSION_MAJOR < 60)
 #define FF_API_AVCTX_TIMEBASE(LIBAVCODEC_VERSION_MAJOR < 60)
-- 
2.35.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v2 25/33] avutil: remove FF_API_D2STR

2023-02-04 Thread Anton Khirnov
From: James Almer 

Signed-off-by: James Almer 
---
 libavutil/avstring.c   | 10 --
 libavutil/avstring.h   |  9 -
 libavutil/tests/avstring.c | 16 
 libavutil/version.h|  1 -
 4 files changed, 36 deletions(-)

diff --git a/libavutil/avstring.c b/libavutil/avstring.c
index 5ddbe9219e8..e460b5be7f3 100644
--- a/libavutil/avstring.c
+++ b/libavutil/avstring.c
@@ -139,16 +139,6 @@ end:
 return p;
 }
 
-#if FF_API_D2STR
-char *av_d2str(double d)
-{
-char *str = av_malloc(16);
-if (str)
-snprintf(str, 16, "%f", d);
-return str;
-}
-#endif
-
 #define WHITESPACES " \n\t\r"
 
 char *av_get_token(const char **buf, const char *term)
diff --git a/libavutil/avstring.h b/libavutil/avstring.h
index 74aa4cd0e4e..e2602637630 100644
--- a/libavutil/avstring.h
+++ b/libavutil/avstring.h
@@ -157,15 +157,6 @@ static inline size_t av_strnlen(const char *s, size_t len)
  */
 char *av_asprintf(const char *fmt, ...) av_printf_format(1, 2);
 
-#if FF_API_D2STR
-/**
- * Convert a number to an av_malloced string.
- * @deprecated  use av_asprintf() with "%f" or a more specific format
- */
-attribute_deprecated
-char *av_d2str(double d);
-#endif
-
 /**
  * Unescape the given string until a non escaped terminating char,
  * and return the token corresponding to the unescaped string.
diff --git a/libavutil/tests/avstring.c b/libavutil/tests/avstring.c
index 37a2cf18334..bc0bde358d5 100644
--- a/libavutil/tests/avstring.c
+++ b/libavutil/tests/avstring.c
@@ -109,21 +109,5 @@ int main(void)
 TEST_STRIREPLACE(haystack, needle [2], "Education consists mainly in what 
we have instead.");
 TEST_STRIREPLACE(haystack, needle [1], "Education consists mainly in what 
we have instead");
 
-#if FF_API_D2STR
-FF_DISABLE_DEPRECATION_WARNINGS
-/*Testing av_d2str()*/
-#define TEST_D2STR(value, expected) \
-if((ptr = av_d2str(value)) == NULL){ \
-printf("error, received null pointer!\n"); \
-} else { \
-if(strcmp(ptr, expected) != 0) \
-printf( "expected: %s, received: %s\n", expected, ptr); \
-av_free(ptr); \
-}
-TEST_D2STR(0 ,  "0.00");
-TEST_D2STR(-1.2333234, "-1.233323");
-TEST_D2STR(-1.2333237, "-1.233324");
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
 return 0;
 }
diff --git a/libavutil/version.h b/libavutil/version.h
index 60f96af5df8..38769962cc3 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -105,7 +105,6 @@
  * @{
  */
 
-#define FF_API_D2STR(LIBAVUTIL_VERSION_MAJOR < 58)
 #define FF_API_DECLARE_ALIGNED  (LIBAVUTIL_VERSION_MAJOR < 58)
 #define FF_API_COLORSPACE_NAME  (LIBAVUTIL_VERSION_MAJOR < 58)
 #define FF_API_AV_MALLOCZ_ARRAY (LIBAVUTIL_VERSION_MAJOR < 58)
-- 
2.35.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v2 10/33] avcodec: remove FF_API_THREAD_SAFE_CALLBACKS

2023-02-04 Thread Anton Khirnov
From: James Almer 

Signed-off-by: James Almer 
---
 fftools/ffmpeg.c  |   5 -
 libavcodec/avcodec.h  |  21 ---
 libavcodec/decode.c   |  13 --
 libavcodec/encode.c   |   7 +-
 libavcodec/frame_thread_encoder.c |  20 ---
 libavcodec/pthread_frame.c| 237 +-
 libavcodec/thread.h   |  12 --
 libavcodec/version_major.h|   1 -
 8 files changed, 6 insertions(+), 310 deletions(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 257f319550c..52a3e14f697 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -2640,11 +2640,6 @@ static int init_input_stream(InputStream *ist, char 
*error, int error_len)
 
 ist->dec_ctx->opaque= ist;
 ist->dec_ctx->get_format= get_format;
-#if LIBAVCODEC_VERSION_MAJOR < 60
-AV_NOWARN_DEPRECATED({
-ist->dec_ctx->thread_safe_callbacks = 1;
-})
-#endif
 
 if (ist->dec_ctx->codec_id == AV_CODEC_ID_DVB_SUBTITLE &&
(ist->decoding_needed & DECODING_FOR_OST)) {
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index d8f22f58007..6cf6031705b 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -1512,27 +1512,6 @@ typedef struct AVCodecContext {
  */
 int active_thread_type;
 
-#if FF_API_THREAD_SAFE_CALLBACKS
-/**
- * Set by the client if its custom get_buffer() callback can be called
- * synchronously from another thread, which allows faster multithreaded 
decoding.
- * draw_horiz_band() will be called from other threads regardless of this 
setting.
- * Ignored if the default get_buffer() is used.
- * - encoding: Set by user.
- * - decoding: Set by user.
- *
- * @deprecated the custom get_buffer2() callback should always be
- *   thread-safe. Thread-unsafe get_buffer2() implementations will be
- *   invalid starting with LIBAVCODEC_VERSION_MAJOR=60; in other words,
- *   libavcodec will behave as if this field was always set to 1.
- *   Callers that want to be forward compatible with future libavcodec
- *   versions should wrap access to this field in
- * `#if LIBAVCODEC_VERSION_MAJOR < 60`
- */
-attribute_deprecated
-int thread_safe_callbacks;
-#endif
-
 /**
  * The codec may call this to execute several independent things.
  * It will return only after finishing all tasks.
diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index 45c1f085792..8e790102136 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -1592,19 +1592,6 @@ int ff_decode_preinit(AVCodecContext *avctx)
  * free the already allocated subtitle_header before overwriting it */
 av_freep(>subtitle_header);
 
-#if FF_API_THREAD_SAFE_CALLBACKS
-FF_DISABLE_DEPRECATION_WARNINGS
-if ((avctx->thread_type & FF_THREAD_FRAME) &&
-avctx->get_buffer2 != avcodec_default_get_buffer2 &&
-!avctx->thread_safe_callbacks) {
-av_log(avctx, AV_LOG_WARNING, "Requested frame threading with a "
-   "custom get_buffer2() implementation which is not marked as "
-   "thread safe. This is not supported anymore, make your "
-   "callback thread-safe.\n");
-}
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
-
 if (avctx->codec->max_lowres < avctx->lowres || avctx->lowres < 0) {
 av_log(avctx, AV_LOG_WARNING, "The maximum value for lowres supported 
by the decoder is %d\n",
avctx->codec->max_lowres);
diff --git a/libavcodec/encode.c b/libavcodec/encode.c
index c92beaf8e1f..22407a233df 100644
--- a/libavcodec/encode.c
+++ b/libavcodec/encode.c
@@ -255,10 +255,9 @@ int ff_encode_encode_cb(AVCodecContext *avctx, AVPacket 
*avpkt,
 unref:
 av_packet_unref(avpkt);
 }
-#if !FF_API_THREAD_SAFE_CALLBACKS
+
 if (frame)
 av_frame_unref(frame);
-#endif
 
 return ret;
 }
@@ -299,10 +298,6 @@ static int encode_simple_internal(AVCodecContext *avctx, 
AVPacket *avpkt)
 ret = ff_thread_video_encode_frame(avctx, avpkt, frame, _packet);
 else {
 ret = ff_encode_encode_cb(avctx, avpkt, frame, _packet);
-#if FF_API_THREAD_SAFE_CALLBACKS
-if (frame)
-av_frame_unref(frame);
-#endif
 }
 
 if (avci->draining && !got_packet)
diff --git a/libavcodec/frame_thread_encoder.c 
b/libavcodec/frame_thread_encoder.c
index 35775ae823e..62d9580ad4c 100644
--- a/libavcodec/frame_thread_encoder.c
+++ b/libavcodec/frame_thread_encoder.c
@@ -48,9 +48,6 @@ typedef struct{
 
 typedef struct{
 AVCodecContext *parent_avctx;
-#if FF_API_THREAD_SAFE_CALLBACKS
-pthread_mutex_t buffer_mutex;
-#endif
 
 pthread_mutex_t task_fifo_mutex; /* Used to guard (next_)task_index */
 pthread_cond_t task_fifo_cond;
@@ -70,15 +67,9 @@ typedef struct{
 } ThreadContext;
 
 #define OFF(member) offsetof(ThreadContext, member)
-#if FF_API_THREAD_SAFE_CALLBACKS
-DEFINE_OFFSET_ARRAY(ThreadContext, thread_ctx, 

[FFmpeg-devel] [PATCH v2 17/33] avformat: remove FF_API_LAVF_PRIV_OPT

2023-02-04 Thread Anton Khirnov
From: James Almer 

Signed-off-by: James Almer 
---
 libavformat/avformat.h  | 3 ---
 libavformat/version_major.h | 1 -
 2 files changed, 4 deletions(-)

diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 49e50a5120a..ac40e197f62 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -1242,9 +1242,6 @@ typedef struct AVFormatContext {
  */
 #define AVFMT_FLAG_BITEXACT 0x0400
 #define AVFMT_FLAG_SORT_DTS0x1 ///< try to interleave outputted 
packets by dts (using this flag can slow demuxing down)
-#if FF_API_LAVF_PRIV_OPT
-#define AVFMT_FLAG_PRIV_OPT0x2 ///< Enable use of private options by 
delaying codec open (deprecated, does nothing)
-#endif
 #define AVFMT_FLAG_FAST_SEEK   0x8 ///< Enable fast, but inaccurate seeks 
for some formats
 #define AVFMT_FLAG_SHORTEST   0x10 ///< Stop muxing when the shortest 
stream stops.
 #define AVFMT_FLAG_AUTO_BSF   0x20 ///< Add bitstream filters as requested 
by the muxer
diff --git a/libavformat/version_major.h b/libavformat/version_major.h
index 86af3ee4a5a..abc1699685a 100644
--- a/libavformat/version_major.h
+++ b/libavformat/version_major.h
@@ -41,7 +41,6 @@
  * at once through the bump. This improves the git bisect-ability of the 
change.
  *
  */
-#define FF_API_LAVF_PRIV_OPT(LIBAVFORMAT_VERSION_MAJOR < 60)
 #define FF_API_COMPUTE_PKT_FIELDS2  (LIBAVFORMAT_VERSION_MAJOR < 60)
 #define FF_API_AVIOCONTEXT_WRITTEN  (LIBAVFORMAT_VERSION_MAJOR < 60)
 #define FF_HLS_TS_OPTIONS   (LIBAVFORMAT_VERSION_MAJOR < 60)
-- 
2.35.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v2 07/33] avcodec: remove FF_API_OPENH264_SLICE_MODE

2023-02-04 Thread Anton Khirnov
From: James Almer 

Signed-off-by: James Almer 
---
 libavcodec/libopenh264enc.c | 16 
 libavcodec/version_major.h  |  1 -
 2 files changed, 17 deletions(-)

diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c
index 6934fd481ce..4dd15b0afe5 100644
--- a/libavcodec/libopenh264enc.c
+++ b/libavcodec/libopenh264enc.c
@@ -63,22 +63,6 @@ typedef struct SVCContext {
 #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
 #define DEPRECATED AV_OPT_FLAG_DEPRECATED
 static const AVOption options[] = {
-#if FF_API_OPENH264_SLICE_MODE
-#if OPENH264_VER_AT_LEAST(1, 6)
-{ "slice_mode", "set slice mode, use slices/max_nal_size", 
OFFSET(slice_mode), AV_OPT_TYPE_INT, { .i64 = SM_FIXEDSLCNUM_SLICE }, 
SM_SINGLE_SLICE, SM_RESERVED, VE|DEPRECATED, "slice_mode" },
-#else
-{ "slice_mode", "set slice mode, use slices/max_nal_size", 
OFFSET(slice_mode), AV_OPT_TYPE_INT, { .i64 = SM_AUTO_SLICE }, SM_SINGLE_SLICE, 
SM_RESERVED, VE|DEPRECATED, "slice_mode" },
-#endif
-{ "fixed", "a fixed number of slices", 0, AV_OPT_TYPE_CONST, { .i64 = 
SM_FIXEDSLCNUM_SLICE }, 0, 0, VE, "slice_mode" },
-#if OPENH264_VER_AT_LEAST(1, 6)
-{ "dyn", "Size limited (compatibility name)", 0, AV_OPT_TYPE_CONST, { 
.i64 = SM_SIZELIMITED_SLICE }, 0, 0, VE, "slice_mode" },
-{ "sizelimited", "Size limited", 0, AV_OPT_TYPE_CONST, { .i64 = 
SM_SIZELIMITED_SLICE }, 0, 0, VE, "slice_mode" },
-#else
-{ "rowmb", "one slice per row of macroblocks", 0, AV_OPT_TYPE_CONST, { 
.i64 = SM_ROWMB_SLICE }, 0, 0, VE, "slice_mode" },
-{ "auto", "automatic number of slices according to number of threads", 
0, AV_OPT_TYPE_CONST, { .i64 = SM_AUTO_SLICE }, 0, 0, VE, "slice_mode" },
-{ "dyn", "Dynamic slicing", 0, AV_OPT_TYPE_CONST, { .i64 = 
SM_DYN_SLICE }, 0, 0, VE, "slice_mode" },
-#endif
-#endif
 { "loopfilter", "enable loop filter", OFFSET(loopfilter), AV_OPT_TYPE_INT, 
{ .i64 = 1 }, 0, 1, VE },
 { "profile", "set profile restrictions", OFFSET(profile), AV_OPT_TYPE_INT, 
{ .i64 = FF_PROFILE_UNKNOWN }, FF_PROFILE_UNKNOWN, 0x, VE, "profile" },
 #define PROFILE(name, value)  name, NULL, 0, AV_OPT_TYPE_CONST, { .i64 = value 
}, 0, 0, VE, "profile"
diff --git a/libavcodec/version_major.h b/libavcodec/version_major.h
index 2c0443c4c8e..e9a4910df0d 100644
--- a/libavcodec/version_major.h
+++ b/libavcodec/version_major.h
@@ -37,7 +37,6 @@
  * at once through the bump. This improves the git bisect-ability of the 
change.
  */
 
-#define FF_API_OPENH264_SLICE_MODE (LIBAVCODEC_VERSION_MAJOR < 60)
 #define FF_API_OPENH264_CABAC  (LIBAVCODEC_VERSION_MAJOR < 60)
 #define FF_API_UNUSED_CODEC_CAPS   (LIBAVCODEC_VERSION_MAJOR < 60)
 #define FF_API_THREAD_SAFE_CALLBACKS (LIBAVCODEC_VERSION_MAJOR < 60)
-- 
2.35.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v2 02/33] avformat/avformat: Move codecpar up in AVStream

2023-02-04 Thread Anton Khirnov
From: Andreas Rheinhardt 

It is the most commonly used field and moving it to the start
e.g. allows to encode the offset in a pointer+offset addressing
mode on one byte on x86.

Signed-off-by: Andreas Rheinhardt 
Signed-off-by: Anton Khirnov 
---
 libavformat/avformat.h | 22 +++---
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 53bbc0063f0..a69ee1c575c 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -962,6 +962,17 @@ typedef struct AVStream {
  */
 int id;
 
+/**
+ * Codec parameters associated with this stream. Allocated and freed by
+ * libavformat in avformat_new_stream() and avformat_free_context()
+ * respectively.
+ *
+ * - demuxing: filled by libavformat on stream creation or in
+ * avformat_find_stream_info()
+ * - muxing: filled by the caller before avformat_write_header()
+ */
+AVCodecParameters *codecpar;
+
 void *priv_data;
 
 /**
@@ -1097,17 +1108,6 @@ typedef struct AVStream {
  */
 AVRational r_frame_rate;
 
-/**
- * Codec parameters associated with this stream. Allocated and freed by
- * libavformat in avformat_new_stream() and avformat_free_context()
- * respectively.
- *
- * - demuxing: filled by libavformat on stream creation or in
- * avformat_find_stream_info()
- * - muxing: filled by the caller before avformat_write_header()
- */
-AVCodecParameters *codecpar;
-
 /**
  * Number of bits in timestamps. Used for wrapping control.
  *
-- 
2.35.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v2 01/33] avformat/avformat: Remove AVOutputFormat.data_codec

2023-02-04 Thread Anton Khirnov
From: Andreas Rheinhardt 

No AVOutputFormat has this set.

Signed-off-by: Andreas Rheinhardt 
Signed-off-by: Anton Khirnov 
---
 libavformat/avformat.h  | 1 -
 libavformat/format.c| 2 --
 libavformat/mux_utils.c | 3 +--
 3 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 1d97d56ac58..53bbc0063f0 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -614,7 +614,6 @@ typedef struct AVOutputFormat {
  * @see avdevice_list_devices() for more details.
  */
 int (*get_device_list)(struct AVFormatContext *s, struct AVDeviceInfoList 
*device_list);
-enum AVCodecID data_codec; /**< default data codec */
 /**
  * Initialize format. May allocate data here, and set any AVFormatContext 
or
  * AVStream parameters that need to be set before packets are sent.
diff --git a/libavformat/format.c b/libavformat/format.c
index 4b1f3c2986e..76f25ab5a67 100644
--- a/libavformat/format.c
+++ b/libavformat/format.c
@@ -111,8 +111,6 @@ enum AVCodecID av_guess_codec(const AVOutputFormat *fmt, 
const char *short_name,
 return fmt->audio_codec;
 else if (type == AVMEDIA_TYPE_SUBTITLE)
 return fmt->subtitle_codec;
-else if (type == AVMEDIA_TYPE_DATA)
-return fmt->data_codec;
 else
 return AV_CODEC_ID_NONE;
 }
diff --git a/libavformat/mux_utils.c b/libavformat/mux_utils.c
index 764c834fa2c..55e58ae9d68 100644
--- a/libavformat/mux_utils.c
+++ b/libavformat/mux_utils.c
@@ -51,8 +51,7 @@ int avformat_query_codec(const AVOutputFormat *ofmt, enum 
AVCodecID codec_id,
 return !!av_codec_get_tag2(ofmt->codec_tag, codec_id, _tag);
 else if (codec_id == ofmt->video_codec ||
  codec_id == ofmt->audio_codec ||
- codec_id == ofmt->subtitle_codec ||
- codec_id == ofmt->data_codec)
+ codec_id == ofmt->subtitle_codec)
 return 1;
 }
 return AVERROR_PATCHWELCOME;
-- 
2.35.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v2 04/33] avformat/demux: Avoid stack packet when decoding frame

2023-02-04 Thread Anton Khirnov
From: Andreas Rheinhardt 

Possible now that avcodec_decode_subtitle2() accepts a const AVPacket*.

Signed-off-by: Andreas Rheinhardt 
Signed-off-by: Anton Khirnov 
---
 libavformat/demux.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/libavformat/demux.c b/libavformat/demux.c
index 2dfd82a63ca..ba2991750bc 100644
--- a/libavformat/demux.c
+++ b/libavformat/demux.c
@@ -1984,7 +1984,7 @@ static int has_codec_parameters(const AVStream *st, const 
char **errmsg_ptr)
 
 /* returns 1 or 0 if or if not decoded data was returned, or a negative error 
*/
 static int try_decode_frame(AVFormatContext *s, AVStream *st,
-const AVPacket *avpkt, AVDictionary **options)
+const AVPacket *pkt, AVDictionary **options)
 {
 FFStream *const sti = ffstream(st);
 AVCodecContext *const avctx = sti->avctx;
@@ -1992,9 +1992,9 @@ static int try_decode_frame(AVFormatContext *s, AVStream 
*st,
 int got_picture = 1, ret = 0;
 AVFrame *frame = av_frame_alloc();
 AVSubtitle subtitle;
-AVPacket pkt = *avpkt;
 int do_skip_frame = 0;
 enum AVDiscard skip_frame;
+int pkt_to_send = pkt->size > 0;
 
 if (!frame)
 return AVERROR(ENOMEM);
@@ -2043,7 +2043,7 @@ static int try_decode_frame(AVFormatContext *s, AVStream 
*st,
 avctx->skip_frame = AVDISCARD_ALL;
 }
 
-while ((pkt.size > 0 || (!pkt.data && got_picture)) &&
+while ((pkt_to_send || (!pkt->data && got_picture)) &&
ret >= 0 &&
(!has_codec_parameters(st, NULL) || 
!has_decode_delay_been_guessed(st) ||
 (!sti->codec_info_nb_frames &&
@@ -2051,11 +2051,11 @@ static int try_decode_frame(AVFormatContext *s, 
AVStream *st,
 got_picture = 0;
 if (avctx->codec_type == AVMEDIA_TYPE_VIDEO ||
 avctx->codec_type == AVMEDIA_TYPE_AUDIO) {
-ret = avcodec_send_packet(avctx, );
+ret = avcodec_send_packet(avctx, pkt);
 if (ret < 0 && ret != AVERROR(EAGAIN) && ret != AVERROR_EOF)
 break;
 if (ret >= 0)
-pkt.size = 0;
+pkt_to_send = 0;
 ret = avcodec_receive_frame(avctx, frame);
 if (ret >= 0)
 got_picture = 1;
@@ -2063,11 +2063,11 @@ static int try_decode_frame(AVFormatContext *s, 
AVStream *st,
 ret = 0;
 } else if (avctx->codec_type == AVMEDIA_TYPE_SUBTITLE) {
 ret = avcodec_decode_subtitle2(avctx, ,
-   _picture, );
+   _picture, pkt);
 if (got_picture)
 avsubtitle_free();
 if (ret >= 0)
-pkt.size = 0;
+pkt_to_send = 0;
 }
 if (ret >= 0) {
 if (got_picture)
-- 
2.35.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v2] Major library version bump

2023-02-04 Thread Anton Khirnov
Hi,
James is on vacation, so I'm continuing his work on the bump, with his
agreement.

The consensus from the previous thread was that we do NOT want any
instability period - this set is pushed all at once and the tree is
considered stable immediately after.

I've integrated all the patches submitted to the previous thread, except
for:
* my fifo patches, which as Andreas pointed out do not actually break
  ABI and thus do not need a bump
* the HDR vivid patches which break the API without a deprecation period

If nobody has further comments, I would like to push this soon.

Thanks,
-- 
Anton Khirnov

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v2 2/2] avformat/flvenc: add option to read metadata from file

2023-02-04 Thread Gyan Doshi




On 2023-02-04 04:02 pm, Paul B Mahol wrote:

On 2/4/23, Gyan Doshi  wrote:


On 2023-02-04 03:46 pm, Paul B Mahol wrote:

On 2/4/23, Gyan Doshi  wrote:

On 2023-02-03 09:04 pm, Andreas Rheinhardt wrote:

Gyan Doshi:

Useful, in conjuntion with option meta_period, to vary metadata during
stream.

File format is ffmetadata.
---
configure|   2 +-
doc/muxers.texi  |   3 +
libavformat/flvenc.c | 133
+--
3 files changed, 107 insertions(+), 31 deletions(-)

diff --git a/configure b/configure
index 9d78a244a3..de371632c4 100755
--- a/configure
+++ b/configure
@@ -3433,7 +3433,7 @@ eac3_demuxer_select="ac3_parser"
f4v_muxer_select="mov_muxer"
fifo_muxer_deps="threads"
flac_demuxer_select="flac_parser"
-flv_muxer_select="aac_adtstoasc_bsf"
+flv_muxer_select="aac_adtstoasc_bsf ffmetadata_demuxer"
gxf_muxer_select="pcm_rechunk_bsf"
hds_muxer_select="flv_muxer"
hls_demuxer_select="adts_header ac3_parser"
diff --git a/doc/muxers.texi b/doc/muxers.texi
index 02ecddf186..000c92b2a7 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -555,6 +555,9 @@ With every video packet.
@end table
Note that metadata will always be re-emitted if a metadata update
event
is signalled.

+@item meta_filename
+Specify a ffmetadata file from which to load metadata.
+
@end table

@anchor{framecrc}
diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
index d1c7a493d1..1332b18b41 100644
--- a/libavformat/flvenc.c
+++ b/libavformat/flvenc.c
@@ -122,6 +122,10 @@ typedef struct FLVContext {
double framerate;
AVCodecParameters *data_par;

+char *meta_filename;
+AVFormatContext *meta_ctx;
+AVDictionary *meta_dict;
+
int flags;
int meta_period;
} FLVContext;
@@ -277,6 +281,92 @@ static void put_amf_bool(AVIOContext *pb, int b)
avio_w8(pb, !!b);
}

+static int read_metadata_from_file(AVFormatContext *s, unsigned int
ts,
int header)
+{
+FLVContext *flv = s->priv_data;
+const AVInputFormat *meta_format = NULL;
+AVDictionary *current_meta_dict = NULL;
+float timestamp = ts/1000.f;
+int ret;
+
+if (!flv->meta_filename)
+return 0;
+
+meta_format = av_find_input_format("ffmetadata");
+if (!meta_format) {
+av_log(s, AV_LOG_ERROR, "ffmetadata demuxer not found.\n");
+return AVERROR(ENOSYS);
+}
+
+avformat_close_input(>meta_ctx);
+
+ret = avformat_open_input(>meta_ctx, flv->meta_filename,
meta_format, NULL);
+if (ret < 0) {
+av_log(s, AV_LOG_ERROR, "Failed to read metadata from file %s
t:
%f.", flv->meta_filename, timestamp);
+if (flv->meta_dict)
+av_log(s, AV_LOG_ERROR, " Continuing with old
metadata.");
+av_log(s, AV_LOG_ERROR, "\n");
+return ret;
+}
+
+if (flv->meta_dict) {
+av_dict_copy(_meta_dict, flv->meta_dict, 0);
+av_dict_free(>meta_dict);
+}
+
+ret = av_dict_copy(>meta_dict, flv->meta_ctx->metadata, 0);
+if (ret < 0) {
+av_log(s, AV_LOG_ERROR, "Could not transfer metadata from %s
at
%f seconds. Continuing with old metadata.\n", flv->meta_filename,
timestamp);
+av_dict_free(>meta_dict);
+av_dict_copy(>meta_dict, current_meta_dict, 0);
+av_dict_free(_meta_dict);
+return ret;
+}
+
+av_log(s, AV_LOG_VERBOSE, "Metadata from file %s updated %s at %f
seconds.\n", flv->meta_filename, header ? "in header" : "in video
packet", timestamp);
+av_dict_free(_meta_dict);
+avformat_close_input(>meta_ctx);
+
+return 0;
+}
+
+static int write_user_metadata_tag(AVFormatContext *s,
AVDictionaryEntry
*tag, AVIOContext *pb, int *metadata_count)
+{
+
+av_log(s, AV_LOG_DEBUG, "Writing tag %s with value %s count:
%d\n",
tag->key, tag->value, *metadata_count);
+
+if(   !strcmp(tag->key, "width")
+||!strcmp(tag->key, "height")
+||!strcmp(tag->key, "videodatarate")
+||!strcmp(tag->key, "framerate")
+||!strcmp(tag->key, "videocodecid")
+||!strcmp(tag->key, "audiodatarate")
+||!strcmp(tag->key, "audiosamplerate")
+||!strcmp(tag->key, "audiosamplesize")
+||!strcmp(tag->key, "stereo")
+||!strcmp(tag->key, "audiocodecid")
+||!strcmp(tag->key, "duration")
+||!strcmp(tag->key, "onMetaData")
+||!strcmp(tag->key, "datasize")
+||!strcmp(tag->key, "lasttimestamp")
+||!strcmp(tag->key, "totalframes")
+||!strcmp(tag->key, "hasAudio")
+||!strcmp(tag->key, "hasVideo")
+||!strcmp(tag->key, "hasCuePoints")
+||!strcmp(tag->key, "hasMetadata")
+||!strcmp(tag->key, "hasKeyframes")
+){
+av_log(s, AV_LOG_DEBUG, "Ignoring metadata for %s\n",
tag->key);
+return AVERROR(EINVAL);
+}
+put_amf_string(pb, tag->key);
+avio_w8(pb, AMF_DATA_TYPE_STRING);
+put_amf_string(pb, tag->value);
+(*metadata_count)++;
+
+return 0;

Re: [FFmpeg-devel] [PATCH v2 2/2] avformat/flvenc: add option to read metadata from file

2023-02-04 Thread Paul B Mahol
On 2/4/23, Gyan Doshi  wrote:
>
>
> On 2023-02-04 03:46 pm, Paul B Mahol wrote:
>> On 2/4/23, Gyan Doshi  wrote:
>>>
>>> On 2023-02-03 09:04 pm, Andreas Rheinhardt wrote:
 Gyan Doshi:
> Useful, in conjuntion with option meta_period, to vary metadata during
> stream.
>
> File format is ffmetadata.
> ---
>configure|   2 +-
>doc/muxers.texi  |   3 +
>libavformat/flvenc.c | 133
> +--
>3 files changed, 107 insertions(+), 31 deletions(-)
>
> diff --git a/configure b/configure
> index 9d78a244a3..de371632c4 100755
> --- a/configure
> +++ b/configure
> @@ -3433,7 +3433,7 @@ eac3_demuxer_select="ac3_parser"
>f4v_muxer_select="mov_muxer"
>fifo_muxer_deps="threads"
>flac_demuxer_select="flac_parser"
> -flv_muxer_select="aac_adtstoasc_bsf"
> +flv_muxer_select="aac_adtstoasc_bsf ffmetadata_demuxer"
>gxf_muxer_select="pcm_rechunk_bsf"
>hds_muxer_select="flv_muxer"
>hls_demuxer_select="adts_header ac3_parser"
> diff --git a/doc/muxers.texi b/doc/muxers.texi
> index 02ecddf186..000c92b2a7 100644
> --- a/doc/muxers.texi
> +++ b/doc/muxers.texi
> @@ -555,6 +555,9 @@ With every video packet.
>@end table
>Note that metadata will always be re-emitted if a metadata update
> event
> is signalled.
>
> +@item meta_filename
> +Specify a ffmetadata file from which to load metadata.
> +
>@end table
>
>@anchor{framecrc}
> diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
> index d1c7a493d1..1332b18b41 100644
> --- a/libavformat/flvenc.c
> +++ b/libavformat/flvenc.c
> @@ -122,6 +122,10 @@ typedef struct FLVContext {
>double framerate;
>AVCodecParameters *data_par;
>
> +char *meta_filename;
> +AVFormatContext *meta_ctx;
> +AVDictionary *meta_dict;
> +
>int flags;
>int meta_period;
>} FLVContext;
> @@ -277,6 +281,92 @@ static void put_amf_bool(AVIOContext *pb, int b)
>avio_w8(pb, !!b);
>}
>
> +static int read_metadata_from_file(AVFormatContext *s, unsigned int
> ts,
> int header)
> +{
> +FLVContext *flv = s->priv_data;
> +const AVInputFormat *meta_format = NULL;
> +AVDictionary *current_meta_dict = NULL;
> +float timestamp = ts/1000.f;
> +int ret;
> +
> +if (!flv->meta_filename)
> +return 0;
> +
> +meta_format = av_find_input_format("ffmetadata");
> +if (!meta_format) {
> +av_log(s, AV_LOG_ERROR, "ffmetadata demuxer not found.\n");
> +return AVERROR(ENOSYS);
> +}
> +
> +avformat_close_input(>meta_ctx);
> +
> +ret = avformat_open_input(>meta_ctx, flv->meta_filename,
> meta_format, NULL);
> +if (ret < 0) {
> +av_log(s, AV_LOG_ERROR, "Failed to read metadata from file %s
> t:
> %f.", flv->meta_filename, timestamp);
> +if (flv->meta_dict)
> +av_log(s, AV_LOG_ERROR, " Continuing with old
> metadata.");
> +av_log(s, AV_LOG_ERROR, "\n");
> +return ret;
> +}
> +
> +if (flv->meta_dict) {
> +av_dict_copy(_meta_dict, flv->meta_dict, 0);
> +av_dict_free(>meta_dict);
> +}
> +
> +ret = av_dict_copy(>meta_dict, flv->meta_ctx->metadata, 0);
> +if (ret < 0) {
> +av_log(s, AV_LOG_ERROR, "Could not transfer metadata from %s
> at
> %f seconds. Continuing with old metadata.\n", flv->meta_filename,
> timestamp);
> +av_dict_free(>meta_dict);
> +av_dict_copy(>meta_dict, current_meta_dict, 0);
> +av_dict_free(_meta_dict);
> +return ret;
> +}
> +
> +av_log(s, AV_LOG_VERBOSE, "Metadata from file %s updated %s at %f
> seconds.\n", flv->meta_filename, header ? "in header" : "in video
> packet", timestamp);
> +av_dict_free(_meta_dict);
> +avformat_close_input(>meta_ctx);
> +
> +return 0;
> +}
> +
> +static int write_user_metadata_tag(AVFormatContext *s,
> AVDictionaryEntry
> *tag, AVIOContext *pb, int *metadata_count)
> +{
> +
> +av_log(s, AV_LOG_DEBUG, "Writing tag %s with value %s count:
> %d\n",
> tag->key, tag->value, *metadata_count);
> +
> +if(   !strcmp(tag->key, "width")
> +||!strcmp(tag->key, "height")
> +||!strcmp(tag->key, "videodatarate")
> +||!strcmp(tag->key, "framerate")
> +||!strcmp(tag->key, "videocodecid")
> +||!strcmp(tag->key, "audiodatarate")
> +||!strcmp(tag->key, "audiosamplerate")
> +||!strcmp(tag->key, "audiosamplesize")
> +||!strcmp(tag->key, 

Re: [FFmpeg-devel] [PATCH v2 2/2] avformat/flvenc: add option to read metadata from file

2023-02-04 Thread Gyan Doshi




On 2023-02-04 03:46 pm, Paul B Mahol wrote:

On 2/4/23, Gyan Doshi  wrote:


On 2023-02-03 09:04 pm, Andreas Rheinhardt wrote:

Gyan Doshi:

Useful, in conjuntion with option meta_period, to vary metadata during
stream.

File format is ffmetadata.
---
   configure|   2 +-
   doc/muxers.texi  |   3 +
   libavformat/flvenc.c | 133 +--
   3 files changed, 107 insertions(+), 31 deletions(-)

diff --git a/configure b/configure
index 9d78a244a3..de371632c4 100755
--- a/configure
+++ b/configure
@@ -3433,7 +3433,7 @@ eac3_demuxer_select="ac3_parser"
   f4v_muxer_select="mov_muxer"
   fifo_muxer_deps="threads"
   flac_demuxer_select="flac_parser"
-flv_muxer_select="aac_adtstoasc_bsf"
+flv_muxer_select="aac_adtstoasc_bsf ffmetadata_demuxer"
   gxf_muxer_select="pcm_rechunk_bsf"
   hds_muxer_select="flv_muxer"
   hls_demuxer_select="adts_header ac3_parser"
diff --git a/doc/muxers.texi b/doc/muxers.texi
index 02ecddf186..000c92b2a7 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -555,6 +555,9 @@ With every video packet.
   @end table
   Note that metadata will always be re-emitted if a metadata update event
is signalled.

+@item meta_filename
+Specify a ffmetadata file from which to load metadata.
+
   @end table

   @anchor{framecrc}
diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
index d1c7a493d1..1332b18b41 100644
--- a/libavformat/flvenc.c
+++ b/libavformat/flvenc.c
@@ -122,6 +122,10 @@ typedef struct FLVContext {
   double framerate;
   AVCodecParameters *data_par;

+char *meta_filename;
+AVFormatContext *meta_ctx;
+AVDictionary *meta_dict;
+
   int flags;
   int meta_period;
   } FLVContext;
@@ -277,6 +281,92 @@ static void put_amf_bool(AVIOContext *pb, int b)
   avio_w8(pb, !!b);
   }

+static int read_metadata_from_file(AVFormatContext *s, unsigned int ts,
int header)
+{
+FLVContext *flv = s->priv_data;
+const AVInputFormat *meta_format = NULL;
+AVDictionary *current_meta_dict = NULL;
+float timestamp = ts/1000.f;
+int ret;
+
+if (!flv->meta_filename)
+return 0;
+
+meta_format = av_find_input_format("ffmetadata");
+if (!meta_format) {
+av_log(s, AV_LOG_ERROR, "ffmetadata demuxer not found.\n");
+return AVERROR(ENOSYS);
+}
+
+avformat_close_input(>meta_ctx);
+
+ret = avformat_open_input(>meta_ctx, flv->meta_filename,
meta_format, NULL);
+if (ret < 0) {
+av_log(s, AV_LOG_ERROR, "Failed to read metadata from file %s t:
%f.", flv->meta_filename, timestamp);
+if (flv->meta_dict)
+av_log(s, AV_LOG_ERROR, " Continuing with old metadata.");
+av_log(s, AV_LOG_ERROR, "\n");
+return ret;
+}
+
+if (flv->meta_dict) {
+av_dict_copy(_meta_dict, flv->meta_dict, 0);
+av_dict_free(>meta_dict);
+}
+
+ret = av_dict_copy(>meta_dict, flv->meta_ctx->metadata, 0);
+if (ret < 0) {
+av_log(s, AV_LOG_ERROR, "Could not transfer metadata from %s at
%f seconds. Continuing with old metadata.\n", flv->meta_filename,
timestamp);
+av_dict_free(>meta_dict);
+av_dict_copy(>meta_dict, current_meta_dict, 0);
+av_dict_free(_meta_dict);
+return ret;
+}
+
+av_log(s, AV_LOG_VERBOSE, "Metadata from file %s updated %s at %f
seconds.\n", flv->meta_filename, header ? "in header" : "in video
packet", timestamp);
+av_dict_free(_meta_dict);
+avformat_close_input(>meta_ctx);
+
+return 0;
+}
+
+static int write_user_metadata_tag(AVFormatContext *s, AVDictionaryEntry
*tag, AVIOContext *pb, int *metadata_count)
+{
+
+av_log(s, AV_LOG_DEBUG, "Writing tag %s with value %s count: %d\n",
tag->key, tag->value, *metadata_count);
+
+if(   !strcmp(tag->key, "width")
+||!strcmp(tag->key, "height")
+||!strcmp(tag->key, "videodatarate")
+||!strcmp(tag->key, "framerate")
+||!strcmp(tag->key, "videocodecid")
+||!strcmp(tag->key, "audiodatarate")
+||!strcmp(tag->key, "audiosamplerate")
+||!strcmp(tag->key, "audiosamplesize")
+||!strcmp(tag->key, "stereo")
+||!strcmp(tag->key, "audiocodecid")
+||!strcmp(tag->key, "duration")
+||!strcmp(tag->key, "onMetaData")
+||!strcmp(tag->key, "datasize")
+||!strcmp(tag->key, "lasttimestamp")
+||!strcmp(tag->key, "totalframes")
+||!strcmp(tag->key, "hasAudio")
+||!strcmp(tag->key, "hasVideo")
+||!strcmp(tag->key, "hasCuePoints")
+||!strcmp(tag->key, "hasMetadata")
+||!strcmp(tag->key, "hasKeyframes")
+){
+av_log(s, AV_LOG_DEBUG, "Ignoring metadata for %s\n",
tag->key);
+return AVERROR(EINVAL);
+}
+put_amf_string(pb, tag->key);
+avio_w8(pb, AMF_DATA_TYPE_STRING);
+put_amf_string(pb, tag->value);
+(*metadata_count)++;
+
+return 0;
+}
+
   static void write_metadata(AVFormatContext *s, unsigned int ts)
   {
   AVIOContext 

Re: [FFmpeg-devel] [PATCH v2 2/2] avformat/flvenc: add option to read metadata from file

2023-02-04 Thread Paul B Mahol
On 2/4/23, Gyan Doshi  wrote:
>
>
> On 2023-02-03 09:04 pm, Andreas Rheinhardt wrote:
>> Gyan Doshi:
>>> Useful, in conjuntion with option meta_period, to vary metadata during
>>> stream.
>>>
>>> File format is ffmetadata.
>>> ---
>>>   configure|   2 +-
>>>   doc/muxers.texi  |   3 +
>>>   libavformat/flvenc.c | 133 +--
>>>   3 files changed, 107 insertions(+), 31 deletions(-)
>>>
>>> diff --git a/configure b/configure
>>> index 9d78a244a3..de371632c4 100755
>>> --- a/configure
>>> +++ b/configure
>>> @@ -3433,7 +3433,7 @@ eac3_demuxer_select="ac3_parser"
>>>   f4v_muxer_select="mov_muxer"
>>>   fifo_muxer_deps="threads"
>>>   flac_demuxer_select="flac_parser"
>>> -flv_muxer_select="aac_adtstoasc_bsf"
>>> +flv_muxer_select="aac_adtstoasc_bsf ffmetadata_demuxer"
>>>   gxf_muxer_select="pcm_rechunk_bsf"
>>>   hds_muxer_select="flv_muxer"
>>>   hls_demuxer_select="adts_header ac3_parser"
>>> diff --git a/doc/muxers.texi b/doc/muxers.texi
>>> index 02ecddf186..000c92b2a7 100644
>>> --- a/doc/muxers.texi
>>> +++ b/doc/muxers.texi
>>> @@ -555,6 +555,9 @@ With every video packet.
>>>   @end table
>>>   Note that metadata will always be re-emitted if a metadata update event
>>> is signalled.
>>>
>>> +@item meta_filename
>>> +Specify a ffmetadata file from which to load metadata.
>>> +
>>>   @end table
>>>
>>>   @anchor{framecrc}
>>> diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
>>> index d1c7a493d1..1332b18b41 100644
>>> --- a/libavformat/flvenc.c
>>> +++ b/libavformat/flvenc.c
>>> @@ -122,6 +122,10 @@ typedef struct FLVContext {
>>>   double framerate;
>>>   AVCodecParameters *data_par;
>>>
>>> +char *meta_filename;
>>> +AVFormatContext *meta_ctx;
>>> +AVDictionary *meta_dict;
>>> +
>>>   int flags;
>>>   int meta_period;
>>>   } FLVContext;
>>> @@ -277,6 +281,92 @@ static void put_amf_bool(AVIOContext *pb, int b)
>>>   avio_w8(pb, !!b);
>>>   }
>>>
>>> +static int read_metadata_from_file(AVFormatContext *s, unsigned int ts,
>>> int header)
>>> +{
>>> +FLVContext *flv = s->priv_data;
>>> +const AVInputFormat *meta_format = NULL;
>>> +AVDictionary *current_meta_dict = NULL;
>>> +float timestamp = ts/1000.f;
>>> +int ret;
>>> +
>>> +if (!flv->meta_filename)
>>> +return 0;
>>> +
>>> +meta_format = av_find_input_format("ffmetadata");
>>> +if (!meta_format) {
>>> +av_log(s, AV_LOG_ERROR, "ffmetadata demuxer not found.\n");
>>> +return AVERROR(ENOSYS);
>>> +}
>>> +
>>> +avformat_close_input(>meta_ctx);
>>> +
>>> +ret = avformat_open_input(>meta_ctx, flv->meta_filename,
>>> meta_format, NULL);
>>> +if (ret < 0) {
>>> +av_log(s, AV_LOG_ERROR, "Failed to read metadata from file %s t:
>>> %f.", flv->meta_filename, timestamp);
>>> +if (flv->meta_dict)
>>> +av_log(s, AV_LOG_ERROR, " Continuing with old metadata.");
>>> +av_log(s, AV_LOG_ERROR, "\n");
>>> +return ret;
>>> +}
>>> +
>>> +if (flv->meta_dict) {
>>> +av_dict_copy(_meta_dict, flv->meta_dict, 0);
>>> +av_dict_free(>meta_dict);
>>> +}
>>> +
>>> +ret = av_dict_copy(>meta_dict, flv->meta_ctx->metadata, 0);
>>> +if (ret < 0) {
>>> +av_log(s, AV_LOG_ERROR, "Could not transfer metadata from %s at
>>> %f seconds. Continuing with old metadata.\n", flv->meta_filename,
>>> timestamp);
>>> +av_dict_free(>meta_dict);
>>> +av_dict_copy(>meta_dict, current_meta_dict, 0);
>>> +av_dict_free(_meta_dict);
>>> +return ret;
>>> +}
>>> +
>>> +av_log(s, AV_LOG_VERBOSE, "Metadata from file %s updated %s at %f
>>> seconds.\n", flv->meta_filename, header ? "in header" : "in video
>>> packet", timestamp);
>>> +av_dict_free(_meta_dict);
>>> +avformat_close_input(>meta_ctx);
>>> +
>>> +return 0;
>>> +}
>>> +
>>> +static int write_user_metadata_tag(AVFormatContext *s, AVDictionaryEntry
>>> *tag, AVIOContext *pb, int *metadata_count)
>>> +{
>>> +
>>> +av_log(s, AV_LOG_DEBUG, "Writing tag %s with value %s count: %d\n",
>>> tag->key, tag->value, *metadata_count);
>>> +
>>> +if(   !strcmp(tag->key, "width")
>>> +||!strcmp(tag->key, "height")
>>> +||!strcmp(tag->key, "videodatarate")
>>> +||!strcmp(tag->key, "framerate")
>>> +||!strcmp(tag->key, "videocodecid")
>>> +||!strcmp(tag->key, "audiodatarate")
>>> +||!strcmp(tag->key, "audiosamplerate")
>>> +||!strcmp(tag->key, "audiosamplesize")
>>> +||!strcmp(tag->key, "stereo")
>>> +||!strcmp(tag->key, "audiocodecid")
>>> +||!strcmp(tag->key, "duration")
>>> +||!strcmp(tag->key, "onMetaData")
>>> +||!strcmp(tag->key, "datasize")
>>> +||!strcmp(tag->key, "lasttimestamp")
>>> +||!strcmp(tag->key, "totalframes")
>>> +||!strcmp(tag->key, "hasAudio")
>>> +||!strcmp(tag->key, "hasVideo")
>>> +||!strcmp(tag->key, 

Re: [FFmpeg-devel] [PATCH v2 2/2] avformat/flvenc: add option to read metadata from file

2023-02-04 Thread Gyan Doshi




On 2023-02-03 09:04 pm, Andreas Rheinhardt wrote:

Gyan Doshi:

Useful, in conjuntion with option meta_period, to vary metadata during
stream.

File format is ffmetadata.
---
  configure|   2 +-
  doc/muxers.texi  |   3 +
  libavformat/flvenc.c | 133 +--
  3 files changed, 107 insertions(+), 31 deletions(-)

diff --git a/configure b/configure
index 9d78a244a3..de371632c4 100755
--- a/configure
+++ b/configure
@@ -3433,7 +3433,7 @@ eac3_demuxer_select="ac3_parser"
  f4v_muxer_select="mov_muxer"
  fifo_muxer_deps="threads"
  flac_demuxer_select="flac_parser"
-flv_muxer_select="aac_adtstoasc_bsf"
+flv_muxer_select="aac_adtstoasc_bsf ffmetadata_demuxer"
  gxf_muxer_select="pcm_rechunk_bsf"
  hds_muxer_select="flv_muxer"
  hls_demuxer_select="adts_header ac3_parser"
diff --git a/doc/muxers.texi b/doc/muxers.texi
index 02ecddf186..000c92b2a7 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -555,6 +555,9 @@ With every video packet.
  @end table
  Note that metadata will always be re-emitted if a metadata update event is 
signalled.
  
+@item meta_filename

+Specify a ffmetadata file from which to load metadata.
+
  @end table
  
  @anchor{framecrc}

diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
index d1c7a493d1..1332b18b41 100644
--- a/libavformat/flvenc.c
+++ b/libavformat/flvenc.c
@@ -122,6 +122,10 @@ typedef struct FLVContext {
  double framerate;
  AVCodecParameters *data_par;
  
+char *meta_filename;

+AVFormatContext *meta_ctx;
+AVDictionary *meta_dict;
+
  int flags;
  int meta_period;
  } FLVContext;
@@ -277,6 +281,92 @@ static void put_amf_bool(AVIOContext *pb, int b)
  avio_w8(pb, !!b);
  }
  
+static int read_metadata_from_file(AVFormatContext *s, unsigned int ts, int header)

+{
+FLVContext *flv = s->priv_data;
+const AVInputFormat *meta_format = NULL;
+AVDictionary *current_meta_dict = NULL;
+float timestamp = ts/1000.f;
+int ret;
+
+if (!flv->meta_filename)
+return 0;
+
+meta_format = av_find_input_format("ffmetadata");
+if (!meta_format) {
+av_log(s, AV_LOG_ERROR, "ffmetadata demuxer not found.\n");
+return AVERROR(ENOSYS);
+}
+
+avformat_close_input(>meta_ctx);
+
+ret = avformat_open_input(>meta_ctx, flv->meta_filename, meta_format, 
NULL);
+if (ret < 0) {
+av_log(s, AV_LOG_ERROR, "Failed to read metadata from file %s t: %f.", 
flv->meta_filename, timestamp);
+if (flv->meta_dict)
+av_log(s, AV_LOG_ERROR, " Continuing with old metadata.");
+av_log(s, AV_LOG_ERROR, "\n");
+return ret;
+}
+
+if (flv->meta_dict) {
+av_dict_copy(_meta_dict, flv->meta_dict, 0);
+av_dict_free(>meta_dict);
+}
+
+ret = av_dict_copy(>meta_dict, flv->meta_ctx->metadata, 0);
+if (ret < 0) {
+av_log(s, AV_LOG_ERROR, "Could not transfer metadata from %s at %f seconds. 
Continuing with old metadata.\n", flv->meta_filename, timestamp);
+av_dict_free(>meta_dict);
+av_dict_copy(>meta_dict, current_meta_dict, 0);
+av_dict_free(_meta_dict);
+return ret;
+}
+
+av_log(s, AV_LOG_VERBOSE, "Metadata from file %s updated %s at %f seconds.\n", 
flv->meta_filename, header ? "in header" : "in video packet", timestamp);
+av_dict_free(_meta_dict);
+avformat_close_input(>meta_ctx);
+
+return 0;
+}
+
+static int write_user_metadata_tag(AVFormatContext *s, AVDictionaryEntry *tag, 
AVIOContext *pb, int *metadata_count)
+{
+
+av_log(s, AV_LOG_DEBUG, "Writing tag %s with value %s count: %d\n", tag->key, 
tag->value, *metadata_count);
+
+if(   !strcmp(tag->key, "width")
+||!strcmp(tag->key, "height")
+||!strcmp(tag->key, "videodatarate")
+||!strcmp(tag->key, "framerate")
+||!strcmp(tag->key, "videocodecid")
+||!strcmp(tag->key, "audiodatarate")
+||!strcmp(tag->key, "audiosamplerate")
+||!strcmp(tag->key, "audiosamplesize")
+||!strcmp(tag->key, "stereo")
+||!strcmp(tag->key, "audiocodecid")
+||!strcmp(tag->key, "duration")
+||!strcmp(tag->key, "onMetaData")
+||!strcmp(tag->key, "datasize")
+||!strcmp(tag->key, "lasttimestamp")
+||!strcmp(tag->key, "totalframes")
+||!strcmp(tag->key, "hasAudio")
+||!strcmp(tag->key, "hasVideo")
+||!strcmp(tag->key, "hasCuePoints")
+||!strcmp(tag->key, "hasMetadata")
+||!strcmp(tag->key, "hasKeyframes")
+){
+av_log(s, AV_LOG_DEBUG, "Ignoring metadata for %s\n", tag->key);
+return AVERROR(EINVAL);
+}
+put_amf_string(pb, tag->key);
+avio_w8(pb, AMF_DATA_TYPE_STRING);
+put_amf_string(pb, tag->value);
+(*metadata_count)++;
+
+return 0;
+}
+
  static void write_metadata(AVFormatContext *s, unsigned int ts)
  {
  AVIOContext *pb = s->pb;
@@ -360,36 +450,11 @@ static void write_metadata(AVFormatContext *s, 

[FFmpeg-devel] [PATCH v2] avcodec/h264_metadata_bsf: remove AUDs at any position

2023-02-04 Thread Gyan Doshi
Some files, likely due to faulty packetization or muxing, can have AUDs
at other positions besides the head unit of a packet. Remove these too.
---
 libavcodec/h264_metadata_bsf.c | 13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/libavcodec/h264_metadata_bsf.c b/libavcodec/h264_metadata_bsf.c
index d318bf0cee..b9cfeaba94 100644
--- a/libavcodec/h264_metadata_bsf.c
+++ b/libavcodec/h264_metadata_bsf.c
@@ -469,12 +469,13 @@ static int h264_metadata_update_fragment(AVBSFContext 
*bsf, AVPacket *pkt,
 H264MetadataContext *ctx = bsf->priv_data;
 int err, i, has_sps, seek_point;
 
-// If an AUD is present, it must be the first NAL unit.
-if (au->nb_units && au->units[0].type == H264_NAL_AUD) {
-if (ctx->aud == BSF_ELEMENT_REMOVE)
-ff_cbs_delete_unit(au, 0);
-} else {
-if (pkt && ctx->aud == BSF_ELEMENT_INSERT) {
+if (ctx->aud == BSF_ELEMENT_REMOVE) {
+for (i = au->nb_units - 1; i >= 0; i--) {
+if (au->units[i].type == H264_NAL_AUD)
+ff_cbs_delete_unit(au, i);
+}
+} else if (ctx->aud == BSF_ELEMENT_INSERT) {
+if (pkt) {
 err = h264_metadata_insert_aud(bsf, au);
 if (err < 0)
 return err;
-- 
2.39.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH] avformat/tee: signal EOF if no more output is to be published.

2023-02-04 Thread Gyan Doshi




On 2023-02-03 02:02 pm, Marton Balint wrote:



Any av_interleaved_write_frame() negative return value is an error, 
ffmpeg should abort. It seems that there is a clash of error codes in 
sync_queue_process which returns AVERROR_EOF to signal sq_send EOF 
return, but that clashes with the AVERROR_EOF of 
av_interleaved_write_frame(), so the error condition is lost.


New patch sent.

Note that the behaviour since 2d924b3a630 is to terminate only that 
muxer's thread, which I haven't changed. I think this is preferable to 
runtime abortion.


Regards,
Gyan

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH] ffmpeg_mux: terminate stream thread queue only on sq_send EOF

2023-02-04 Thread Gyan Doshi
Prior to 2d924b3a630, ffmpeg would exit if any packet write failed.
After the switch to threaded mode for muxing, ffmpeg only closes that
OutputStream instead of closng the file. This happens because EOF
returned by write_packet isn't distinguished from EOF returned by sq_send,
both relayed via sync_queue_process.

This breaks the abort behaviour when there are multiple streams in an output,
and can leave the ffmpeg process running beyond the intended point of abortion.

Fixed by marking the OutputStream as finished upon sq_send EOF and letting
write_packet EOF lead to muxer termination.
---
 fftools/ffmpeg_mux.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/fftools/ffmpeg_mux.c b/fftools/ffmpeg_mux.c
index 5d427b44ea..b40a2d01a7 100644
--- a/fftools/ffmpeg_mux.c
+++ b/fftools/ffmpeg_mux.c
@@ -160,8 +160,12 @@ static int sync_queue_process(Muxer *mux, OutputStream 
*ost, AVPacket *pkt)
 
 if (ost->sq_idx_mux >= 0) {
 int ret = sq_send(mux->sq_mux, ost->sq_idx_mux, SQPKT(pkt));
-if (ret < 0)
+if (ret < 0) {
+if (ret == AVERROR_EOF)
+ost->finished |= ENCODER_FINISHED;
 return ret;
+}
+
 
 while (1) {
 ret = sq_receive(mux->sq_mux, -1, SQPKT(mux->sq_pkt));
@@ -215,7 +219,7 @@ static void *muxer_thread(void *arg)
 ost = of->streams[stream_idx];
 ret = sync_queue_process(mux, ost, ret < 0 ? NULL : pkt);
 av_packet_unref(pkt);
-if (ret == AVERROR_EOF)
+if (ret == AVERROR_EOF && ost->finished)
 tq_receive_finish(mux->tq, stream_idx);
 else if (ret < 0) {
 av_log(mux, AV_LOG_ERROR, "Error muxing a packet\n");
-- 
2.39.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [RFC][WIP][PATCH] RK Audio demuxer and decoder

2023-02-04 Thread Paul B Mahol
Hi,

Patches attached, decoder is not bit by bit exact yet for lossless
mode because some samples are not properly rounded.
From 71bfdb9eadc988b1154f8202b12a380839096d48 Mon Sep 17 00:00:00 2001
From: Paul B Mahol 
Date: Tue, 31 Jan 2023 19:27:09 +0100
Subject: [PATCH 1/2] avformat: add RKA demuxer

Signed-off-by: Paul B Mahol 
---
 libavformat/Makefile |   1 +
 libavformat/allformats.c |   1 +
 libavformat/rka.c| 170 +++
 3 files changed, 172 insertions(+)
 create mode 100644 libavformat/rka.c

diff --git a/libavformat/Makefile b/libavformat/Makefile
index f0408a58b1..28cbf91382 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -482,6 +482,7 @@ OBJS-$(CONFIG_RAWVIDEO_DEMUXER)  += rawvideodec.o
 OBJS-$(CONFIG_RAWVIDEO_MUXER)+= rawenc.o
 OBJS-$(CONFIG_REALTEXT_DEMUXER)  += realtextdec.o subtitles.o
 OBJS-$(CONFIG_REDSPARK_DEMUXER)  += redspark.o
+OBJS-$(CONFIG_RKA_DEMUXER)   += rka.o
 OBJS-$(CONFIG_RL2_DEMUXER)   += rl2.o
 OBJS-$(CONFIG_RM_DEMUXER)+= rmdec.o rm.o rmsipr.o
 OBJS-$(CONFIG_RM_MUXER)  += rmenc.o rm.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index 9ca8d2692f..4903bf7f9d 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -380,6 +380,7 @@ extern const AVInputFormat  ff_rawvideo_demuxer;
 extern const AVOutputFormat ff_rawvideo_muxer;
 extern const AVInputFormat  ff_realtext_demuxer;
 extern const AVInputFormat  ff_redspark_demuxer;
+extern const AVInputFormat  ff_rka_demuxer;
 extern const AVInputFormat  ff_rl2_demuxer;
 extern const AVInputFormat  ff_rm_demuxer;
 extern const AVOutputFormat ff_rm_muxer;
diff --git a/libavformat/rka.c b/libavformat/rka.c
new file mode 100644
index 00..0f670a89a3
--- /dev/null
+++ b/libavformat/rka.c
@@ -0,0 +1,170 @@
+/*
+ * RKA demuxer
+ * Copyright (c) 2023 Paul B Mahol
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/dict.h"
+#include "libavutil/intreadwrite.h"
+
+#include "apetag.h"
+#include "avformat.h"
+#include "avio_internal.h"
+#include "demux.h"
+#include "internal.h"
+
+typedef struct RKAContext {
+int total_frames, currentframe;
+int frame_size;
+int last_frame_size;
+} RKAContext;
+
+static int rka_probe(const AVProbeData *p)
+{
+if (AV_RL32(>buf[0]) == MKTAG('R', 'K', 'A', '7') &&
+AV_RL32(>buf[4]) > 0 &&
+AV_RL32(>buf[8]) > 0 &&
+p->buf[12] > 0 &&
+p->buf[12] <= 2 &&
+(p->buf[13] == 8 || p->buf[13] == 16) &&
+p->buf[15] & 2 != 0)
+return AVPROBE_SCORE_EXTENSION + 30;
+return 0;
+}
+
+static int rka_read_header(AVFormatContext *s)
+{
+int64_t nb_samples, size_offset;
+RKAContext *c = s->priv_data;
+int channels, bps, samplerate;
+AVCodecParameters *par;
+int64_t framepos;
+AVStream *st;
+int ret;
+
+st = avformat_new_stream(s, NULL);
+if (!st)
+return AVERROR(ENOMEM);
+
+par = st->codecpar;
+ret = ff_get_extradata(s, par, s->pb, 16);
+if (ret < 0)
+return ret;
+
+nb_samples = AV_RL32(par->extradata + 4);
+samplerate = AV_RL32(par->extradata + 8);
+channels = par->extradata[12];
+if (channels == 0)
+return AVERROR_INVALIDDATA;
+bps = par->extradata[13];
+if (bps == 0)
+return AVERROR_INVALIDDATA;
+size_offset = avio_rl32(s->pb);
+framepos = avio_tell(s->pb);
+c->frame_size = 131072;
+
+avpriv_set_pts_info(st, 64, 1, samplerate);
+st->start_time = 0;
+
+avio_seek(s->pb, size_offset, SEEK_SET);
+c->total_frames = (nb_samples + c->frame_size - 1) / c->frame_size;
+c->last_frame_size = nb_samples % c->frame_size;
+
+for (int i = 0; i < c->total_frames; i++) {
+int r, end = 0;
+int64_t size;
+
+if (avio_feof(s->pb))
+break;
+
+size = avio_rl24(s->pb);
+if (size == 0) {
+end = 1;
+size = size_offset - framepos;
+if (size <= 0)
+break;
+}
+
+if ((r = av_add_index_entry(st, framepos, (i * 131072LL) / (channels * (bps >> 3)),
+size, 0,