* [FFmpeg-devel] [PATCH v2 1/4] avformat/argo_cvg: name unk{1, 2} fields correctly
@ 2022-07-20 14:49 Zane van Iperen
2022-07-20 14:49 ` [FFmpeg-devel] [PATCH v2 2/4] avformat/argo_cvg: add -loop and -reverb options Zane van Iperen
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Zane van Iperen @ 2022-07-20 14:49 UTC (permalink / raw)
To: ffmpeg-devel
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
---
libavformat/argo_cvg.c | 31 +++++++++++++++----------------
1 file changed, 15 insertions(+), 16 deletions(-)
diff --git a/libavformat/argo_cvg.c b/libavformat/argo_cvg.c
index f32487023a..be78091f0c 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,14 @@ 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);
if ((ret = argo_cvg_read_checksum(s->pb, &ctx->header, &ctx->checksum)) < 0)
return ret;
@@ -172,10 +171,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;
--
2.36.1
_______________________________________________
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] 6+ messages in thread
* [FFmpeg-devel] [PATCH v2 2/4] avformat/argo_cvg: add -loop and -reverb options
2022-07-20 14:49 [FFmpeg-devel] [PATCH v2 1/4] avformat/argo_cvg: name unk{1, 2} fields correctly Zane van Iperen
@ 2022-07-20 14:49 ` Zane van Iperen
2022-07-20 14:49 ` [FFmpeg-devel] [PATCH v2 3/4] avformat/argo_cvg: remove trace logging Zane van Iperen
2022-07-20 14:49 ` [FFmpeg-devel] [PATCH v2 4/4] avformat/argo_cvg: expose loop/reverb/checksum via metadata Zane van Iperen
2 siblings, 0 replies; 6+ messages in thread
From: Zane van Iperen @ 2022-07-20 14:49 UTC (permalink / raw)
To: ffmpeg-devel
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
---
libavformat/argo_cvg.c | 28 +++++++++++++++++++++++++---
1 file changed, 25 insertions(+), 3 deletions(-)
diff --git a/libavformat/argo_cvg.c b/libavformat/argo_cvg.c
index be78091f0c..32247a06be 100644
--- a/libavformat/argo_cvg.c
+++ b/libavformat/argo_cvg.c
@@ -62,6 +62,8 @@ typedef struct ArgoCVGDemuxContext {
typedef struct ArgoCVGMuxContext {
const AVClass *class;
int skip_rate_check;
+ int loop;
+ int reverb;
uint32_t checksum;
size_t size;
} ArgoCVGMuxContext;
@@ -301,10 +303,10 @@ static int argo_cvg_write_header(AVFormatContext *s)
ArgoCVGMuxContext *ctx = s->priv_data;
avio_wl32(s->pb, 0); /* Size, fixed later. */
- avio_wl32(s->pb, 0);
- avio_wl32(s->pb, 1);
+ avio_wl32(s->pb, !!ctx->loop);
+ avio_wl32(s->pb, !!ctx->reverb);
- ctx->checksum = 1;
+ ctx->checksum = !!ctx->loop + !!ctx->reverb;
ctx->size = 8;
return 0;
}
@@ -363,6 +365,26 @@ static const AVOption argo_cvg_options[] = {
.max = 1,
.flags = AV_OPT_FLAG_ENCODING_PARAM
},
+ {
+ .name = "loop",
+ .help = "set loop flag",
+ .offset = offsetof(ArgoCVGMuxContext, loop),
+ .type = AV_OPT_TYPE_BOOL,
+ .default_val = {.i64 = 0},
+ .min = 0,
+ .max = 1,
+ .flags = AV_OPT_FLAG_ENCODING_PARAM
+ },
+ {
+ .name = "reverb",
+ .help = "set reverb flag",
+ .offset = offsetof(ArgoCVGMuxContext, reverb),
+ .type = AV_OPT_TYPE_BOOL,
+ .default_val = {.i64 = 1},
+ .min = 0,
+ .max = 1,
+ .flags = AV_OPT_FLAG_ENCODING_PARAM
+ },
{ NULL }
};
--
2.36.1
_______________________________________________
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] 6+ messages in thread
* [FFmpeg-devel] [PATCH v2 3/4] avformat/argo_cvg: remove trace logging
2022-07-20 14:49 [FFmpeg-devel] [PATCH v2 1/4] avformat/argo_cvg: name unk{1, 2} fields correctly Zane van Iperen
2022-07-20 14:49 ` [FFmpeg-devel] [PATCH v2 2/4] avformat/argo_cvg: add -loop and -reverb options Zane van Iperen
@ 2022-07-20 14:49 ` Zane van Iperen
2022-07-20 14:49 ` [FFmpeg-devel] [PATCH v2 4/4] avformat/argo_cvg: expose loop/reverb/checksum via metadata Zane van Iperen
2 siblings, 0 replies; 6+ messages in thread
From: Zane van Iperen @ 2022-07-20 14:49 UTC (permalink / raw)
To: ffmpeg-devel
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
---
libavformat/argo_cvg.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/libavformat/argo_cvg.c b/libavformat/argo_cvg.c
index 32247a06be..12465dcbcc 100644
--- a/libavformat/argo_cvg.c
+++ b/libavformat/argo_cvg.c
@@ -159,13 +159,9 @@ static int argo_cvg_read_header(AVFormatContext *s)
if (ctx->header.size < 8)
return AVERROR_INVALIDDATA;
- av_log(s, AV_LOG_TRACE, "size = %u\n", ctx->header.size);
-
if ((ret = argo_cvg_read_checksum(s->pb, &ctx->header, &ctx->checksum)) < 0)
return ret;
- av_log(s, AV_LOG_TRACE, "checksum = %u\n", ctx->checksum);
-
par = st->codecpar;
par->codec_type = AVMEDIA_TYPE_AUDIO;
par->codec_id = AV_CODEC_ID_ADPCM_PSX;
--
2.36.1
_______________________________________________
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] 6+ messages in thread
* [FFmpeg-devel] [PATCH v2 4/4] avformat/argo_cvg: expose loop/reverb/checksum via metadata
2022-07-20 14:49 [FFmpeg-devel] [PATCH v2 1/4] avformat/argo_cvg: name unk{1, 2} fields correctly Zane van Iperen
2022-07-20 14:49 ` [FFmpeg-devel] [PATCH v2 2/4] avformat/argo_cvg: add -loop and -reverb options Zane van Iperen
2022-07-20 14:49 ` [FFmpeg-devel] [PATCH v2 3/4] avformat/argo_cvg: remove trace logging Zane van Iperen
@ 2022-07-20 14:49 ` Zane van Iperen
2022-07-20 22:00 ` Andreas Rheinhardt
2 siblings, 1 reply; 6+ messages in thread
From: Zane van Iperen @ 2022-07-20 14:49 UTC (permalink / raw)
To: ffmpeg-devel
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
---
libavformat/argo_cvg.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/libavformat/argo_cvg.c b/libavformat/argo_cvg.c
index 12465dcbcc..3d4abb4758 100644
--- a/libavformat/argo_cvg.c
+++ b/libavformat/argo_cvg.c
@@ -162,6 +162,15 @@ static int argo_cvg_read_header(AVFormatContext *s)
if ((ret = argo_cvg_read_checksum(s->pb, &ctx->header, &ctx->checksum)) < 0)
return ret;
+ if (av_dict_set_int(&st->metadata, "loop", ctx->header.loop, 0) < 0)
+ return AVERROR(ENOMEM);
+
+ if (av_dict_set_int(&st->metadata, "reverb", ctx->header.reverb, 0) < 0)
+ return AVERROR(ENOMEM);
+
+ if (av_dict_set_int(&st->metadata, "checksum", ctx->checksum, 0) < 0)
+ return AVERROR(ENOMEM);
+
par = st->codecpar;
par->codec_type = AVMEDIA_TYPE_AUDIO;
par->codec_id = AV_CODEC_ID_ADPCM_PSX;
--
2.36.1
_______________________________________________
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] 6+ messages in thread
* Re: [FFmpeg-devel] [PATCH v2 4/4] avformat/argo_cvg: expose loop/reverb/checksum via metadata
2022-07-20 14:49 ` [FFmpeg-devel] [PATCH v2 4/4] avformat/argo_cvg: expose loop/reverb/checksum via metadata Zane van Iperen
@ 2022-07-20 22:00 ` Andreas Rheinhardt
2022-07-21 13:38 ` Zane van Iperen
0 siblings, 1 reply; 6+ messages in thread
From: Andreas Rheinhardt @ 2022-07-20 22:00 UTC (permalink / raw)
To: ffmpeg-devel
Zane van Iperen:
> Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
> ---
> libavformat/argo_cvg.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/libavformat/argo_cvg.c b/libavformat/argo_cvg.c
> index 12465dcbcc..3d4abb4758 100644
> --- a/libavformat/argo_cvg.c
> +++ b/libavformat/argo_cvg.c
> @@ -162,6 +162,15 @@ static int argo_cvg_read_header(AVFormatContext *s)
> if ((ret = argo_cvg_read_checksum(s->pb, &ctx->header, &ctx->checksum)) < 0)
> return ret;
>
> + if (av_dict_set_int(&st->metadata, "loop", ctx->header.loop, 0) < 0)
> + return AVERROR(ENOMEM);
> +
> + if (av_dict_set_int(&st->metadata, "reverb", ctx->header.reverb, 0) < 0)
> + return AVERROR(ENOMEM);
> +
> + if (av_dict_set_int(&st->metadata, "checksum", ctx->checksum, 0) < 0)
> + return AVERROR(ENOMEM);
> +
> par = st->codecpar;
> par->codec_type = AVMEDIA_TYPE_AUDIO;
> par->codec_id = AV_CODEC_ID_ADPCM_PSX;
Don't second-guess error codes (unless you have a good reason to).
- Andreas
_______________________________________________
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] 6+ messages in thread
* Re: [FFmpeg-devel] [PATCH v2 4/4] avformat/argo_cvg: expose loop/reverb/checksum via metadata
2022-07-20 22:00 ` Andreas Rheinhardt
@ 2022-07-21 13:38 ` Zane van Iperen
0 siblings, 0 replies; 6+ messages in thread
From: Zane van Iperen @ 2022-07-21 13:38 UTC (permalink / raw)
To: ffmpeg-devel
On 21/7/22 08:00, Andreas Rheinhardt wrote:
>> + if (av_dict_set_int(&st->metadata, "loop", ctx->header.loop, 0) < 0)
>> + return AVERROR(ENOMEM);
>> +
>> + if (av_dict_set_int(&st->metadata, "reverb", ctx->header.reverb, 0) < 0)
>> + return AVERROR(ENOMEM);
>> +
>> + if (av_dict_set_int(&st->metadata, "checksum", ctx->checksum, 0) < 0)
>> + return AVERROR(ENOMEM);
>>
> Don't second-guess error codes (unless you have a good reason to).
>
Right, don't know why I did that...
I'll apply in a few days (with the fixed return codes).
_______________________________________________
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] 6+ messages in thread
end of thread, other threads:[~2022-07-21 13:38 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-20 14:49 [FFmpeg-devel] [PATCH v2 1/4] avformat/argo_cvg: name unk{1, 2} fields correctly Zane van Iperen
2022-07-20 14:49 ` [FFmpeg-devel] [PATCH v2 2/4] avformat/argo_cvg: add -loop and -reverb options Zane van Iperen
2022-07-20 14:49 ` [FFmpeg-devel] [PATCH v2 3/4] avformat/argo_cvg: remove trace logging Zane van Iperen
2022-07-20 14:49 ` [FFmpeg-devel] [PATCH v2 4/4] avformat/argo_cvg: expose loop/reverb/checksum via metadata Zane van Iperen
2022-07-20 22:00 ` Andreas Rheinhardt
2022-07-21 13:38 ` Zane van Iperen
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