mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
for #742, refine the io interfaces.
This commit is contained in:
parent
eaa222f034
commit
d3bb8b6a86
9 changed files with 73 additions and 33 deletions
|
@ -36,33 +36,42 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#endif
|
||||
|
||||
/**
|
||||
* the reader for the buffer to read from whatever channel.
|
||||
* The reader to read data from channel.
|
||||
*/
|
||||
class ISrsBufferReader
|
||||
class ISrsReader
|
||||
{
|
||||
public:
|
||||
ISrsBufferReader();
|
||||
virtual ~ISrsBufferReader();
|
||||
// for protocol/amf0/msg-codec
|
||||
ISrsReader();
|
||||
virtual ~ISrsReader();
|
||||
public:
|
||||
virtual int read(void* buf, size_t size, ssize_t* nread) = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* the writer for the buffer to write to whatever channel.
|
||||
* The writer to write stream data to channel.
|
||||
*/
|
||||
class ISrsBufferWriter
|
||||
class ISrsStreamWriter
|
||||
{
|
||||
public:
|
||||
ISrsBufferWriter();
|
||||
virtual ~ISrsBufferWriter();
|
||||
// for protocol
|
||||
ISrsStreamWriter();
|
||||
virtual ~ISrsStreamWriter();
|
||||
public:
|
||||
/**
|
||||
* write bytes over writer.
|
||||
* @nwrite the actual written bytes. NULL to ignore.
|
||||
*/
|
||||
virtual int write(void* buf, size_t size, ssize_t* nwrite) = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* The vector writer to write vector(iovc) to channel.
|
||||
*/
|
||||
class ISrsVectorWriter
|
||||
{
|
||||
public:
|
||||
ISrsVectorWriter();
|
||||
virtual ~ISrsVectorWriter();
|
||||
public:
|
||||
/**
|
||||
* write iov over writer.
|
||||
* @nwrite the actual written bytes. NULL to ignore.
|
||||
|
@ -70,5 +79,15 @@ public:
|
|||
virtual int writev(const iovec *iov, int iov_size, ssize_t* nwrite) = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* The generally writer, stream and vector writer.
|
||||
*/
|
||||
class ISrsWriter : virtual public ISrsStreamWriter, virtual public ISrsVectorWriter
|
||||
{
|
||||
public:
|
||||
ISrsWriter();
|
||||
virtual ~ISrsWriter();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue