From c36c65f341429d8b6412be23205f6f9d1b0c864c Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Sun, 10 Jan 2016 16:48:31 +0100 Subject: Create VLCInputDirect class --- src/VLCInput.h | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) (limited to 'src/VLCInput.h') diff --git a/src/VLCInput.h b/src/VLCInput.h index f5503e7..710a0c6 100644 --- a/src/VLCInput.h +++ b/src/VLCInput.h @@ -38,6 +38,9 @@ // 16 bits per sample is fine for now #define BYTES_PER_SAMPLE 2 +/* Common functionality for the direct libvlc input and the + * threaded libvlc input + */ class VLCInput { public: @@ -61,15 +64,6 @@ class VLCInput /* Prepare the audio input */ int prepare(); - /* Read exactly length bytes into buf. - * Blocks if not enough data is available, - * or returns zero if EOF reached. - * - * Returns the number of bytes written into - * the buffer. - */ - ssize_t read(uint8_t* buf, size_t length); - /* Write the last received ICY-Text to the * file. */ @@ -127,6 +121,28 @@ class VLCInput VLCInput(const VLCInput& other) {} }; +class VLCInputDirect : public VLCInput +{ + public: + VLCInputDirect(const std::string& uri, + int rate, + unsigned channels, + unsigned verbosity, + std::string& gain, + std::string& cache) : + VLCInput(uri, rate, channels, verbosity, gain, cache) {} + + /* Read exactly length bytes into buf. + * Blocks if not enough data is available, + * or returns zero if EOF reached. + * + * Returns the number of bytes written into + * the buffer. + */ + ssize_t read(uint8_t* buf, size_t length); + +}; + #endif // HAVE_VLC #endif -- cgit v1.2.3