diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2017-10-07 10:31:04 +0200 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2017-10-07 10:31:04 +0200 |
commit | 68ee7799a4eeb4148cd4628113ebf9ea3f94a211 (patch) | |
tree | 974962f0f9a2552b8a9665b18563e5e14602453e /src/FileInput.h | |
parent | 39e95f67515f97030f4e4dee03abde33ce35a99a (diff) | |
download | ODR-AudioEnc-68ee7799a4eeb4148cd4628113ebf9ea3f94a211.tar.gz ODR-AudioEnc-68ee7799a4eeb4148cd4628113ebf9ea3f94a211.tar.bz2 ODR-AudioEnc-68ee7799a4eeb4148cd4628113ebf9ea3f94a211.zip |
Make all inputs use the same interface
Diffstat (limited to 'src/FileInput.h')
-rw-r--r-- | src/FileInput.h | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/src/FileInput.h b/src/FileInput.h index 937cbd4..c66441a 100644 --- a/src/FileInput.h +++ b/src/FileInput.h @@ -1,5 +1,5 @@ /* ------------------------------------------------------------------ - * Copyright (C) 2016 Matthias P. Braendli + * Copyright (C) 2017 Matthias P. Braendli * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,30 +26,29 @@ * line (number of channels, rate) */ -#ifndef _FILE_INPUT_H_ -#define _FILE_INPUT_H_ +#pragma once #include <stdint.h> -#include <stdio.h> +#include <cstdio> +#include <string> +#include "InputInterface.h" -class FileInput +class FileInput : public InputInterface { public: - FileInput(const char* filename, + FileInput(const std::string& filename, bool raw_input, int sample_rate) : m_filename(filename), m_raw_input(raw_input), - m_sample_rate(sample_rate), - m_wav(nullptr) { } + m_sample_rate(sample_rate) {} ~FileInput(); + FileInput(const FileInput& other) = delete; + FileInput& operator=(const FileInput& other) = delete; - /*! Open the file and prepare the wav decoder. - * - * \return nonzero on error - */ - int prepare(void); + /*! Open the file and prepare the wav decoder. */ + virtual void prepare(void) override; /*! Read length bytes into buf. * @@ -59,15 +58,12 @@ class FileInput int eof(); protected: - const char* m_filename; + std::string m_filename; bool m_raw_input; int m_sample_rate; /* handle to the wav reader */ - void *m_wav; - - FILE* m_in_fh; + void *m_wav = nullptr; + FILE* m_in_fh = nullptr; }; -#endif - |