Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH 1/5] avcodec/avcodec: Move AV_ER_* and FF_COMPLIANCE_* to defs.h
@ 2022-09-21  1:30 Andreas Rheinhardt
  2022-09-21  1:34 ` [FFmpeg-devel] [PATCH 2/5] avutil/pixdesc: Add av_chroma_location_(enum_to_pos|pos_to_enum) Andreas Rheinhardt
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Andreas Rheinhardt @ 2022-09-21  1:30 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Andreas Rheinhardt

They are also frequently used in libavformat.
This change does not cause any breakage as avcodec.h
includes defs.h.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 doc/APIchanges       |  3 +++
 libavcodec/avcodec.h | 25 +++----------------------
 libavcodec/defs.h    | 22 ++++++++++++++++++++++
 libavcodec/version.h |  2 +-
 4 files changed, 29 insertions(+), 23 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 729f56be7b..cb7592bb64 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -14,6 +14,9 @@ libavutil:     2021-04-27
 
 API changes, most recent first:
 
+2022-09-21 - xxxxxxxxxx - lavc 59.45.100 - avcodec.h defs.h
+  Move the AV_EF_* and FF_COMPLIANCE_* defines from avcodec.h to defs.h.
+
 2022-09-03 - xxxxxxxxxx - lavu 57.36.100 - pixfmt.h
   Add AV_PIX_FMT_P012, AV_PIX_FMT_Y212, AV_PIX_FMT_XV30, AV_PIX_FMT_XV36
 
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 7db5d1b1c5..0769577338 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -1305,13 +1305,9 @@ typedef struct AVCodecContext {
      * unofficial and experimental (that is, they always try to decode things
      * when they can) unless they are explicitly asked to behave stupidly
      * (=strictly conform to the specs)
+     * This may only be set to one of the FF_COMPLIANCE_* values in defs.h.
      */
     int strict_std_compliance;
-#define FF_COMPLIANCE_VERY_STRICT   2 ///< Strictly conform to an older more strict version of the spec or reference software.
-#define FF_COMPLIANCE_STRICT        1 ///< Strictly conform to all the things in the spec no matter what consequences.
-#define FF_COMPLIANCE_NORMAL        0
-#define FF_COMPLIANCE_UNOFFICIAL   -1 ///< Allow unofficial extensions
-#define FF_COMPLIANCE_EXPERIMENTAL -2 ///< Allow nonstandardized experimental things.
 
     /**
      * error concealment flags
@@ -1347,28 +1343,13 @@ typedef struct AVCodecContext {
 
     /**
      * Error recognition; may misdetect some more or less valid parts as errors.
+     * This is a bitfield of the AV_EF_* values defined in defs.h.
+     *
      * - encoding: Set by user.
      * - decoding: Set by user.
      */
     int err_recognition;
 
-/**
- * Verify checksums embedded in the bitstream (could be of either encoded or
- * decoded data, depending on the codec) and print an error message on mismatch.
- * If AV_EF_EXPLODE is also set, a mismatching checksum will result in the
- * decoder returning an error.
- */
-#define AV_EF_CRCCHECK  (1<<0)
-#define AV_EF_BITSTREAM (1<<1)          ///< detect bitstream specification deviations
-#define AV_EF_BUFFER    (1<<2)          ///< detect improper bitstream length
-#define AV_EF_EXPLODE   (1<<3)          ///< abort decoding on minor error detection
-
-#define AV_EF_IGNORE_ERR (1<<15)        ///< ignore errors and continue
-#define AV_EF_CAREFUL    (1<<16)        ///< consider things that violate the spec, are fast to calculate and have not been seen in the wild as errors
-#define AV_EF_COMPLIANT  (1<<17)        ///< consider all spec non compliances as errors
-#define AV_EF_AGGRESSIVE (1<<18)        ///< consider things that a sane encoder should not do as an error
-
-
     /**
      * opaque 64-bit number (generally a PTS) that will be reordered and
      * output in AVFrame.reordered_opaque
diff --git a/libavcodec/defs.h b/libavcodec/defs.h
index 420a042b8f..fbe3254db2 100644
--- a/libavcodec/defs.h
+++ b/libavcodec/defs.h
@@ -39,6 +39,28 @@
  */
 #define AV_INPUT_BUFFER_PADDING_SIZE 64
 
+/**
+ * Verify checksums embedded in the bitstream (could be of either encoded or
+ * decoded data, depending on the format) and print an error message on mismatch.
+ * If AV_EF_EXPLODE is also set, a mismatching checksum will result in the
+ * decoder/demuxer returning an error.
+ */
+#define AV_EF_CRCCHECK       (1<<0)
+#define AV_EF_BITSTREAM      (1<<1)   ///< detect bitstream specification deviations
+#define AV_EF_BUFFER         (1<<2)   ///< detect improper bitstream length
+#define AV_EF_EXPLODE        (1<<3)   ///< abort decoding on minor error detection
+
+#define AV_EF_IGNORE_ERR     (1<<15)  ///< ignore errors and continue
+#define AV_EF_CAREFUL        (1<<16)  ///< consider things that violate the spec, are fast to calculate and have not been seen in the wild as errors
+#define AV_EF_COMPLIANT      (1<<17)  ///< consider all spec non compliances as errors
+#define AV_EF_AGGRESSIVE     (1<<18)  ///< consider things that a sane encoder/muxer should not do as an error
+
+#define FF_COMPLIANCE_VERY_STRICT   2 ///< Strictly conform to an older more strict version of the spec or reference software.
+#define FF_COMPLIANCE_STRICT        1 ///< Strictly conform to all the things in the spec no matter what consequences.
+#define FF_COMPLIANCE_NORMAL        0
+#define FF_COMPLIANCE_UNOFFICIAL   -1 ///< Allow unofficial extensions
+#define FF_COMPLIANCE_EXPERIMENTAL -2 ///< Allow nonstandardized experimental things.
+
 /**
  * @ingroup lavc_decoding
  */
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 2cad78e640..a3441795e0 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@
 
 #include "version_major.h"
 
-#define LIBAVCODEC_VERSION_MINOR  44
+#define LIBAVCODEC_VERSION_MINOR  45
 #define LIBAVCODEC_VERSION_MICRO 100
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
-- 
2.34.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-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [FFmpeg-devel] [PATCH 2/5] avutil/pixdesc: Add av_chroma_location_(enum_to_pos|pos_to_enum)
  2022-09-21  1:30 [FFmpeg-devel] [PATCH 1/5] avcodec/avcodec: Move AV_ER_* and FF_COMPLIANCE_* to defs.h Andreas Rheinhardt
@ 2022-09-21  1:34 ` Andreas Rheinhardt
  2022-09-25  0:09   ` Andreas Rheinhardt
  2022-09-21  1:35 ` [FFmpeg-devel] [PATCH 3/5] avformat/matroska*: Use av_chroma_location_(pos_to_enum|enum_to_pos) Andreas Rheinhardt
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 6+ messages in thread
From: Andreas Rheinhardt @ 2022-09-21  1:34 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Andreas Rheinhardt

They are intended as replacements for avcodec_enum_to_chroma_pos()
and avcodec_chroma_pos_to_enum().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
Will add version bump upon applying.
(Honestly, I am not sure whether there is a need for a replacement
given that Matroska seems to be the only user of this.)

 doc/APIchanges      |  3 +++
 libavutil/pixdesc.c | 23 +++++++++++++++++++++++
 libavutil/pixdesc.h | 22 ++++++++++++++++++++++
 3 files changed, 48 insertions(+)

diff --git a/doc/APIchanges b/doc/APIchanges
index cb7592bb64..8ead37dcbb 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -14,6 +14,9 @@ libavutil:     2021-04-27
 
 API changes, most recent first:
 
+2022-09-21 - xxxxxxxxxx - lavu 57.xx.100 - pixdesc.h
+  Add av_chroma_location_enum_to_pos() and av_chroma_location_pos_to_enum().
+
 2022-09-21 - xxxxxxxxxx - lavc 59.45.100 - avcodec.h defs.h
   Move the AV_EF_* and FF_COMPLIANCE_* defines from avcodec.h to defs.h.
 
diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index b472a94f60..9cd95f1450 100644
--- a/libavutil/pixdesc.c
+++ b/libavutil/pixdesc.c
@@ -3262,3 +3262,26 @@ int av_chroma_location_from_name(const char *name)
 
     return AVERROR(EINVAL);
 }
+
+int av_chroma_location_enum_to_pos(int *xpos, int *ypos, enum AVChromaLocation pos)
+{
+    if (pos <= AVCHROMA_LOC_UNSPECIFIED || pos >= AVCHROMA_LOC_NB)
+        return AVERROR(EINVAL);
+    pos--;
+
+    *xpos = (pos&1) * 128;
+    *ypos = ((pos>>1)^(pos<4)) * 128;
+
+    return 0;
+}
+
+enum AVChromaLocation av_chroma_location_pos_to_enum(int xpos, int ypos)
+{
+    int pos, xout, yout;
+
+    for (pos = AVCHROMA_LOC_UNSPECIFIED + 1; pos < AVCHROMA_LOC_NB; pos++) {
+        if (av_chroma_location_enum_to_pos(&xout, &yout, pos) == 0 && xout == xpos && yout == ypos)
+            return pos;
+    }
+    return AVCHROMA_LOC_UNSPECIFIED;
+}
diff --git a/libavutil/pixdesc.h b/libavutil/pixdesc.h
index 48d9300bfe..0df73e6efe 100644
--- a/libavutil/pixdesc.h
+++ b/libavutil/pixdesc.h
@@ -264,6 +264,28 @@ const char *av_chroma_location_name(enum AVChromaLocation location);
  */
 int av_chroma_location_from_name(const char *name);
 
+/**
+ * Converts AVChromaLocation to swscale x/y chroma position.
+ *
+ * The positions represent the chroma (0,0) position in a coordinates system
+ * with luma (0,0) representing the origin and luma(1,1) representing 256,256
+ *
+ * @param xpos  horizontal chroma sample position
+ * @param ypos  vertical   chroma sample position
+ */
+int av_chroma_location_enum_to_pos(int *xpos, int *ypos, enum AVChromaLocation pos);
+
+/**
+ * Converts swscale x/y chroma position to AVChromaLocation.
+ *
+ * The positions represent the chroma (0,0) position in a coordinates system
+ * with luma (0,0) representing the origin and luma(1,1) representing 256,256
+ *
+ * @param xpos  horizontal chroma sample position
+ * @param ypos  vertical   chroma sample position
+ */
+enum AVChromaLocation av_chroma_location_pos_to_enum(int xpos, int ypos);
+
 /**
  * Return the pixel format corresponding to name.
  *
-- 
2.34.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-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [FFmpeg-devel] [PATCH 3/5] avformat/matroska*: Use av_chroma_location_(pos_to_enum|enum_to_pos)
  2022-09-21  1:30 [FFmpeg-devel] [PATCH 1/5] avcodec/avcodec: Move AV_ER_* and FF_COMPLIANCE_* to defs.h Andreas Rheinhardt
  2022-09-21  1:34 ` [FFmpeg-devel] [PATCH 2/5] avutil/pixdesc: Add av_chroma_location_(enum_to_pos|pos_to_enum) Andreas Rheinhardt
@ 2022-09-21  1:35 ` Andreas Rheinhardt
  2022-09-21  1:35 ` [FFmpeg-devel] [PATCH 4/5] avcodec/avcodec: Deprecate lavc chroma pos API functions Andreas Rheinhardt
  2022-09-21  1:35 ` [FFmpeg-devel] [PATCH 5/5] avformat/internal: Don't include avcodec.h Andreas Rheinhardt
  3 siblings, 0 replies; 6+ messages in thread
From: Andreas Rheinhardt @ 2022-09-21  1:35 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Andreas Rheinhardt

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavformat/matroskadec.c | 5 +++--
 libavformat/matroskaenc.c | 3 ++-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 16a3e93611..aa59f73d00 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -46,6 +46,7 @@
 #include "libavutil/mastering_display_metadata.h"
 #include "libavutil/mathematics.h"
 #include "libavutil/opt.h"
+#include "libavutil/pixdesc.h"
 #include "libavutil/time_internal.h"
 #include "libavutil/spherical.h"
 
@@ -2184,8 +2185,8 @@ static int mkv_parse_video_color(AVStream *st, const MatroskaTrack *track) {
         color->chroma_siting_horz  < MATROSKA_COLOUR_CHROMASITINGHORZ_NB &&
         color->chroma_siting_vert  < MATROSKA_COLOUR_CHROMASITINGVERT_NB) {
         st->codecpar->chroma_location =
-            avcodec_chroma_pos_to_enum((color->chroma_siting_horz - 1) << 7,
-                                       (color->chroma_siting_vert - 1) << 7);
+            av_chroma_location_pos_to_enum((color->chroma_siting_horz - 1) << 7,
+                                           (color->chroma_siting_vert - 1) << 7);
     }
     if (color->max_cll && color->max_fall) {
         size_t size = 0;
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index ed1ad5039d..147f29988e 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -51,6 +51,7 @@
 #include "libavutil/mathematics.h"
 #include "libavutil/opt.h"
 #include "libavutil/parseutils.h"
+#include "libavutil/pixdesc.h"
 #include "libavutil/random_seed.h"
 #include "libavutil/rational.h"
 #include "libavutil/samplefmt.h"
@@ -1322,7 +1323,7 @@ static void mkv_write_video_color(EbmlWriter *writer, const AVStream *st,
         par->chroma_location <= AVCHROMA_LOC_TOP) {
         int xpos, ypos;
 
-        avcodec_enum_to_chroma_pos(&xpos, &ypos, par->chroma_location);
+        av_chroma_location_enum_to_pos(&xpos, &ypos, par->chroma_location);
         ebml_writer_add_uint(writer, MATROSKA_ID_VIDEOCOLORCHROMASITINGHORZ,
                              (xpos >> 7) + 1);
         ebml_writer_add_uint(writer, MATROSKA_ID_VIDEOCOLORCHROMASITINGVERT,
-- 
2.34.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-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [FFmpeg-devel] [PATCH 4/5] avcodec/avcodec: Deprecate lavc chroma pos API functions
  2022-09-21  1:30 [FFmpeg-devel] [PATCH 1/5] avcodec/avcodec: Move AV_ER_* and FF_COMPLIANCE_* to defs.h Andreas Rheinhardt
  2022-09-21  1:34 ` [FFmpeg-devel] [PATCH 2/5] avutil/pixdesc: Add av_chroma_location_(enum_to_pos|pos_to_enum) Andreas Rheinhardt
  2022-09-21  1:35 ` [FFmpeg-devel] [PATCH 3/5] avformat/matroska*: Use av_chroma_location_(pos_to_enum|enum_to_pos) Andreas Rheinhardt
@ 2022-09-21  1:35 ` Andreas Rheinhardt
  2022-09-21  1:35 ` [FFmpeg-devel] [PATCH 5/5] avformat/internal: Don't include avcodec.h Andreas Rheinhardt
  3 siblings, 0 replies; 6+ messages in thread
From: Andreas Rheinhardt @ 2022-09-21  1:35 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Andreas Rheinhardt

avcodec_enum_to_chroma_pos() and avcodec_chroma_pos_to_enum()
deal with enum AVChromaLocation which is defined in lavu.
These functions are therefore replaced by
av_chroma_location_enum_to_pos() and av_chroma_location_pos_to_enum().
This commit provides the necessary deprecations. Also already make
these functions wrappers around the corresponding lavu functions
as not doing so would force one to disable deprecation warnings.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 doc/APIchanges             |  5 +++++
 libavcodec/avcodec.h       |  6 ++++++
 libavcodec/utils.c         | 20 ++++----------------
 libavcodec/version.h       |  2 +-
 libavcodec/version_major.h |  1 +
 5 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 8ead37dcbb..858a9c18bf 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -14,6 +14,11 @@ libavutil:     2021-04-27
 
 API changes, most recent first:
 
+2022-09-21 - xxxxxxxxxx - lavc 59.46.100 - avcodec.h
+  Deprecate avcodec_enum_to_chroma_pos() and avcodec_chroma_pos_to_enum().
+  Use av_chroma_location_enum_to_pos() or av_chroma_location_pos_to_enum()
+  instead.
+
 2022-09-21 - xxxxxxxxxx - lavu 57.xx.100 - pixdesc.h
   Add av_chroma_location_enum_to_pos() and av_chroma_location_pos_to_enum().
 
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 0769577338..7365eb5cc0 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -2496,6 +2496,7 @@ void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height);
 void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height,
                                int linesize_align[AV_NUM_DATA_POINTERS]);
 
+#ifdef FF_API_AVCODEC_CHROMA_POS
 /**
  * Converts AVChromaLocation to swscale x/y chroma position.
  *
@@ -2504,7 +2505,9 @@ void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height,
  *
  * @param xpos  horizontal chroma sample position
  * @param ypos  vertical   chroma sample position
+ * @deprecated Use av_chroma_location_enum_to_pos() instead.
  */
+ attribute_deprecated
 int avcodec_enum_to_chroma_pos(int *xpos, int *ypos, enum AVChromaLocation pos);
 
 /**
@@ -2515,8 +2518,11 @@ int avcodec_enum_to_chroma_pos(int *xpos, int *ypos, enum AVChromaLocation pos);
  *
  * @param xpos  horizontal chroma sample position
  * @param ypos  vertical   chroma sample position
+ * @deprecated Use av_chroma_location_pos_to_enum() instead.
  */
+ attribute_deprecated
 enum AVChromaLocation avcodec_chroma_pos_to_enum(int xpos, int ypos);
+#endif
 
 /**
  * Decode a subtitle message.
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index ba64aaf32d..0e01f18497 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -353,29 +353,17 @@ void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height)
     align               = FFMAX3(align, linesize_align[1], linesize_align[2]);
     *width              = FFALIGN(*width, align);
 }
-
+#if FF_API_AVCODEC_CHROMA_POS
 int avcodec_enum_to_chroma_pos(int *xpos, int *ypos, enum AVChromaLocation pos)
 {
-    if (pos <= AVCHROMA_LOC_UNSPECIFIED || pos >= AVCHROMA_LOC_NB)
-        return AVERROR(EINVAL);
-    pos--;
-
-    *xpos = (pos&1) * 128;
-    *ypos = ((pos>>1)^(pos<4)) * 128;
-
-    return 0;
+    return av_chroma_location_enum_to_pos(xpos, ypos, pos);
 }
 
 enum AVChromaLocation avcodec_chroma_pos_to_enum(int xpos, int ypos)
 {
-    int pos, xout, yout;
-
-    for (pos = AVCHROMA_LOC_UNSPECIFIED + 1; pos < AVCHROMA_LOC_NB; pos++) {
-        if (avcodec_enum_to_chroma_pos(&xout, &yout, pos) == 0 && xout == xpos && yout == ypos)
-            return pos;
-    }
-    return AVCHROMA_LOC_UNSPECIFIED;
+    return av_chroma_location_pos_to_enum(xpos, ypos);
 }
+#endif
 
 int avcodec_fill_audio_frame(AVFrame *frame, int nb_channels,
                              enum AVSampleFormat sample_fmt, const uint8_t *buf,
diff --git a/libavcodec/version.h b/libavcodec/version.h
index a3441795e0..e973bb1c4d 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@
 
 #include "version_major.h"
 
-#define LIBAVCODEC_VERSION_MINOR  45
+#define LIBAVCODEC_VERSION_MINOR  46
 #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 d9386792de..12f863deb7 100644
--- a/libavcodec/version_major.h
+++ b/libavcodec/version_major.h
@@ -52,5 +52,6 @@
 #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_AVCODEC_CHROMA_POS  (LIBAVCODEC_VERSION_MAJOR < 60)
 
 #endif /* AVCODEC_VERSION_MAJOR_H */
-- 
2.34.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-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [FFmpeg-devel] [PATCH 5/5] avformat/internal: Don't include avcodec.h
  2022-09-21  1:30 [FFmpeg-devel] [PATCH 1/5] avcodec/avcodec: Move AV_ER_* and FF_COMPLIANCE_* to defs.h Andreas Rheinhardt
                   ` (2 preceding siblings ...)
  2022-09-21  1:35 ` [FFmpeg-devel] [PATCH 4/5] avcodec/avcodec: Deprecate lavc chroma pos API functions Andreas Rheinhardt
@ 2022-09-21  1:35 ` Andreas Rheinhardt
  3 siblings, 0 replies; 6+ messages in thread
From: Andreas Rheinhardt @ 2022-09-21  1:35 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Andreas Rheinhardt

The general demuxing API uses parsers and decoders. Therefore
FFStream contains pointers to AVCodecContexts and
AVCodecParserContext and lavf/internal.h includes lavc/avcodec.h.

Yet actually only a few files files really use these; and it is best
when this number stays small. Therefore this commit uses opaque
structs in lavf/internal.h for these contexts and stops including
avcodec.h.
This also avoids including lavc/codec_desc.h implicitly. All other
headers are implicitly included as now (mostly through codec.h).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavdevice/jack.c         | 1 -
 libavdevice/v4l2.c         | 1 +
 libavformat/asfenc.c       | 1 +
 libavformat/av1dec.c       | 2 +-
 libavformat/concatdec.c    | 1 +
 libavformat/dashenc.c      | 2 ++
 libavformat/demux.c        | 1 +
 libavformat/dump.c         | 3 ++-
 libavformat/flacdec.c      | 1 +
 libavformat/flvenc.c       | 1 +
 libavformat/hlsenc.c       | 2 ++
 libavformat/internal.h     | 3 +--
 libavformat/matroskaenc.c  | 1 +
 libavformat/mpegts.c       | 1 +
 libavformat/mpegtsenc.c    | 1 +
 libavformat/mxfenc.c       | 1 +
 libavformat/oggparseflac.c | 1 +
 libavformat/rawdec.c       | 6 ++----
 libavformat/riffenc.c      | 1 -
 libavformat/rtsp.c         | 1 +
 libavformat/seek.c         | 2 ++
 21 files changed, 24 insertions(+), 10 deletions(-)

diff --git a/libavdevice/jack.c b/libavdevice/jack.c
index e34eb8961c..db056d824f 100644
--- a/libavdevice/jack.c
+++ b/libavdevice/jack.c
@@ -29,7 +29,6 @@
 #include "libavutil/fifo.h"
 #include "libavutil/opt.h"
 #include "libavutil/time.h"
-#include "libavcodec/avcodec.h"
 #include "libavformat/avformat.h"
 #include "libavformat/internal.h"
 #include "timefilter.h"
diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c
index be422d7c8c..5e85d1a2b3 100644
--- a/libavdevice/v4l2.c
+++ b/libavdevice/v4l2.c
@@ -38,6 +38,7 @@
 #include "libavutil/parseutils.h"
 #include "libavutil/pixdesc.h"
 #include "libavutil/time.h"
+#include "libavcodec/avcodec.h"
 #include "libavcodec/codec_desc.h"
 #include "libavformat/demux.h"
 #include "libavformat/internal.h"
diff --git a/libavformat/asfenc.c b/libavformat/asfenc.c
index e1563b1da6..70800a6df5 100644
--- a/libavformat/asfenc.c
+++ b/libavformat/asfenc.c
@@ -25,6 +25,7 @@
 #include "libavutil/dict.h"
 #include "libavutil/mathematics.h"
 #include "libavutil/opt.h"
+#include "libavcodec/codec_desc.h"
 #include "avformat.h"
 #include "avlanguage.h"
 #include "avio_internal.h"
diff --git a/libavformat/av1dec.c b/libavformat/av1dec.c
index 350f5360d5..d4b430af7e 100644
--- a/libavformat/av1dec.c
+++ b/libavformat/av1dec.c
@@ -19,11 +19,11 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include "config.h"
 #include "config_components.h"
 
 #include "libavutil/common.h"
 #include "libavutil/opt.h"
+#include "libavcodec/avcodec.h"
 #include "libavcodec/av1_parse.h"
 #include "libavcodec/bsf.h"
 #include "avformat.h"
diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c
index e57da59e04..7748c20b6d 100644
--- a/libavformat/concatdec.c
+++ b/libavformat/concatdec.c
@@ -25,6 +25,7 @@
 #include "libavutil/opt.h"
 #include "libavutil/parseutils.h"
 #include "libavutil/timestamp.h"
+#include "libavcodec/codec_desc.h"
 #include "libavcodec/bsf.h"
 #include "avformat.h"
 #include "avio_internal.h"
diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 295b01e225..a0919f6f2d 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -38,6 +38,8 @@
 #include "libavutil/time.h"
 #include "libavutil/time_internal.h"
 
+#include "libavcodec/avcodec.h"
+
 #include "av1.h"
 #include "avc.h"
 #include "avformat.h"
diff --git a/libavformat/demux.c b/libavformat/demux.c
index 1620716716..2dfd82a63c 100644
--- a/libavformat/demux.c
+++ b/libavformat/demux.c
@@ -34,6 +34,7 @@
 #include "libavutil/time.h"
 #include "libavutil/timestamp.h"
 
+#include "libavcodec/avcodec.h"
 #include "libavcodec/bsf.h"
 #include "libavcodec/internal.h"
 #include "libavcodec/packet_internal.h"
diff --git a/libavformat/dump.c b/libavformat/dump.c
index cafcef36c6..225f80ac22 100644
--- a/libavformat/dump.c
+++ b/libavformat/dump.c
@@ -30,12 +30,13 @@
 #include "libavutil/dovi_meta.h"
 #include "libavutil/mathematics.h"
 #include "libavutil/opt.h"
-#include "libavutil/avstring.h"
 #include "libavutil/replaygain.h"
 #include "libavutil/spherical.h"
 #include "libavutil/stereo3d.h"
 #include "libavutil/timecode.h"
 
+#include "libavcodec/avcodec.h"
+
 #include "avformat.h"
 #include "internal.h"
 
diff --git a/libavformat/flacdec.c b/libavformat/flacdec.c
index eadd41fc36..b58ec03963 100644
--- a/libavformat/flacdec.c
+++ b/libavformat/flacdec.c
@@ -20,6 +20,7 @@
  */
 
 #include "libavutil/channel_layout.h"
+#include "libavcodec/avcodec.h"
 #include "libavcodec/bytestream.h"
 #include "libavcodec/flac.h"
 #include "avformat.h"
diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
index 5d574fa790..59be11eba8 100644
--- a/libavformat/flvenc.c
+++ b/libavformat/flvenc.c
@@ -24,6 +24,7 @@
 #include "libavutil/intfloat.h"
 #include "libavutil/avassert.h"
 #include "libavutil/mathematics.h"
+#include "libavcodec/codec_desc.h"
 #include "libavcodec/mpeg4audio.h"
 #include "avio.h"
 #include "avc.h"
diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 6f49ae1aa2..a86fc8907f 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -43,6 +43,8 @@
 #include "libavutil/time.h"
 #include "libavutil/time_internal.h"
 
+#include "libavcodec/avcodec.h"
+
 #include "avformat.h"
 #include "avio_internal.h"
 #include "avc.h"
diff --git a/libavformat/internal.h b/libavformat/internal.h
index 23757dc4fc..ce837fefc7 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -23,7 +23,6 @@
 
 #include <stdint.h>
 
-#include "libavcodec/avcodec.h"
 #include "libavcodec/packet_internal.h"
 
 #include "avformat.h"
@@ -221,7 +220,7 @@ typedef struct FFStream {
     /**
      * The codec context used by avformat_find_stream_info, the parser, etc.
      */
-    AVCodecContext *avctx;
+    struct AVCodecContext *avctx;
     /**
      * 1 if avctx has been initialized with the values from the codec parameters
      */
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 147f29988e..2be4f87284 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -58,6 +58,7 @@
 #include "libavutil/stereo3d.h"
 
 #include "libavcodec/av1.h"
+#include "libavcodec/codec_desc.h"
 #include "libavcodec/xiph.h"
 #include "libavcodec/mpeg4audio.h"
 
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 8a3436f2be..d97702fcd7 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -32,6 +32,7 @@
 #include "libavutil/opt.h"
 #include "libavutil/avassert.h"
 #include "libavutil/dovi_meta.h"
+#include "libavcodec/avcodec.h"
 #include "libavcodec/bytestream.h"
 #include "libavcodec/get_bits.h"
 #include "libavcodec/opus.h"
diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index c964d58c8e..5148a6aecd 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -28,6 +28,7 @@
 #include "libavutil/opt.h"
 
 #include "libavcodec/ac3_parser_internal.h"
+#include "libavcodec/avcodec.h"
 #include "libavcodec/startcode.h"
 
 #include "avformat.h"
diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
index 9a9acbfa08..58c551c83c 100644
--- a/libavformat/mxfenc.c
+++ b/libavformat/mxfenc.c
@@ -47,6 +47,7 @@
 #include "libavutil/mastering_display_metadata.h"
 #include "libavutil/pixdesc.h"
 #include "libavutil/time_internal.h"
+#include "libavcodec/avcodec.h"
 #include "libavcodec/golomb.h"
 #include "libavcodec/h264.h"
 #include "libavcodec/packet_internal.h"
diff --git a/libavformat/oggparseflac.c b/libavformat/oggparseflac.c
index fa7459c162..eef6e09927 100644
--- a/libavformat/oggparseflac.c
+++ b/libavformat/oggparseflac.c
@@ -19,6 +19,7 @@
  */
 
 #include <stdlib.h>
+#include "libavcodec/avcodec.h"
 #include "libavcodec/get_bits.h"
 #include "libavcodec/flac.h"
 #include "avformat.h"
diff --git a/libavformat/rawdec.c b/libavformat/rawdec.c
index 17649bc077..de804366ed 100644
--- a/libavformat/rawdec.c
+++ b/libavformat/rawdec.c
@@ -24,12 +24,10 @@
 
 #include "avformat.h"
 #include "internal.h"
-#include "avio_internal.h"
 #include "rawdec.h"
 #include "libavutil/opt.h"
-#include "libavutil/parseutils.h"
-#include "libavutil/pixdesc.h"
-#include "libavutil/intreadwrite.h"
+
+#include "libavcodec/avcodec.h"
 
 #define RAW_PACKET_SIZE 1024
 
diff --git a/libavformat/riffenc.c b/libavformat/riffenc.c
index 7825c4e746..179b0f12cb 100644
--- a/libavformat/riffenc.c
+++ b/libavformat/riffenc.c
@@ -23,7 +23,6 @@
 #include "libavutil/dict.h"
 #include "libavutil/log.h"
 #include "libavutil/mathematics.h"
-#include "libavcodec/avcodec.h"
 #include "libavcodec/bytestream.h"
 #include "avformat.h"
 #include "avio_internal.h"
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index f948f1d395..cfafb4be80 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -32,6 +32,7 @@
 #include "libavutil/dict.h"
 #include "libavutil/opt.h"
 #include "libavutil/time.h"
+#include "libavcodec/codec_desc.h"
 #include "avformat.h"
 #include "avio_internal.h"
 
diff --git a/libavformat/seek.c b/libavformat/seek.c
index 3b1c75f1b1..a236e285c0 100644
--- a/libavformat/seek.c
+++ b/libavformat/seek.c
@@ -25,6 +25,8 @@
 #include "libavutil/mathematics.h"
 #include "libavutil/timestamp.h"
 
+#include "libavcodec/avcodec.h"
+
 #include "avformat.h"
 #include "avio_internal.h"
 #include "demux.h"
-- 
2.34.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-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [FFmpeg-devel] [PATCH 2/5] avutil/pixdesc: Add av_chroma_location_(enum_to_pos|pos_to_enum)
  2022-09-21  1:34 ` [FFmpeg-devel] [PATCH 2/5] avutil/pixdesc: Add av_chroma_location_(enum_to_pos|pos_to_enum) Andreas Rheinhardt
@ 2022-09-25  0:09   ` Andreas Rheinhardt
  0 siblings, 0 replies; 6+ messages in thread
From: Andreas Rheinhardt @ 2022-09-25  0:09 UTC (permalink / raw)
  To: ffmpeg-devel

Andreas Rheinhardt:
> They are intended as replacements for avcodec_enum_to_chroma_pos()
> and avcodec_chroma_pos_to_enum().
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
> Will add version bump upon applying.
> (Honestly, I am not sure whether there is a need for a replacement
> given that Matroska seems to be the only user of this.)
> 

It is used by mpv (for its interactions with swscale), so I intend to
apply this patchset-as-is (with the replacement) in two days unless
there are objections.

- 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-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-09-25  0:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-21  1:30 [FFmpeg-devel] [PATCH 1/5] avcodec/avcodec: Move AV_ER_* and FF_COMPLIANCE_* to defs.h Andreas Rheinhardt
2022-09-21  1:34 ` [FFmpeg-devel] [PATCH 2/5] avutil/pixdesc: Add av_chroma_location_(enum_to_pos|pos_to_enum) Andreas Rheinhardt
2022-09-25  0:09   ` Andreas Rheinhardt
2022-09-21  1:35 ` [FFmpeg-devel] [PATCH 3/5] avformat/matroska*: Use av_chroma_location_(pos_to_enum|enum_to_pos) Andreas Rheinhardt
2022-09-21  1:35 ` [FFmpeg-devel] [PATCH 4/5] avcodec/avcodec: Deprecate lavc chroma pos API functions Andreas Rheinhardt
2022-09-21  1:35 ` [FFmpeg-devel] [PATCH 5/5] avformat/internal: Don't include avcodec.h Andreas Rheinhardt

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git