1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

for #738, use reader and seeker for mp4 demuxer to seek for general mp4(ftyp-mdat-moov).

This commit is contained in:
winlin 2017-02-03 22:49:19 +08:00
parent bbee16e4db
commit 9d21a8bb33
16 changed files with 237 additions and 101 deletions

View file

@ -51,6 +51,37 @@ public:
virtual int read(void* buf, size_t size, ssize_t* nread) = 0;
};
/**
* The seeker to seek with a device.
*/
class ISrsSeeker
{
public:
ISrsSeeker();
virtual ~ISrsSeeker();
public:
/**
* The lseek() function repositions the offset of the file descriptor fildes to the argument offset, according to the
* directive whence. lseek() repositions the file pointer fildes as follows:
* If whence is SEEK_SET, the offset is set to offset bytes.
* If whence is SEEK_CUR, the offset is set to its current location plus offset bytes.
* If whence is SEEK_END, the offset is set to the size of the file plus offset bytes.
* @param seeked Upon successful completion, lseek() returns the resulting offset location as measured in bytes from
* the beginning of the file. NULL to ignore.
*/
virtual int lseek(off_t offset, int whence, off_t* seeked) = 0;
};
/**
* The reader and seeker.
*/
class ISrsReadSeeker : virtual public ISrsReader, virtual public ISrsSeeker
{
public:
ISrsReadSeeker();
virtual ~ISrsReadSeeker();
};
/**
* The writer to write stream data to channel.
*/
@ -79,6 +110,8 @@ public:
/**
* write iov over writer.
* @nwrite the actual written bytes. NULL to ignore.
* @remark for the HTTP FLV, to writev to improve performance.
* @see https://github.com/ossrs/srs/issues/405
*/
virtual int writev(const iovec *iov, int iov_size, ssize_t* nwrite) = 0;
};
@ -93,5 +126,15 @@ public:
virtual ~ISrsWriter();
};
/**
* The writer and seeker.
*/
class ISrsWriteSeeker : virtual public ISrsWriter, virtual public ISrsSeeker
{
public:
ISrsWriteSeeker();
virtual ~ISrsWriteSeeker();
};
#endif