Interface class to customize IO operations with FormatContext.
More...
#include <formatcontext.h>
|
| virtual int | write (const uint8_t *data, size_t size) |
| | Write part of data to the destination.
|
| virtual int | read (uint8_t *data, size_t size) |
| | Read part of data from the data source.
|
| virtual int64_t | seek (int64_t offset, int whence) |
| | Seek in stream.
|
| virtual int | seekable () const |
| | Defines supported types of buffer seeking.
|
| virtual const char * | name () const |
| | Name of the I/O.
|
It can be used for:
- From memory I/O
- mmapped files I/O
- Specific containers reading (tar, zip files, for example)
- Device I/O
- Network I/O
- Pattern generation
- Image output to the display (for the appropriate formats, like rawvideo)
CustomIO object is not owned by the av::FormatContext and must be alived across av::FormatContext life.
◆ name()
| virtual const char * av::CustomIO::name |
( |
| ) |
const |
|
inlinevirtual |
Didn't used for now.
- Returns
- null-terminated name of the Custom I/O implementation
◆ read()
| virtual int av::CustomIO::read |
( |
uint8_t * | data, |
|
|
size_t | size ) |
|
inlinevirtual |
Note, if requested more data that exists to read, you should fill buffer as much as possible and return actual count of the readed data. 0 readed bytes is a valid case, but return it only if there is temporary issues with upstream that can be solved quickly. Otherwise return AVERROR_EOF of AVERROR(EBUSY)/AVERROR(EAGAIN).
- See also
- avio_read()
- Parameters
-
| data | buffer to store data |
| size | size of the buffer |
- Returns
- count of the actually readed data. AVERROR(xxx) for the system errors (errno wrap) or AVERROR_xxx for the FFmpeg errors. AVERROR_EOF should be returns when end of file reached.
◆ seek()
| virtual int64_t av::CustomIO::seek |
( |
int64_t | offset, |
|
|
int | whence ) |
|
inlinevirtual |
whence may support special FFmpeg-ralated values:
- AVSEEK_SIZE - return size without actual seeking. If unsupported, seek() may return <0
- AVSEEK_FORCE - read official FFmpeg documentation. Just ignore it.
- See also
- avio_seek()
- Parameters
-
| offset | offset, may be less zero, equal zero or greater zero. |
| whence | is a one of SEEK_* from stdio.h |
- Returns
- new position or AVERROR
◆ seekable()
| virtual int av::CustomIO::seekable |
( |
| ) |
const |
|
inlinevirtual |
Used to fill AVIOContext::seekable. In any case, seek() work on the byte level.
- Returns
- combination of AVIO_SEEKABLE_* flags or zero
◆ write()
| virtual int av::CustomIO::write |
( |
const uint8_t * | data, |
|
|
size_t | size ) |
|
inlinevirtual |
Note, FFmpeg does not consider return value >0 as the number of bytes actually written and assumes that all data has been written. Be careful. If data can't be fit into destination better return appropriate AVERROR code.
- See also
- avio_write()
- Parameters
-
| data | block of data to write |
| size | size of the data block |
- Returns
- >=0 on success. AVERROR(xxx) for the system errors (errno wrap) or AVERROR_xxx codes.
The documentation for this struct was generated from the following file: