Path: blob/a-new-beginning/libavformat.xcframework/ios-arm64/libavformat.framework/Headers/avio.h
2 views
/*1* copyright (c) 2001 Fabrice Bellard2*3* This file is part of FFmpeg.4*5* FFmpeg is free software; you can redistribute it and/or6* modify it under the terms of the GNU Lesser General Public7* License as published by the Free Software Foundation; either8* version 2.1 of the License, or (at your option) any later version.9*10* FFmpeg is distributed in the hope that it will be useful,11* but WITHOUT ANY WARRANTY; without even the implied warranty of12* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU13* Lesser General Public License for more details.14*15* You should have received a copy of the GNU Lesser General Public16* License along with FFmpeg; if not, write to the Free Software17* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA18*/19#ifndef AVFORMAT_AVIO_H20#define AVFORMAT_AVIO_H2122/**23* @file24* @ingroup lavf_io25* Buffered I/O operations26*/2728#include <stdint.h>29#include <stdio.h>3031#include "libavutil/attributes.h"32#include "libavutil/dict.h"33#include "libavutil/log.h"3435#include "libavformat/version_major.h"3637/**38* Seeking works like for a local file.39*/40#define AVIO_SEEKABLE_NORMAL (1 << 0)4142/**43* Seeking by timestamp with avio_seek_time() is possible.44*/45#define AVIO_SEEKABLE_TIME (1 << 1)4647/**48* Callback for checking whether to abort blocking functions.49* AVERROR_EXIT is returned in this case by the interrupted50* function. During blocking operations, callback is called with51* opaque as parameter. If the callback returns 1, the52* blocking operation will be aborted.53*54* No members can be added to this struct without a major bump, if55* new elements have been added after this struct in AVFormatContext56* or AVIOContext.57*/58typedef struct AVIOInterruptCB {59int (*callback)(void*);60void *opaque;61} AVIOInterruptCB;6263/**64* Directory entry types.65*/66enum AVIODirEntryType {67AVIO_ENTRY_UNKNOWN,68AVIO_ENTRY_BLOCK_DEVICE,69AVIO_ENTRY_CHARACTER_DEVICE,70AVIO_ENTRY_DIRECTORY,71AVIO_ENTRY_NAMED_PIPE,72AVIO_ENTRY_SYMBOLIC_LINK,73AVIO_ENTRY_SOCKET,74AVIO_ENTRY_FILE,75AVIO_ENTRY_SERVER,76AVIO_ENTRY_SHARE,77AVIO_ENTRY_WORKGROUP,78};7980/**81* Describes single entry of the directory.82*83* Only name and type fields are guaranteed be set.84* Rest of fields are protocol or/and platform dependent and might be unknown.85*/86typedef struct AVIODirEntry {87char *name; /**< Filename */88int type; /**< Type of the entry */89int utf8; /**< Set to 1 when name is encoded with UTF-8, 0 otherwise.90Name can be encoded with UTF-8 even though 0 is set. */91int64_t size; /**< File size in bytes, -1 if unknown. */92int64_t modification_timestamp; /**< Time of last modification in microseconds since unix93epoch, -1 if unknown. */94int64_t access_timestamp; /**< Time of last access in microseconds since unix epoch,95-1 if unknown. */96int64_t status_change_timestamp; /**< Time of last status change in microseconds since unix97epoch, -1 if unknown. */98int64_t user_id; /**< User ID of owner, -1 if unknown. */99int64_t group_id; /**< Group ID of owner, -1 if unknown. */100int64_t filemode; /**< Unix file mode, -1 if unknown. */101} AVIODirEntry;102103#if FF_API_AVIODIRCONTEXT104typedef struct AVIODirContext {105struct URLContext *url_context;106} AVIODirContext;107#else108typedef struct AVIODirContext AVIODirContext;109#endif110111/**112* Different data types that can be returned via the AVIO113* write_data_type callback.114*/115enum AVIODataMarkerType {116/**117* Header data; this needs to be present for the stream to be decodeable.118*/119AVIO_DATA_MARKER_HEADER,120/**121* A point in the output bytestream where a decoder can start decoding122* (i.e. a keyframe). A demuxer/decoder given the data flagged with123* AVIO_DATA_MARKER_HEADER, followed by any AVIO_DATA_MARKER_SYNC_POINT,124* should give decodeable results.125*/126AVIO_DATA_MARKER_SYNC_POINT,127/**128* A point in the output bytestream where a demuxer can start parsing129* (for non self synchronizing bytestream formats). That is, any130* non-keyframe packet start point.131*/132AVIO_DATA_MARKER_BOUNDARY_POINT,133/**134* This is any, unlabelled data. It can either be a muxer not marking135* any positions at all, it can be an actual boundary/sync point136* that the muxer chooses not to mark, or a later part of a packet/fragment137* that is cut into multiple write callbacks due to limited IO buffer size.138*/139AVIO_DATA_MARKER_UNKNOWN,140/**141* Trailer data, which doesn't contain actual content, but only for142* finalizing the output file.143*/144AVIO_DATA_MARKER_TRAILER,145/**146* A point in the output bytestream where the underlying AVIOContext might147* flush the buffer depending on latency or buffering requirements. Typically148* means the end of a packet.149*/150AVIO_DATA_MARKER_FLUSH_POINT,151};152153/**154* Bytestream IO Context.155* New public fields can be added with minor version bumps.156* Removal, reordering and changes to existing public fields require157* a major version bump.158* sizeof(AVIOContext) must not be used outside libav*.159*160* @note None of the function pointers in AVIOContext should be called161* directly, they should only be set by the client application162* when implementing custom I/O. Normally these are set to the163* function pointers specified in avio_alloc_context()164*/165typedef struct AVIOContext {166/**167* A class for private options.168*169* If this AVIOContext is created by avio_open2(), av_class is set and170* passes the options down to protocols.171*172* If this AVIOContext is manually allocated, then av_class may be set by173* the caller.174*175* warning -- this field can be NULL, be sure to not pass this AVIOContext176* to any av_opt_* functions in that case.177*/178const AVClass *av_class;179180/*181* The following shows the relationship between buffer, buf_ptr,182* buf_ptr_max, buf_end, buf_size, and pos, when reading and when writing183* (since AVIOContext is used for both):184*185**********************************************************************************186* READING187**********************************************************************************188*189* | buffer_size |190* |---------------------------------------|191* | |192*193* buffer buf_ptr buf_end194* +---------------+-----------------------+195* |/ / / / / / / /|/ / / / / / /| |196* read buffer: |/ / consumed / | to be read /| |197* |/ / / / / / / /|/ / / / / / /| |198* +---------------+-----------------------+199*200* pos201* +-------------------------------------------+-----------------+202* input file: | | |203* +-------------------------------------------+-----------------+204*205*206**********************************************************************************207* WRITING208**********************************************************************************209*210* | buffer_size |211* |--------------------------------------|212* | |213*214* buf_ptr_max215* buffer (buf_ptr) buf_end216* +-----------------------+--------------+217* |/ / / / / / / / / / / /| |218* write buffer: | / / to be flushed / / | |219* |/ / / / / / / / / / / /| |220* +-----------------------+--------------+221* buf_ptr can be in this222* due to a backward seek223*224* pos225* +-------------+----------------------------------------------+226* output file: | | |227* +-------------+----------------------------------------------+228*229*/230unsigned char *buffer; /**< Start of the buffer. */231int buffer_size; /**< Maximum buffer size */232unsigned char *buf_ptr; /**< Current position in the buffer */233unsigned char *buf_end; /**< End of the data, may be less than234buffer+buffer_size if the read function returned235less data than requested, e.g. for streams where236no more data has been received yet. */237void *opaque; /**< A private pointer, passed to the read/write/seek/...238functions. */239int (*read_packet)(void *opaque, uint8_t *buf, int buf_size);240int (*write_packet)(void *opaque, uint8_t *buf, int buf_size);241int64_t (*seek)(void *opaque, int64_t offset, int whence);242int64_t pos; /**< position in the file of the current buffer */243int eof_reached; /**< true if was unable to read due to error or eof */244int error; /**< contains the error code or 0 if no error happened */245int write_flag; /**< true if open for writing */246int max_packet_size;247int min_packet_size; /**< Try to buffer at least this amount of data248before flushing it. */249unsigned long checksum;250unsigned char *checksum_ptr;251unsigned long (*update_checksum)(unsigned long checksum, const uint8_t *buf, unsigned int size);252/**253* Pause or resume playback for network streaming protocols - e.g. MMS.254*/255int (*read_pause)(void *opaque, int pause);256/**257* Seek to a given timestamp in stream with the specified stream_index.258* Needed for some network streaming protocols which don't support seeking259* to byte position.260*/261int64_t (*read_seek)(void *opaque, int stream_index,262int64_t timestamp, int flags);263/**264* A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable.265*/266int seekable;267268/**269* avio_read and avio_write should if possible be satisfied directly270* instead of going through a buffer, and avio_seek will always271* call the underlying seek function directly.272*/273int direct;274275/**276* ',' separated list of allowed protocols.277*/278const char *protocol_whitelist;279280/**281* ',' separated list of disallowed protocols.282*/283const char *protocol_blacklist;284285/**286* A callback that is used instead of write_packet.287*/288int (*write_data_type)(void *opaque, uint8_t *buf, int buf_size,289enum AVIODataMarkerType type, int64_t time);290/**291* If set, don't call write_data_type separately for AVIO_DATA_MARKER_BOUNDARY_POINT,292* but ignore them and treat them as AVIO_DATA_MARKER_UNKNOWN (to avoid needlessly293* small chunks of data returned from the callback).294*/295int ignore_boundary_point;296297/**298* Maximum reached position before a backward seek in the write buffer,299* used keeping track of already written data for a later flush.300*/301unsigned char *buf_ptr_max;302303/**304* Read-only statistic of bytes read for this AVIOContext.305*/306int64_t bytes_read;307308/**309* Read-only statistic of bytes written for this AVIOContext.310*/311int64_t bytes_written;312} AVIOContext;313314/**315* Return the name of the protocol that will handle the passed URL.316*317* NULL is returned if no protocol could be found for the given URL.318*319* @return Name of the protocol or NULL.320*/321const char *avio_find_protocol_name(const char *url);322323/**324* Return AVIO_FLAG_* access flags corresponding to the access permissions325* of the resource in url, or a negative value corresponding to an326* AVERROR code in case of failure. The returned access flags are327* masked by the value in flags.328*329* @note This function is intrinsically unsafe, in the sense that the330* checked resource may change its existence or permission status from331* one call to another. Thus you should not trust the returned value,332* unless you are sure that no other processes are accessing the333* checked resource.334*/335int avio_check(const char *url, int flags);336337/**338* Open directory for reading.339*340* @param s directory read context. Pointer to a NULL pointer must be passed.341* @param url directory to be listed.342* @param options A dictionary filled with protocol-private options. On return343* this parameter will be destroyed and replaced with a dictionary344* containing options that were not found. May be NULL.345* @return >=0 on success or negative on error.346*/347int avio_open_dir(AVIODirContext **s, const char *url, AVDictionary **options);348349/**350* Get next directory entry.351*352* Returned entry must be freed with avio_free_directory_entry(). In particular353* it may outlive AVIODirContext.354*355* @param s directory read context.356* @param[out] next next entry or NULL when no more entries.357* @return >=0 on success or negative on error. End of list is not considered an358* error.359*/360int avio_read_dir(AVIODirContext *s, AVIODirEntry **next);361362/**363* Close directory.364*365* @note Entries created using avio_read_dir() are not deleted and must be366* freeded with avio_free_directory_entry().367*368* @param s directory read context.369* @return >=0 on success or negative on error.370*/371int avio_close_dir(AVIODirContext **s);372373/**374* Free entry allocated by avio_read_dir().375*376* @param entry entry to be freed.377*/378void avio_free_directory_entry(AVIODirEntry **entry);379380/**381* Allocate and initialize an AVIOContext for buffered I/O. It must be later382* freed with avio_context_free().383*384* @param buffer Memory block for input/output operations via AVIOContext.385* The buffer must be allocated with av_malloc() and friends.386* It may be freed and replaced with a new buffer by libavformat.387* AVIOContext.buffer holds the buffer currently in use,388* which must be later freed with av_free().389* @param buffer_size The buffer size is very important for performance.390* For protocols with fixed blocksize it should be set to this blocksize.391* For others a typical size is a cache page, e.g. 4kb.392* @param write_flag Set to 1 if the buffer should be writable, 0 otherwise.393* @param opaque An opaque pointer to user-specific data.394* @param read_packet A function for refilling the buffer, may be NULL.395* For stream protocols, must never return 0 but rather396* a proper AVERROR code.397* @param write_packet A function for writing the buffer contents, may be NULL.398* The function may not change the input buffers content.399* @param seek A function for seeking to specified byte position, may be NULL.400*401* @return Allocated AVIOContext or NULL on failure.402*/403AVIOContext *avio_alloc_context(404unsigned char *buffer,405int buffer_size,406int write_flag,407void *opaque,408int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),409int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),410int64_t (*seek)(void *opaque, int64_t offset, int whence));411412/**413* Free the supplied IO context and everything associated with it.414*415* @param s Double pointer to the IO context. This function will write NULL416* into s.417*/418void avio_context_free(AVIOContext **s);419420void avio_w8(AVIOContext *s, int b);421void avio_write(AVIOContext *s, const unsigned char *buf, int size);422void avio_wl64(AVIOContext *s, uint64_t val);423void avio_wb64(AVIOContext *s, uint64_t val);424void avio_wl32(AVIOContext *s, unsigned int val);425void avio_wb32(AVIOContext *s, unsigned int val);426void avio_wl24(AVIOContext *s, unsigned int val);427void avio_wb24(AVIOContext *s, unsigned int val);428void avio_wl16(AVIOContext *s, unsigned int val);429void avio_wb16(AVIOContext *s, unsigned int val);430431/**432* Write a NULL-terminated string.433* @return number of bytes written.434*/435int avio_put_str(AVIOContext *s, const char *str);436437/**438* Convert an UTF-8 string to UTF-16LE and write it.439* @param s the AVIOContext440* @param str NULL-terminated UTF-8 string441*442* @return number of bytes written.443*/444int avio_put_str16le(AVIOContext *s, const char *str);445446/**447* Convert an UTF-8 string to UTF-16BE and write it.448* @param s the AVIOContext449* @param str NULL-terminated UTF-8 string450*451* @return number of bytes written.452*/453int avio_put_str16be(AVIOContext *s, const char *str);454455/**456* Mark the written bytestream as a specific type.457*458* Zero-length ranges are omitted from the output.459*460* @param s the AVIOContext461* @param time the stream time the current bytestream pos corresponds to462* (in AV_TIME_BASE units), or AV_NOPTS_VALUE if unknown or not463* applicable464* @param type the kind of data written starting at the current pos465*/466void avio_write_marker(AVIOContext *s, int64_t time, enum AVIODataMarkerType type);467468/**469* ORing this as the "whence" parameter to a seek function causes it to470* return the filesize without seeking anywhere. Supporting this is optional.471* If it is not supported then the seek function will return <0.472*/473#define AVSEEK_SIZE 0x10000474475/**476* Passing this flag as the "whence" parameter to a seek function causes it to477* seek by any means (like reopening and linear reading) or other normally unreasonable478* means that can be extremely slow.479* This may be ignored by the seek code.480*/481#define AVSEEK_FORCE 0x20000482483/**484* fseek() equivalent for AVIOContext.485* @return new position or AVERROR.486*/487int64_t avio_seek(AVIOContext *s, int64_t offset, int whence);488489/**490* Skip given number of bytes forward491* @return new position or AVERROR.492*/493int64_t avio_skip(AVIOContext *s, int64_t offset);494495/**496* ftell() equivalent for AVIOContext.497* @return position or AVERROR.498*/499static av_always_inline int64_t avio_tell(AVIOContext *s)500{501return avio_seek(s, 0, SEEK_CUR);502}503504/**505* Get the filesize.506* @return filesize or AVERROR507*/508int64_t avio_size(AVIOContext *s);509510/**511* Similar to feof() but also returns nonzero on read errors.512* @return non zero if and only if at end of file or a read error happened when reading.513*/514int avio_feof(AVIOContext *s);515516/**517* Writes a formatted string to the context taking a va_list.518* @return number of bytes written, < 0 on error.519*/520int avio_vprintf(AVIOContext *s, const char *fmt, va_list ap);521522/**523* Writes a formatted string to the context.524* @return number of bytes written, < 0 on error.525*/526int avio_printf(AVIOContext *s, const char *fmt, ...) av_printf_format(2, 3);527528/**529* Write a NULL terminated array of strings to the context.530* Usually you don't need to use this function directly but its macro wrapper,531* avio_print.532*/533void avio_print_string_array(AVIOContext *s, const char *strings[]);534535/**536* Write strings (const char *) to the context.537* This is a convenience macro around avio_print_string_array and it538* automatically creates the string array from the variable argument list.539* For simple string concatenations this function is more performant than using540* avio_printf since it does not need a temporary buffer.541*/542#define avio_print(s, ...) \543avio_print_string_array(s, (const char*[]){__VA_ARGS__, NULL})544545/**546* Force flushing of buffered data.547*548* For write streams, force the buffered data to be immediately written to the output,549* without to wait to fill the internal buffer.550*551* For read streams, discard all currently buffered data, and advance the552* reported file position to that of the underlying stream. This does not553* read new data, and does not perform any seeks.554*/555void avio_flush(AVIOContext *s);556557/**558* Read size bytes from AVIOContext into buf.559* @return number of bytes read or AVERROR560*/561int avio_read(AVIOContext *s, unsigned char *buf, int size);562563/**564* Read size bytes from AVIOContext into buf. Unlike avio_read(), this is allowed565* to read fewer bytes than requested. The missing bytes can be read in the next566* call. This always tries to read at least 1 byte.567* Useful to reduce latency in certain cases.568* @return number of bytes read or AVERROR569*/570int avio_read_partial(AVIOContext *s, unsigned char *buf, int size);571572/**573* @name Functions for reading from AVIOContext574* @{575*576* @note return 0 if EOF, so you cannot use it if EOF handling is577* necessary578*/579int avio_r8 (AVIOContext *s);580unsigned int avio_rl16(AVIOContext *s);581unsigned int avio_rl24(AVIOContext *s);582unsigned int avio_rl32(AVIOContext *s);583uint64_t avio_rl64(AVIOContext *s);584unsigned int avio_rb16(AVIOContext *s);585unsigned int avio_rb24(AVIOContext *s);586unsigned int avio_rb32(AVIOContext *s);587uint64_t avio_rb64(AVIOContext *s);588/**589* @}590*/591592/**593* Read a string from pb into buf. The reading will terminate when either594* a NULL character was encountered, maxlen bytes have been read, or nothing595* more can be read from pb. The result is guaranteed to be NULL-terminated, it596* will be truncated if buf is too small.597* Note that the string is not interpreted or validated in any way, it598* might get truncated in the middle of a sequence for multi-byte encodings.599*600* @return number of bytes read (is always <= maxlen).601* If reading ends on EOF or error, the return value will be one more than602* bytes actually read.603*/604int avio_get_str(AVIOContext *pb, int maxlen, char *buf, int buflen);605606/**607* Read a UTF-16 string from pb and convert it to UTF-8.608* The reading will terminate when either a null or invalid character was609* encountered or maxlen bytes have been read.610* @return number of bytes read (is always <= maxlen)611*/612int avio_get_str16le(AVIOContext *pb, int maxlen, char *buf, int buflen);613int avio_get_str16be(AVIOContext *pb, int maxlen, char *buf, int buflen);614615616/**617* @name URL open modes618* The flags argument to avio_open must be one of the following619* constants, optionally ORed with other flags.620* @{621*/622#define AVIO_FLAG_READ 1 /**< read-only */623#define AVIO_FLAG_WRITE 2 /**< write-only */624#define AVIO_FLAG_READ_WRITE (AVIO_FLAG_READ|AVIO_FLAG_WRITE) /**< read-write pseudo flag */625/**626* @}627*/628629/**630* Use non-blocking mode.631* If this flag is set, operations on the context will return632* AVERROR(EAGAIN) if they can not be performed immediately.633* If this flag is not set, operations on the context will never return634* AVERROR(EAGAIN).635* Note that this flag does not affect the opening/connecting of the636* context. Connecting a protocol will always block if necessary (e.g. on637* network protocols) but never hang (e.g. on busy devices).638* Warning: non-blocking protocols is work-in-progress; this flag may be639* silently ignored.640*/641#define AVIO_FLAG_NONBLOCK 8642643/**644* Use direct mode.645* avio_read and avio_write should if possible be satisfied directly646* instead of going through a buffer, and avio_seek will always647* call the underlying seek function directly.648*/649#define AVIO_FLAG_DIRECT 0x8000650651/**652* Create and initialize a AVIOContext for accessing the653* resource indicated by url.654* @note When the resource indicated by url has been opened in655* read+write mode, the AVIOContext can be used only for writing.656*657* @param s Used to return the pointer to the created AVIOContext.658* In case of failure the pointed to value is set to NULL.659* @param url resource to access660* @param flags flags which control how the resource indicated by url661* is to be opened662* @return >= 0 in case of success, a negative value corresponding to an663* AVERROR code in case of failure664*/665int avio_open(AVIOContext **s, const char *url, int flags);666667/**668* Create and initialize a AVIOContext for accessing the669* resource indicated by url.670* @note When the resource indicated by url has been opened in671* read+write mode, the AVIOContext can be used only for writing.672*673* @param s Used to return the pointer to the created AVIOContext.674* In case of failure the pointed to value is set to NULL.675* @param url resource to access676* @param flags flags which control how the resource indicated by url677* is to be opened678* @param int_cb an interrupt callback to be used at the protocols level679* @param options A dictionary filled with protocol-private options. On return680* this parameter will be destroyed and replaced with a dict containing options681* that were not found. May be NULL.682* @return >= 0 in case of success, a negative value corresponding to an683* AVERROR code in case of failure684*/685int avio_open2(AVIOContext **s, const char *url, int flags,686const AVIOInterruptCB *int_cb, AVDictionary **options);687688/**689* Close the resource accessed by the AVIOContext s and free it.690* This function can only be used if s was opened by avio_open().691*692* The internal buffer is automatically flushed before closing the693* resource.694*695* @return 0 on success, an AVERROR < 0 on error.696* @see avio_closep697*/698int avio_close(AVIOContext *s);699700/**701* Close the resource accessed by the AVIOContext *s, free it702* and set the pointer pointing to it to NULL.703* This function can only be used if s was opened by avio_open().704*705* The internal buffer is automatically flushed before closing the706* resource.707*708* @return 0 on success, an AVERROR < 0 on error.709* @see avio_close710*/711int avio_closep(AVIOContext **s);712713714/**715* Open a write only memory stream.716*717* @param s new IO context718* @return zero if no error.719*/720int avio_open_dyn_buf(AVIOContext **s);721722/**723* Return the written size and a pointer to the buffer.724* The AVIOContext stream is left intact.725* The buffer must NOT be freed.726* No padding is added to the buffer.727*728* @param s IO context729* @param pbuffer pointer to a byte buffer730* @return the length of the byte buffer731*/732int avio_get_dyn_buf(AVIOContext *s, uint8_t **pbuffer);733734/**735* Return the written size and a pointer to the buffer. The buffer736* must be freed with av_free().737* Padding of AV_INPUT_BUFFER_PADDING_SIZE is added to the buffer.738*739* @param s IO context740* @param pbuffer pointer to a byte buffer741* @return the length of the byte buffer742*/743int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer);744745/**746* Iterate through names of available protocols.747*748* @param opaque A private pointer representing current protocol.749* It must be a pointer to NULL on first iteration and will750* be updated by successive calls to avio_enum_protocols.751* @param output If set to 1, iterate over output protocols,752* otherwise over input protocols.753*754* @return A static string containing the name of current protocol or NULL755*/756const char *avio_enum_protocols(void **opaque, int output);757758/**759* Get AVClass by names of available protocols.760*761* @return A AVClass of input protocol name or NULL762*/763const AVClass *avio_protocol_get_class(const char *name);764765/**766* Pause and resume playing - only meaningful if using a network streaming767* protocol (e.g. MMS).768*769* @param h IO context from which to call the read_pause function pointer770* @param pause 1 for pause, 0 for resume771*/772int avio_pause(AVIOContext *h, int pause);773774/**775* Seek to a given timestamp relative to some component stream.776* Only meaningful if using a network streaming protocol (e.g. MMS.).777*778* @param h IO context from which to call the seek function pointers779* @param stream_index The stream index that the timestamp is relative to.780* If stream_index is (-1) the timestamp should be in AV_TIME_BASE781* units from the beginning of the presentation.782* If a stream_index >= 0 is used and the protocol does not support783* seeking based on component streams, the call will fail.784* @param timestamp timestamp in AVStream.time_base units785* or if there is no stream specified then in AV_TIME_BASE units.786* @param flags Optional combination of AVSEEK_FLAG_BACKWARD, AVSEEK_FLAG_BYTE787* and AVSEEK_FLAG_ANY. The protocol may silently ignore788* AVSEEK_FLAG_BACKWARD and AVSEEK_FLAG_ANY, but AVSEEK_FLAG_BYTE will789* fail if used and not supported.790* @return >= 0 on success791* @see AVInputFormat::read_seek792*/793int64_t avio_seek_time(AVIOContext *h, int stream_index,794int64_t timestamp, int flags);795796/* Avoid a warning. The header can not be included because it breaks c++. */797struct AVBPrint;798799/**800* Read contents of h into print buffer, up to max_size bytes, or up to EOF.801*802* @return 0 for success (max_size bytes read or EOF reached), negative error803* code otherwise804*/805int avio_read_to_bprint(AVIOContext *h, struct AVBPrint *pb, size_t max_size);806807/**808* Accept and allocate a client context on a server context.809* @param s the server context810* @param c the client context, must be unallocated811* @return >= 0 on success or a negative value corresponding812* to an AVERROR on failure813*/814int avio_accept(AVIOContext *s, AVIOContext **c);815816/**817* Perform one step of the protocol handshake to accept a new client.818* This function must be called on a client returned by avio_accept() before819* using it as a read/write context.820* It is separate from avio_accept() because it may block.821* A step of the handshake is defined by places where the application may822* decide to change the proceedings.823* For example, on a protocol with a request header and a reply header, each824* one can constitute a step because the application may use the parameters825* from the request to change parameters in the reply; or each individual826* chunk of the request can constitute a step.827* If the handshake is already finished, avio_handshake() does nothing and828* returns 0 immediately.829*830* @param c the client context to perform the handshake on831* @return 0 on a complete and successful handshake832* > 0 if the handshake progressed, but is not complete833* < 0 for an AVERROR code834*/835int avio_handshake(AVIOContext *c);836#endif /* AVFORMAT_AVIO_H */837838839