diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2016-01-10 16:48:31 +0100 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2016-01-10 16:48:31 +0100 |
commit | c36c65f341429d8b6412be23205f6f9d1b0c864c (patch) | |
tree | 9253b209f7c079669f0c60e28bececa0830c30db /src | |
parent | da68fb19584e7c5d075c7d2d91e3cf1308674f2e (diff) | |
download | fdk-aac-c36c65f341429d8b6412be23205f6f9d1b0c864c.tar.gz fdk-aac-c36c65f341429d8b6412be23205f6f9d1b0c864c.tar.bz2 fdk-aac-c36c65f341429d8b6412be23205f6f9d1b0c864c.zip |
Create VLCInputDirect class
Diffstat (limited to 'src')
-rw-r--r-- | src/VLCInput.cpp | 2 | ||||
-rw-r--r-- | src/VLCInput.h | 34 | ||||
-rw-r--r-- | src/dabplus-enc.cpp | 2 |
3 files changed, 27 insertions, 11 deletions
diff --git a/src/VLCInput.cpp b/src/VLCInput.cpp index 492d4e6..7f6aae8 100644 --- a/src/VLCInput.cpp +++ b/src/VLCInput.cpp @@ -309,7 +309,7 @@ ssize_t VLCInput::m_read(uint8_t* buf, size_t length) return err; } -ssize_t VLCInput::read(uint8_t* buf, size_t length) +ssize_t VLCInputDirect::read(uint8_t* buf, size_t length) { int bytes_per_frame = m_channels * BYTES_PER_SAMPLE; assert(length % bytes_per_frame == 0); 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 diff --git a/src/dabplus-enc.cpp b/src/dabplus-enc.cpp index 8f72073..cab87b7 100644 --- a/src/dabplus-enc.cpp +++ b/src/dabplus-enc.cpp @@ -605,7 +605,7 @@ int main(int argc, char *argv[]) JackInput jack_in(jack_name, channels, sample_rate, queue); #endif #if HAVE_VLC - VLCInput vlc_in(vlc_uri, sample_rate, channels, verbosity, vlc_gain, vlc_cache); + VLCInputDirect vlc_in(vlc_uri, sample_rate, channels, verbosity, vlc_gain, vlc_cache); #endif if (infile) { |