1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-02-15 04:42:04 +00:00
srs/trunk/src/kernel/srs_kernel_stream.hpp

53 lines
1.1 KiB
C++
Raw Normal View History

//
2024-01-01 02:51:24 +00:00
// Copyright (c) 2013-2024 The SRS Authors
//
2023-10-23 06:33:19 +00:00
// SPDX-License-Identifier: MIT
//
2015-09-22 00:52:00 +00:00
#ifndef SRS_KERNEL_STREAM_HPP
#define SRS_KERNEL_STREAM_HPP
#include <srs_core.hpp>
#include <vector>
/**
2017-03-25 09:21:39 +00:00
* the simple buffer use vector to append bytes,
* it's for hls and http, and need to be refined in future.
*/
class SrsSimpleStream
{
private:
std::vector<char> data;
public:
SrsSimpleStream();
virtual ~SrsSimpleStream();
public:
/**
2017-03-25 09:21:39 +00:00
* get the length of buffer. empty if zero.
* @remark assert length() is not negative.
*/
virtual int length();
/**
2017-03-25 09:21:39 +00:00
* get the buffer bytes.
* @return the bytes, NULL if empty.
*/
virtual char* bytes();
/**
2017-03-25 09:21:39 +00:00
* erase size of bytes from begin.
* @param size to erase size of bytes.
* clear if size greater than or equals to length()
* @remark ignore size is not positive.
*/
virtual void erase(int size);
/**
2017-03-25 09:21:39 +00:00
* append specified bytes to buffer.
* @param size the size of bytes
* @remark assert size is positive.
*/
virtual void append(const char* bytes, int size);
2019-11-22 04:06:15 +00:00
virtual void append(SrsSimpleStream* src);
};
#endif