From: Michael Niedermayer <michael@niedermayer.cc>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: [FFmpeg-devel] [PATCH 4/5] avradio/sdrdemux: avoid literal offsets in dump code
Date: Sat, 22 Jul 2023 16:11:03 +0200
Message-ID: <20230722141104.3327415-4-michael@niedermayer.cc> (raw)
In-Reply-To: <20230722141104.3327415-1-michael@niedermayer.cc>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
libavradio/sdrdemux.c | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/libavradio/sdrdemux.c b/libavradio/sdrdemux.c
index 66130d9662..09d720de23 100644
--- a/libavradio/sdrdemux.c
+++ b/libavradio/sdrdemux.c
@@ -1842,20 +1842,27 @@ process_next_block:
sdr->block_center_freq = fifo_element[0].center_frequency;
if (sdr->dump_avio) {
- uint8_t header[48] = "FFSDR001int16BE";
+ uint8_t header[16] = "FFSDR001int16BE";
uint8_t *tmp = (void*)sdr->windowed_block; //We use an unused array as temporary here
+ int64_t sizepos, endpos;
if (sdr->sample_size == 2)
memcpy(header + 11, "08", 2);
- AV_WB32(header+16, sdr->sdr_sample_rate);
- AV_WB32(header+20, sdr->block_size);
- AV_WB64(header+24, av_double2int(fifo_element[0].center_frequency));
- AV_WB64(header+32, sdr->pts);
- AV_WB32(header+40, sdr->bandwidth);
- AV_WB32(header+44, sizeof(header));
-
avio_write(sdr->dump_avio, header, sizeof(header));
+ avio_wb32(sdr->dump_avio, sdr->sdr_sample_rate);
+ avio_wb32(sdr->dump_avio, sdr->block_size);
+ avio_wb64(sdr->dump_avio, av_double2int(fifo_element[0].center_frequency));
+ avio_wb64(sdr->dump_avio, sdr->pts);
+ avio_wb32(sdr->dump_avio, sdr->bandwidth);
+ sizepos = avio_tell(sdr->dump_avio);
+ avio_wb32(sdr->dump_avio, 0);
+
+ endpos = avio_tell(sdr->dump_avio);
+
+ avio_seek(sdr->dump_avio, sizepos, SEEK_SET);
+ avio_wb32(sdr->dump_avio, endpos);
+ avio_seek(sdr->dump_avio, endpos, SEEK_SET);
if (sdr->sample_size == 2) {
avio_write(sdr->dump_avio, fifo_element[0].halfblock, sdr->block_size * sdr->sample_size);
--
2.31.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".
next prev parent reply other threads:[~2023-07-22 14:11 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-22 14:11 [FFmpeg-devel] [PATCH 1/5] avradio/vissualize: support simple skiping of chars Michael Niedermayer
2023-07-22 14:11 ` [FFmpeg-devel] [PATCH 2/5] avradio/vissualize: change color of the active station Michael Niedermayer
2023-07-22 14:11 ` [FFmpeg-devel] [PATCH 3/5] avradio/sdr: Remove direct inclusion of pthread.h Michael Niedermayer
2023-07-22 14:11 ` Michael Niedermayer [this message]
2023-07-22 14:11 ` [FFmpeg-devel] [PATCH 5/5] avradio/sdrdemux: store min/max frequency, driver, label and tuner Michael Niedermayer
2023-07-24 17:07 ` [FFmpeg-devel] [PATCH 1/5] avradio/vissualize: support simple skiping of chars Michael Niedermayer
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=20230722141104.3327415-4-michael@niedermayer.cc \
--to=michael@niedermayer.cc \
--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