* [FFmpeg-devel] [PATCH] avformat/framecrcenc: allow setting which side data parameters are printed
@ 2024-04-25 14:34 James Almer
2024-04-27 0:17 ` Michael Niedermayer
0 siblings, 1 reply; 3+ messages in thread
From: James Almer @ 2024-04-25 14:34 UTC (permalink / raw)
To: ffmpeg-devel
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".
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [FFmpeg-devel] [PATCH] avformat/framecrcenc: allow setting which side data parameters are printed
2024-04-25 14:34 [FFmpeg-devel] [PATCH] avformat/framecrcenc: allow setting which side data parameters are printed James Almer
@ 2024-04-27 0:17 ` Michael Niedermayer
2024-04-27 0:21 ` James Almer
0 siblings, 1 reply; 3+ messages in thread
From: Michael Niedermayer @ 2024-04-27 0:17 UTC (permalink / raw)
To: FFmpeg development discussions and patches
[-- Attachment #1.1: Type: text/plain, Size: 630 bytes --]
On Thu, Apr 25, 2024 at 11:34:59AM -0300, James Almer wrote:
> For some side data types, the size is dependent on the arch at runtime, which
> is not good for FATE tests.
Which are not bit exact ?
I guess its pointer size or something.
Either way i have some local improvments for framecrc that iam using for
testing ill post that. It may be a better direction (with some bitexact flag)
than globally disabling size.
thx
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Asymptotically faster algorithms should always be preferred if you have
asymptotical amounts of data
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
[-- Attachment #2: Type: text/plain, Size: 251 bytes --]
_______________________________________________
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] 3+ messages in thread
* Re: [FFmpeg-devel] [PATCH] avformat/framecrcenc: allow setting which side data parameters are printed
2024-04-27 0:17 ` Michael Niedermayer
@ 2024-04-27 0:21 ` James Almer
0 siblings, 0 replies; 3+ messages in thread
From: James Almer @ 2024-04-27 0:21 UTC (permalink / raw)
To: ffmpeg-devel
On 4/26/2024 9:17 PM, Michael Niedermayer wrote:
> On Thu, Apr 25, 2024 at 11:34:59AM -0300, James Almer wrote:
>> For some side data types, the size is dependent on the arch at runtime, which
>> is not good for FATE tests.
>
> Which are not bit exact ?
All the AV_PKT_DATA_IAMF_* ones, and AV_FRAME_DATA_VIDEO_ENC_PARAMS (but
this one is not relevant to the framecrc muxer).
>
> I guess its pointer size or something.
sizeof(size_t), sizeof(intptr_t), and assorted alignments.
>
> Either way i have some local improvments for framecrc that iam using for
> testing ill post that. It may be a better direction (with some bitexact flag)
> than globally disabling size.
Ok.
>
> thx
>
> [...]
>
>
> _______________________________________________
> 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".
_______________________________________________
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] 3+ messages in thread
end of thread, other threads:[~2024-04-27 0:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-25 14:34 [FFmpeg-devel] [PATCH] avformat/framecrcenc: allow setting which side data parameters are printed James Almer
2024-04-27 0:17 ` Michael Niedermayer
2024-04-27 0:21 ` James Almer
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