From dfb30f3b73f96844ec156120ce6355d605a36514 Mon Sep 17 00:00:00 2001 From: Peter Ujfalusi Date: Tue, 26 Sep 2023 15:42:59 +0300 Subject: [PATCH] tools/probe: Fix WAV header creation for extracted audio streams The finalize_wave_files() should be called to update the WAV header to be valid. This should be only done when demuxing to files. Signed-off-by: Peter Ujfalusi --- tools/probes/probes_demux.c | 3 ++- tools/probes/probes_demux.h | 2 ++ tools/probes/probes_main.c | 4 ++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/tools/probes/probes_demux.c b/tools/probes/probes_demux.c index 3db021e8a..a411eef11 100644 --- a/tools/probes/probes_demux.c +++ b/tools/probes/probes_demux.c @@ -139,8 +139,9 @@ int init_wave(struct dma_frame_parser *p, uint32_t buffer_id, uint32_t format) return i; } -void finalize_wave_files(struct wave_files *files) +void finalize_wave_files(struct dma_frame_parser *p) { + struct wave_files *files = p->files; uint32_t i, chunk_size; /* fill the header at the beginning of each file */ diff --git a/tools/probes/probes_demux.h b/tools/probes/probes_demux.h index a656d4c7a..93aa89119 100644 --- a/tools/probes/probes_demux.h +++ b/tools/probes/probes_demux.h @@ -24,4 +24,6 @@ void parser_fetch_free_buffer(struct dma_frame_parser *p, uint8_t **d, size_t *l int parser_parse_data(struct dma_frame_parser *p, size_t d_len); +void finalize_wave_files(struct dma_frame_parser *p); + #endif diff --git a/tools/probes/probes_main.c b/tools/probes/probes_main.c index 7b553709a..cdba2c634 100644 --- a/tools/probes/probes_main.c +++ b/tools/probes/probes_main.c @@ -66,6 +66,10 @@ void parse_data(const char *file_in, bool log_to_stdout) len = fread(data, 1, len, fd_in); ret = parser_parse_data(p, len); } while (!ret && !feof(fd_in)); + + if (!log_to_stdout) + finalize_wave_files(p); + } int main(int argc, char *argv[])