diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2022-10-05 16:09:31 +0200 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2022-10-05 16:09:31 +0200 |
commit | 7c1c779cfd01162d020d0c276bb605adfe338df9 (patch) | |
tree | 415265244ecc90de6e01ff705b25edc67b813448 /src/input/File.h | |
parent | b76df807e61e25e07fa3ee075dab255355b278fd (diff) | |
download | dabmux-7c1c779cfd01162d020d0c276bb605adfe338df9.tar.gz dabmux-7c1c779cfd01162d020d0c276bb605adfe338df9.tar.bz2 dabmux-7c1c779cfd01162d020d0c276bb605adfe338df9.zip |
Add load_entire_file option for file inputs
Diffstat (limited to 'src/input/File.h')
-rw-r--r-- | src/input/File.h | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/input/File.h b/src/input/File.h index 39ce7fd..f317d46 100644 --- a/src/input/File.h +++ b/src/input/File.h @@ -2,7 +2,7 @@ Copyright (C) 2009 Her Majesty the Queen in Right of Canada (Communications Research Center Canada) - Copyright (C) 2018 Matthias P. Braendli + Copyright (C) 2022 Matthias P. Braendli http://www.opendigitalradio.org */ @@ -43,23 +43,32 @@ class FileBase : public InputBase { virtual void close(); virtual void setNonblocking(bool nonblock); + virtual void setLoadEntireFile(bool load_entire_file); + protected: /* Rewind the file * Returns -1 on failure, 0 on success */ - virtual int rewind(); - protected: + virtual ssize_t rewind(); /* Read len bytes from the file into buf, and return * the number of bytes read, or -1 in case of error. */ virtual ssize_t readFromFile(uint8_t* buf, size_t len); + virtual ssize_t load_entire_file(); + // We use unix open() instead of fopen() because // of non-blocking I/O int m_fd = -1; + std::string m_filename; bool m_nonblock = false; + bool m_load_entire_file = false; std::vector<uint8_t> m_nonblock_buffer; + + size_t m_file_contents_offset = 0; + std::vector<uint8_t> m_file_contents; + bool m_file_open_alert_shown = false; }; class MPEGFile : public FileBase { |