summaryrefslogtreecommitdiff
blob: 9194b1903cc8f9bd653ad9236afb3468bf87a9d9 (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
Read and write from std* when sndfile is used

--- frontend/get_audio.c
+++ frontend/get_audio.c
@@ -605,12 +605,17 @@
         }
 #endif
 #ifdef HAVE_MPGLIB
-        if ((musicin = fopen(lpszFileName, "rb")) == NULL) {
+       if (!strcmp(lpszFileName, "-")) {
+         lame_set_stream_binary_mode(musicin = stdin); /* Read from standard input. */
+       }
+       else {
+         if ((musicin = fopen(lpszFileName, "rb")) == NULL) {
             if (silent < 10) {
-                error_printf("Could not find \"%s\".\n", lpszFileName);
+             error_printf("Could not find \"%s\".\n", lpszFileName);
             }
             exit(1);
-        }
+         }
+       }
         if (-1 == lame_decode_initfile(musicin, &mp3input_data, enc_delay, enc_padding)) {
             if (silent < 10) {
                 error_printf("Error reading headers in mp3 input file %s.\n", lpszFileName);