[FFmpeg-devel] [PATCH v4 01/23] avcodec, avutil: Move enum AVSubtitleType to avutil, add new and deprecate old values
softworkz
ffmpegagent at gmail.com
Sat May 28 16:25:01 EEST 2022
From: softworkz <softworkz at hotmail.com>
Signed-off-by: softworkz <softworkz at hotmail.com>
---
libavcodec/avcodec.h | 19 +------------
libavutil/Makefile | 1 +
libavutil/subfmt.h | 68 ++++++++++++++++++++++++++++++++++++++++++++
libavutil/version.h | 1 +
4 files changed, 71 insertions(+), 18 deletions(-)
create mode 100644 libavutil/subfmt.h
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 4dae23d06e..56d551f92d 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -35,6 +35,7 @@
#include "libavutil/frame.h"
#include "libavutil/log.h"
#include "libavutil/pixfmt.h"
+#include "libavutil/subfmt.h"
#include "libavutil/rational.h"
#include "codec.h"
@@ -2255,24 +2256,6 @@ typedef struct AVHWAccel {
* @}
*/
-enum AVSubtitleType {
- SUBTITLE_NONE,
-
- SUBTITLE_BITMAP, ///< A bitmap, pict will be set
-
- /**
- * Plain text, the text field must be set by the decoder and is
- * authoritative. ass and pict fields may contain approximations.
- */
- SUBTITLE_TEXT,
-
- /**
- * Formatted text, the ass field must be set by the decoder and is
- * authoritative. pict and text fields may contain approximations.
- */
- SUBTITLE_ASS,
-};
-
#define AV_SUBTITLE_FLAG_FORCED 0x00000001
typedef struct AVSubtitleRect {
diff --git a/libavutil/Makefile b/libavutil/Makefile
index 234de62a4b..5fcdd68ca8 100644
--- a/libavutil/Makefile
+++ b/libavutil/Makefile
@@ -76,6 +76,7 @@ HEADERS = adler32.h \
sha512.h \
spherical.h \
stereo3d.h \
+ subfmt.h \
threadmessage.h \
time.h \
timecode.h \
diff --git a/libavutil/subfmt.h b/libavutil/subfmt.h
new file mode 100644
index 0000000000..791b45519f
--- /dev/null
+++ b/libavutil/subfmt.h
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2021 softworkz
+ *
+ * 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 AVUTIL_SUBFMT_H
+#define AVUTIL_SUBFMT_H
+
+#include "version.h"
+
+enum AVSubtitleType {
+
+ /**
+ * Subtitle format unknown.
+ */
+ AV_SUBTITLE_FMT_NONE = -1,
+
+ /**
+ * Subtitle format unknown.
+ */
+ AV_SUBTITLE_FMT_UNKNOWN = 0,
+#if FF_API_OLD_SUBTITLES
+ SUBTITLE_NONE = 0, ///< Deprecated, use AV_SUBTITLE_FMT_NONE instead.
+#endif
+
+ /**
+ * Bitmap area in AVSubtitleRect.data, pixfmt AV_PIX_FMT_PAL8.
+ */
+ AV_SUBTITLE_FMT_BITMAP = 1,
+#if FF_API_OLD_SUBTITLES
+ SUBTITLE_BITMAP = 1, ///< Deprecated, use AV_SUBTITLE_FMT_BITMAP instead.
+#endif
+
+ /**
+ * Plain text in AVSubtitleRect.text.
+ */
+ AV_SUBTITLE_FMT_TEXT = 2,
+#if FF_API_OLD_SUBTITLES
+ SUBTITLE_TEXT = 2, ///< Deprecated, use AV_SUBTITLE_FMT_TEXT instead.
+#endif
+
+ /**
+ * Text Formatted as per ASS specification, contained AVSubtitleRect.ass.
+ */
+ AV_SUBTITLE_FMT_ASS = 3,
+#if FF_API_OLD_SUBTITLES
+ SUBTITLE_ASS = 3, ///< Deprecated, use AV_SUBTITLE_FMT_ASS instead.
+#endif
+
+ AV_SUBTITLE_FMT_NB, ///< number of subtitle formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions.
+};
+
+#endif /* AVUTIL_SUBFMT_H */
diff --git a/libavutil/version.h b/libavutil/version.h
index 1b4b41d81f..11baa362d3 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -114,6 +114,7 @@
#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_OLD_SUBTITLES (LIBAVUTIL_VERSION_MAJOR < 58)
/**
* @}
--
ffmpeg-codebot
More information about the ffmpeg-devel
mailing list