aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Storsjo <martin@martin.st>2014-02-07 14:50:46 +0200
committerMartin Storsjo <martin@martin.st>2014-06-23 10:45:50 +0300
commit3951d0a4e5ae26d9f72a5a64d09cb7b9214b2222 (patch)
treefebdf1fd3ba493974b4c3f2e8364d62ceda96a42
parente7348e7a5d94648130e9baa4f1bfaf3d65316133 (diff)
downloadfdk-aac-3951d0a4e5ae26d9f72a5a64d09cb7b9214b2222.tar.gz
fdk-aac-3951d0a4e5ae26d9f72a5a64d09cb7b9214b2222.tar.bz2
fdk-aac-3951d0a4e5ae26d9f72a5a64d09cb7b9214b2222.zip
Allow opening stdin when "-" is specified
-rw-r--r--wavreader.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/wavreader.c b/wavreader.c
index a8b4d0e..69b3b57 100644
--- a/wavreader.c
+++ b/wavreader.c
@@ -68,7 +68,10 @@ void* wav_read_open(const char *filename) {
long data_pos = 0;
memset(wr, 0, sizeof(*wr));
- wr->wav = fopen(filename, "rb");
+ if (!strcmp(filename, "-"))
+ wr->wav = stdin;
+ else
+ wr->wav = fopen(filename, "rb");
if (wr->wav == NULL) {
free(wr);
return NULL;
@@ -136,7 +139,8 @@ void* wav_read_open(const char *filename) {
void wav_read_close(void* obj) {
struct wav_reader* wr = (struct wav_reader*) obj;
- fclose(wr->wav);
+ if (wr->wav != stdin)
+ fclose(wr->wav);
free(wr);
}