summarylogtreecommitdiffstats
path: root/audiowmark-nostdin.patch
blob: fdc4e6cda980b27fa2cdea634acff7a6fda78d63 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
From 4ddb97b05b41b7a6623cffce90c57304d796db3a Mon Sep 17 00:00:00 2001
From: Stefan Westerfeld <stefan@space.twc.de>
Date: Mon, 30 Dec 2024 16:30:25 +0100
Subject: [PATCH] HLS: use ffmpeg with -nostdin argument to ignore stdin

Signed-off-by: Stefan Westerfeld <stefan@space.twc.de>
---
 src/hls.cc | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/hls.cc b/src/hls.cc
index d026119..9d1535d 100644
--- a/src/hls.cc
+++ b/src/hls.cc
@@ -192,7 +192,7 @@ ff_decode (const string& filename, WavData& out_wav_data)
   if (!tmp_file)
     return Error ("failed to create temp file");
 
-  Error err = run ({"ffmpeg", "-v", "error", "-y", "-f",  "mpegts", "-i", filename, "-f", "wav", tmp_file_name});
+  Error err = run ({"ffmpeg", "-v", "error", "-nostdin", "-y", "-f",  "mpegts", "-i", filename, "-f", "wav", tmp_file_name});
   if (err)
     return err;
 
@@ -294,7 +294,7 @@ bit_rate_from_m3u8 (const string& m3u8, const WavData& wav_data, int& bit_rate)
   if (!tmp_file)
     return Error ("failed to create temp file");
 
-  Error err = run ({"ffmpeg", "-v", "error", "-y", "-i", m3u8, "-c:a", "copy", "-f", "adts", tmp_file_name});
+  Error err = run ({"ffmpeg", "-v", "error", "-nostdin", "-y", "-i", m3u8, "-c:a", "copy", "-f", "adts", tmp_file_name});
   if (err)
     return err;
 
@@ -319,7 +319,7 @@ load_audio_master (const string& filename, WavData& audio_master_data)
     return Error ("failed to create temp file");
 
   /* extract wav */
-  Error err = run ({"ffmpeg", "-v", "error", "-y", "-i", filename, "-f", "wav", tmp_file_name});
+  Error err = run ({"ffmpeg", "-v", "error", "-nostdin", "-y", "-i", filename, "-f", "wav", tmp_file_name});
   if (err)
     return err;
 
From 99e0e42a0d1cb7f117f5d599c4ac20f37a570639 Mon Sep 17 00:00:00 2001
From: Stefan Westerfeld <stefan@space.twc.de>
Date: Mon, 30 Dec 2024 16:23:43 +0100
Subject: [PATCH] Use ffmpeg -nostdin in test scripts (ignore stdin input).

Signed-off-by: Stefan Westerfeld <stefan@space.twc.de>
---
 tests/hls-test.sh        | 4 ++--
 tests/raw-format-test.sh | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/tests/hls-test.sh b/tests/hls-test.sh
index c22117d..1d93b72 100755
--- a/tests/hls-test.sh
+++ b/tests/hls-test.sh
@@ -13,7 +13,7 @@ mkdir -p $HLS_DIR
 audiowmark test-gen-noise $HLS_DIR/test-input.wav 200 44100
 
 # convert to hls
-ffmpeg $FFMPEG_Q -i $HLS_DIR/test-input.wav \
+ffmpeg $FFMPEG_Q -nostdin -i $HLS_DIR/test-input.wav \
   -f hls \
   -c:a:0 aac -ab 192k \
   -master_pl_name replay.m3u8 \
@@ -31,7 +31,7 @@ done
 cp $HLS_DIR/as0/out.m3u8 $HLS_DIR/as0m/out.m3u8
 
 # convert watermarked hls back to wav
-ffmpeg $FFMPEG_Q -y -i $HLS_DIR/as0m/out.m3u8 $HLS_DIR/test-output.wav
+ffmpeg $FFMPEG_Q -nostdin -y -i $HLS_DIR/as0m/out.m3u8 $HLS_DIR/test-output.wav
 
 # detect watermark from wav
 audiowmark_cmp --expect-matches 5 $HLS_DIR/test-output.wav $TEST_MSG
diff --git a/tests/raw-format-test.sh b/tests/raw-format-test.sh
index e0050b8..15a31de 100755
--- a/tests/raw-format-test.sh
+++ b/tests/raw-format-test.sh
@@ -16,14 +16,14 @@ raw_test()
 
   audiowmark test-gen-noise --bits 32 $IN_WAV 200 44100
 
-  ffmpeg -v quiet -i $IN_WAV -f $FFMPEG_FMT -c:a pcm_$FFMPEG_FMT - | \
+  ffmpeg -v quiet -nostdin -i $IN_WAV -f $FFMPEG_FMT -c:a pcm_$FFMPEG_FMT - | \
     audiowmark_add - - $TEST_MSG --format raw --raw-rate 44100 $AWM_FMT --test-no-limiter | \
     ffmpeg -v quiet -f $FFMPEG_FMT -ar 44100 -ac 2 -i - $OUT_WAV
 
   audiowmark_cmp --expect-matches 5 $OUT_WAV $TEST_MSG
   check_snr $IN_WAV $OUT_WAV $SNR
 
-  ffmpeg -v quiet -i $IN_WAV -f $FFMPEG_FMT -c:a pcm_$FFMPEG_FMT - | \
+  ffmpeg -v quiet -nostdin -i $IN_WAV -f $FFMPEG_FMT -c:a pcm_$FFMPEG_FMT - | \
     audiowmark_add - $OUT2_WAV $TEST_MSG --input-format raw --raw-rate 44100 $AWM_FMT --test-no-limiter
 
   check_length $IN_WAV $OUT_WAV