Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH 1/2] avformat/argo_cvg: name unk{1, 2} fields correctly
Date: Mon, 18 Jul 2022 15:45:53 +0200
Message-ID: <DB6PR0101MB22144C46018522A50D4D19F78F8C9@DB6PR0101MB2214.eurprd01.prod.exchangelabs.com> (raw)
In-Reply-To: <20220717133143.881124-1-zane@zanevaniperen.com>

Zane van Iperen:
> Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
> ---
>  libavformat/argo_cvg.c | 33 +++++++++++++++++----------------
>  1 file changed, 17 insertions(+), 16 deletions(-)
> 
> diff --git a/libavformat/argo_cvg.c b/libavformat/argo_cvg.c
> index f32487023a..2ee4a64449 100644
> --- a/libavformat/argo_cvg.c
> +++ b/libavformat/argo_cvg.c
> @@ -40,9 +40,9 @@
>  #define ARGO_CVG_SAMPLES_PER_BLOCK  28
>  
>  typedef struct ArgoCVGHeader {
> -    uint32_t size; /*< File size -8 (this + trailing checksum) */
> -    uint32_t unk1; /*< Unknown. Always seems to be 0 or 1. */
> -    uint32_t unk2; /*< Unknown. Always seems to be 0 or 1. */
> +    uint32_t size;   /*< File size -8 (this + trailing checksum) */
> +    uint32_t loop;   /*< Loop flag. */
> +    uint32_t reverb; /*< Reverb flag. */
>  } ArgoCVGHeader;
>  
>  typedef struct ArgoCVGOverride {
> @@ -91,17 +91,17 @@ static int argo_cvg_probe(const AVProbeData *p)
>      if (p->buf_size < ARGO_CVG_HEADER_SIZE)
>          return 0;
>  
> -    cvg.size = AV_RL32(p->buf + 0);
> -    cvg.unk1 = AV_RL32(p->buf + 4);
> -    cvg.unk2 = AV_RL32(p->buf + 8);
> +    cvg.size   = AV_RL32(p->buf + 0);
> +    cvg.loop   = AV_RL32(p->buf + 4);
> +    cvg.reverb = AV_RL32(p->buf + 8);
>  
>      if (cvg.size < 8)
>          return 0;
>  
> -    if (cvg.unk1 != 0 && cvg.unk1 != 1)
> +    if (cvg.loop != 0 && cvg.loop != 1)
>          return 0;
>  
> -    if (cvg.unk2 != 0 && cvg.unk2 != 1)
> +    if (cvg.reverb != 0 && cvg.reverb != 1)
>          return 0;
>  
>      return AVPROBE_SCORE_MAX / 4 + 1;
> @@ -150,15 +150,16 @@ static int argo_cvg_read_header(AVFormatContext *s)
>      else if (ret != ARGO_CVG_HEADER_SIZE)
>          return AVERROR(EIO);
>  
> -    ctx->header.size = AV_RL32(buf + 0);
> -    ctx->header.unk1 = AV_RL32(buf + 4);
> -    ctx->header.unk2 = AV_RL32(buf + 8);
> +    ctx->header.size   = AV_RL32(buf + 0);
> +    ctx->header.loop   = AV_RL32(buf + 4);
> +    ctx->header.reverb = AV_RL32(buf + 8);
>  
>      if (ctx->header.size < 8)
>          return AVERROR_INVALIDDATA;
>  
>      av_log(s, AV_LOG_TRACE, "size       = %u\n", ctx->header.size);
> -    av_log(s, AV_LOG_TRACE, "unk        = %u, %u\n", ctx->header.unk1, ctx->header.unk2);
> +    av_log(s, AV_LOG_TRACE, "loop       = %u\n", ctx->header.loop);
> +    av_log(s, AV_LOG_TRACE, "reverb     = %u\n", ctx->header.reverb);

%u is for unsigned, yet these variables are of type uint32_t. It is not
guaranteed that these two types are the same (yet they typically are).
That's why the PRI-macros exist.
(Apart from that: Does this have to be three separate av_logs?)

>  
>      if ((ret = argo_cvg_read_checksum(s->pb, &ctx->header, &ctx->checksum)) < 0)
>          return ret;
> @@ -172,10 +173,10 @@ static int argo_cvg_read_header(AVFormatContext *s)
>  
>      for (size_t i = 0; i < FF_ARRAY_ELEMS(overrides); i++) {
>          const ArgoCVGOverride *ovr = overrides + i;
> -        if (ovr->header.size != ctx->header.size ||
> -            ovr->header.unk1 != ctx->header.unk1 ||
> -            ovr->header.unk2 != ctx->header.unk2 ||
> -            ovr->checksum    != ctx->checksum    ||
> +        if (ovr->header.size   != ctx->header.size ||
> +            ovr->header.loop   != ctx->header.loop ||
> +            ovr->header.reverb != ctx->header.reverb ||
> +            ovr->checksum      != ctx->checksum    ||
>              av_strcasecmp(filename, ovr->name) != 0)
>              continue;
>  

_______________________________________________
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".

  parent reply	other threads:[~2022-07-18 13:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-17 13:31 Zane van Iperen
2022-07-17 13:31 ` [FFmpeg-devel] [PATCH 2/2] avformat/argo_cvg: add -loop and -reverb options Zane van Iperen
2022-07-18 13:45 ` Andreas Rheinhardt [this message]
2022-07-20  8:56   ` [FFmpeg-devel] [PATCH 1/2] avformat/argo_cvg: name unk{1, 2} fields correctly Zane van Iperen

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=DB6PR0101MB22144C46018522A50D4D19F78F8C9@DB6PR0101MB2214.eurprd01.prod.exchangelabs.com \
    --to=andreas.rheinhardt@outlook.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