[FFmpeg-devel] [PATCH 4/7] avformat/avformat: add a flag to signal muxers that support storing cropping values
James Almer
jamrial at gmail.com
Sat Oct 7 19:25:00 EEST 2023
Signed-off-by: James Almer <jamrial at gmail.com>
---
libavformat/avformat.h | 1 +
libavformat/mux.c | 8 ++++++++
2 files changed, 9 insertions(+)
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 9e7eca007e..c099ca8a01 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -500,6 +500,7 @@ typedef struct AVProbeData {
The user or muxer can override this through
AVFormatContext.avoid_negative_ts
*/
+#define AVFMT_CROPPING 0x80000 /**< Format supports storing cropping values */
#define AVFMT_SEEK_TO_PTS 0x4000000 /**< Seeking is based on PTS */
diff --git a/libavformat/mux.c b/libavformat/mux.c
index c7877c5d98..c5e8a4ca74 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -188,6 +188,7 @@ static int init_muxer(AVFormatContext *s, AVDictionary **options)
AVDictionary *tmp = NULL;
const FFOutputFormat *of = ffofmt(s->oformat);
AVDictionaryEntry *e;
+ int warned_crop = 0;
int ret = 0;
if (options)
@@ -276,6 +277,13 @@ FF_ENABLE_DEPRECATION_WARNINGS
goto fail;
}
}
+ if (!warned_crop && !(s->oformat->flags & AVFMT_CROPPING) &&
+ av_packet_side_data_get(st->codecpar->coded_side_data,
+ st->codecpar->nb_coded_side_data,
+ AV_PKT_DATA_FRAME_CROPPING)) {
+ av_log(s, AV_LOG_WARNING, "Muxer does not support storing cropping values\n");
+ warned_crop = 1;
+ }
break;
}
--
2.42.0
More information about the ffmpeg-devel
mailing list