From: James Almer <jamrial@gmail.com> To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH] avformat/framecrcenc: allow setting which side data parameters are printed Date: Thu, 25 Apr 2024 11:34:59 -0300 Message-ID: <20240425143459.2875-1-jamrial@gmail.com> (raw) For some side data types, the size is dependent on the arch at runtime, which is not good for FATE tests. Add an option to set which parameters may be printed, starting with size. Signed-off-by: James Almer <jamrial@gmail.com> --- libavformat/framecrcenc.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/libavformat/framecrcenc.c b/libavformat/framecrcenc.c index ce306a6c49..7d0e3978f2 100644 --- a/libavformat/framecrcenc.c +++ b/libavformat/framecrcenc.c @@ -23,6 +23,7 @@ #include "libavutil/adler32.h" #include "libavutil/avstring.h" +#include "libavutil/opt.h" #include "libavcodec/codec_id.h" #include "libavcodec/codec_par.h" @@ -32,6 +33,11 @@ #include "internal.h" #include "mux.h" +struct FrameCRCContext { + const AVClass *avclass; + int flags; +}; + static int framecrc_write_header(struct AVFormatContext *s) { int i; @@ -48,8 +54,11 @@ static int framecrc_write_header(struct AVFormatContext *s) return ff_framehash_write_header(s); } +#define SD_SIZE 1 + static int framecrc_write_packet(struct AVFormatContext *s, AVPacket *pkt) { + struct FrameCRCContext *c = s->priv_data; uint32_t crc = av_adler32_update(0, pkt->data, pkt->size); char buf[256]; @@ -61,6 +70,7 @@ static int framecrc_write_packet(struct AVFormatContext *s, AVPacket *pkt) av_strlcatf(buf, sizeof(buf), ", S=%d", pkt->side_data_elems); for (int i = 0; i < pkt->side_data_elems; i++) { + if (c->flags & SD_SIZE) av_strlcatf(buf, sizeof(buf), ", %8"SIZE_SPECIFIER, pkt->side_data[i].size); } @@ -70,11 +80,29 @@ static int framecrc_write_packet(struct AVFormatContext *s, AVPacket *pkt) return 0; } +#define OFFSET(x) offsetof(struct FrameCRCContext, x) +#define ENC AV_OPT_FLAG_ENCODING_PARAM +static const AVOption framecrc_options[] = { + { "print_side_data", "set which side data parameters to print", OFFSET(flags), + AV_OPT_TYPE_FLAGS, { .i64 = SD_SIZE }, INT_MIN, INT_MAX, ENC, .unit = "flags"}, + { "size", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = SD_SIZE }, INT_MIN, INT_MAX, ENC, .unit = "flags"}, + { NULL }, +}; + +static const AVClass framecrc_class = { + .class_name = "framecrc muxer", + .item_name = av_default_item_name, + .option = framecrc_options, + .version = LIBAVUTIL_VERSION_INT, +}; + const FFOutputFormat ff_framecrc_muxer = { .p.name = "framecrc", .p.long_name = NULL_IF_CONFIG_SMALL("framecrc testing"), + .p.priv_class = &framecrc_class, .p.audio_codec = AV_CODEC_ID_PCM_S16LE, .p.video_codec = AV_CODEC_ID_RAWVIDEO, + .priv_data_size = sizeof(struct FrameCRCContext), .write_header = framecrc_write_header, .write_packet = framecrc_write_packet, .p.flags = AVFMT_VARIABLE_FPS | AVFMT_TS_NONSTRICT | -- 2.44.0 _______________________________________________ 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".
next reply other threads:[~2024-04-25 14:35 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-04-25 14:34 James Almer [this message] 2024-04-27 0:17 ` Michael Niedermayer 2024-04-27 0:21 ` James Almer
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20240425143459.2875-1-jamrial@gmail.com \ --to=jamrial@gmail.com \ --cc=ffmpeg-devel@ffmpeg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
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