Switch stream readers to use asio event loop

This commit is contained in:
badaix 2020-01-03 22:40:34 +01:00
parent 3eab397543
commit 6d7e25e9af
30 changed files with 630 additions and 583 deletions

View file

@ -1,6 +1,6 @@
/***
This file is part of snapcast
Copyright (C) 2014-2019 Johannes Pohl
Copyright (C) 2014-2020 Johannes Pohl
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -16,12 +16,13 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef FILE_STREAM_H
#define FILE_STREAM_H
#ifndef FILE_STREAM_HPP
#define FILE_STREAM_HPP
#include "pcm_stream.hpp"
#include <fstream>
#include "posix_stream.hpp"
namespace streamreader
{
/// Reads and decodes PCM data from a file
/**
@ -29,17 +30,16 @@
* Implements EncoderListener to get the encoded data.
* Data is passed to the PcmListener
*/
class FileStream : public PcmStream
class FileStream : public PosixStream
{
public:
/// ctor. Encoded PCM data is passed to the PipeListener
FileStream(PcmListener* pcmListener, boost::asio::io_context& ioc, const StreamUri& uri);
~FileStream() override;
protected:
void worker() override;
std::ifstream ifs;
void do_connect() override;
};
} // namespace streamreader
#endif