#include <stdint.h>
#include "libavutil/common.h"
Go to the source code of this file.
Data Structures | |
struct | URLContext |
URL Context. More... | |
struct | URLPollEntry |
struct | URLProtocol |
struct | ByteIOContext |
Bytestream IO Context. More... | |
Defines | |
#define | URL_RDONLY 0 |
#define | URL_WRONLY 1 |
#define | URL_RDWR 2 |
#define | AVSEEK_SIZE 0x10000 |
Passing this as the "whence" parameter to a seek function causes it to return the filesize without seeking anywhere. | |
#define | AVSEEK_FORCE 0x20000 |
Oring this flag as into the "whence" parameter to a seek function causes it to seek by any means (like reopening and linear reading) or other normally unreasonble means that can be extreemly slow. | |
#define | URL_EOF (-1) |
Typedefs | |
typedef int | URLInterruptCB (void) |
Functions | |
int | url_open_protocol (URLContext **puc, struct URLProtocol *up, const char *url, int flags) |
Creates an URLContext for accessing to the resource indicated by url, and opens it using the URLProtocol up. | |
int | url_open (URLContext **h, const char *url, int flags) |
Creates an URLContext for accessing to the resource indicated by url, and opens it. | |
int | url_read (URLContext *h, unsigned char *buf, int size) |
Reads up to size bytes from the resource accessed by h, and stores the read bytes in buf. | |
int | url_read_complete (URLContext *h, unsigned char *buf, int size) |
Read as many bytes as possible (up to size), calling the read function multiple times if necessary. | |
int | url_write (URLContext *h, unsigned char *buf, int size) |
int64_t | url_seek (URLContext *h, int64_t pos, int whence) |
Changes the position that will be used by the next read/write operation on the resource accessed by h. | |
int | url_close (URLContext *h) |
Closes the resource accessed by the URLContext h, and frees the memory used by it. | |
int | url_exist (const char *url) |
Returns a non-zero value if the resource indicated by url exists, 0 otherwise. | |
int64_t | url_filesize (URLContext *h) |
int | url_get_file_handle (URLContext *h) |
Return the file descriptor associated with this URL. | |
int | url_get_max_packet_size (URLContext *h) |
Return the maximum packet size associated to packetized file handle. | |
void | url_get_filename (URLContext *h, char *buf, int buf_size) |
void | url_set_interrupt_cb (URLInterruptCB *interrupt_cb) |
The callback is called in blocking functions to test regulary if asynchronous interruption is needed. | |
int | url_poll (URLPollEntry *poll_table, int n, int timeout) |
int | av_url_read_pause (URLContext *h, int pause) |
Pause and resume playing - only meaningful if using a network streaming protocol (e.g. | |
int64_t | av_url_read_seek (URLContext *h, int stream_index, int64_t timestamp, int flags) |
Seek to a given timestamp relative to some component stream. | |
URLProtocol * | av_protocol_next (URLProtocol *p) |
If protocol is NULL, returns the first registered protocol, if protocol is non-NULL, returns the next registered protocol after protocol, or NULL if protocol is the last one. | |
attribute_deprecated int | register_protocol (URLProtocol *protocol) |
int | av_register_protocol (URLProtocol *protocol) |
Registers the URLProtocol protocol. | |
int | init_put_byte (ByteIOContext *s, unsigned char *buffer, int buffer_size, int write_flag, void *opaque, int(*read_packet)(void *opaque, uint8_t *buf, int buf_size), int(*write_packet)(void *opaque, uint8_t *buf, int buf_size), int64_t(*seek)(void *opaque, int64_t offset, int whence)) |
ByteIOContext * | av_alloc_put_byte (unsigned char *buffer, int buffer_size, int write_flag, void *opaque, int(*read_packet)(void *opaque, uint8_t *buf, int buf_size), int(*write_packet)(void *opaque, uint8_t *buf, int buf_size), int64_t(*seek)(void *opaque, int64_t offset, int whence)) |
void | put_byte (ByteIOContext *s, int b) |
void | put_buffer (ByteIOContext *s, const unsigned char *buf, int size) |
void | put_le64 (ByteIOContext *s, uint64_t val) |
void | put_be64 (ByteIOContext *s, uint64_t val) |
void | put_le32 (ByteIOContext *s, unsigned int val) |
void | put_be32 (ByteIOContext *s, unsigned int val) |
void | put_le24 (ByteIOContext *s, unsigned int val) |
void | put_be24 (ByteIOContext *s, unsigned int val) |
void | put_le16 (ByteIOContext *s, unsigned int val) |
void | put_be16 (ByteIOContext *s, unsigned int val) |
void | put_tag (ByteIOContext *s, const char *tag) |
void | put_strz (ByteIOContext *s, const char *buf) |
int64_t | url_fseek (ByteIOContext *s, int64_t offset, int whence) |
fseek() equivalent for ByteIOContext. | |
void | url_fskip (ByteIOContext *s, int64_t offset) |
Skip given number of bytes forward. | |
int64_t | url_ftell (ByteIOContext *s) |
ftell() equivalent for ByteIOContext. | |
int64_t | url_fsize (ByteIOContext *s) |
Gets the filesize. | |
int | url_feof (ByteIOContext *s) |
feof() equivalent for ByteIOContext. | |
int | url_ferror (ByteIOContext *s) |
int | av_url_read_fpause (ByteIOContext *h, int pause) |
int64_t | av_url_read_fseek (ByteIOContext *h, int stream_index, int64_t timestamp, int flags) |
int | url_fgetc (ByteIOContext *s) |
int | url_fprintf (ByteIOContext *s, const char *fmt,...) |
char * | url_fgets (ByteIOContext *s, char *buf, int buf_size) |
void | put_flush_packet (ByteIOContext *s) |
int | get_buffer (ByteIOContext *s, unsigned char *buf, int size) |
Reads size bytes from ByteIOContext into buf. | |
int | get_partial_buffer (ByteIOContext *s, unsigned char *buf, int size) |
Reads size bytes from ByteIOContext into buf. | |
int | get_byte (ByteIOContext *s) |
unsigned int | get_le24 (ByteIOContext *s) |
unsigned int | get_le32 (ByteIOContext *s) |
uint64_t | get_le64 (ByteIOContext *s) |
unsigned int | get_le16 (ByteIOContext *s) |
char * | get_strz (ByteIOContext *s, char *buf, int maxlen) |
unsigned int | get_be16 (ByteIOContext *s) |
unsigned int | get_be24 (ByteIOContext *s) |
unsigned int | get_be32 (ByteIOContext *s) |
uint64_t | get_be64 (ByteIOContext *s) |
uint64_t | ff_get_v (ByteIOContext *bc) |
static int | url_is_streamed (ByteIOContext *s) |
int | url_fdopen (ByteIOContext **s, URLContext *h) |
Creates and initializes a ByteIOContext for accessing the resource referenced by the URLContext h. | |
int | url_setbufsize (ByteIOContext *s, int buf_size) |
int | url_resetbuf (ByteIOContext *s, int flags) |
Reset the buffer for reading or writing. | |
int | ff_rewind_with_probe_data (ByteIOContext *s, unsigned char *buf, int buf_size) |
Rewinds the ByteIOContext using the specified buffer containing the first buf_size bytes of the file. | |
int | url_fopen (ByteIOContext **s, const char *url, int flags) |
Creates and initializes a ByteIOContext for accessing the resource indicated by url. | |
int | url_fclose (ByteIOContext *s) |
URLContext * | url_fileno (ByteIOContext *s) |
int | url_fget_max_packet_size (ByteIOContext *s) |
Return the maximum packet size associated to packetized buffered file handle. | |
int | url_open_buf (ByteIOContext **s, uint8_t *buf, int buf_size, int flags) |
int | url_close_buf (ByteIOContext *s) |
return the written or read size | |
int | url_open_dyn_buf (ByteIOContext **s) |
Open a write only memory stream. | |
int | url_open_dyn_packet_buf (ByteIOContext **s, int max_packet_size) |
Open a write only packetized memory stream with a maximum packet size of 'max_packet_size'. | |
int | url_close_dyn_buf (ByteIOContext *s, uint8_t **pbuffer) |
Return the written size and a pointer to the buffer. | |
unsigned long | ff_crc04C11DB7_update (unsigned long checksum, const uint8_t *buf, unsigned int len) |
unsigned long | get_checksum (ByteIOContext *s) |
void | init_checksum (ByteIOContext *s, unsigned long(*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len), unsigned long checksum) |
int | udp_set_remote_url (URLContext *h, const char *uri) |
If no filename is given to av_open_input_file because you want to get the local port first, then you must call this function to set the remote server address. | |
int | udp_get_local_port (URLContext *h) |
Return the local port used by the UDP connexion. | |
int | udp_get_file_handle (URLContext *h) |
Return the udp file handle for select() usage to wait for several RTP streams at the same time. | |
Variables | |
URLProtocol * | first_protocol |
URLInterruptCB * | url_interrupt_cb |
#define AVSEEK_FORCE 0x20000 |
#define AVSEEK_SIZE 0x10000 |
typedef int URLInterruptCB(void) |
ByteIOContext* av_alloc_put_byte | ( | unsigned char * | buffer, | |
int | buffer_size, | |||
int | write_flag, | |||
void * | opaque, | |||
int(*)(void *opaque, uint8_t *buf, int buf_size) | read_packet, | |||
int(*)(void *opaque, uint8_t *buf, int buf_size) | write_packet, | |||
int64_t(*)(void *opaque, int64_t offset, int whence) | seek | |||
) |
URLProtocol* av_protocol_next | ( | URLProtocol * | p | ) |
int av_register_protocol | ( | URLProtocol * | protocol | ) |
int av_url_read_fpause | ( | ByteIOContext * | h, | |
int | pause | |||
) |
int64_t av_url_read_fseek | ( | ByteIOContext * | h, | |
int | stream_index, | |||
int64_t | timestamp, | |||
int | flags | |||
) |
int av_url_read_pause | ( | URLContext * | h, | |
int | pause | |||
) |
int64_t av_url_read_seek | ( | URLContext * | h, | |
int | stream_index, | |||
int64_t | timestamp, | |||
int | flags | |||
) |
Seek to a given timestamp relative to some component stream.
Only meaningful if using a network streaming protocol (e.g. MMS.).
stream_index | The stream index that the timestamp is relative to. If stream_index is (-1) the timestamp should be in AV_TIME_BASE units from the beginning of the presentation. If a stream_index >= 0 is used and the protocol does not support seeking based on component streams, the call will fail with ENOTSUP. | |
timestamp | timestamp in AVStream.time_base units or if there is no stream specified then in AV_TIME_BASE units. | |
flags | Optional combination of AVSEEK_FLAG_BACKWARD, AVSEEK_FLAG_BYTE and AVSEEK_FLAG_ANY. The protocol may silently ignore AVSEEK_FLAG_BACKWARD and AVSEEK_FLAG_ANY, but AVSEEK_FLAG_BYTE will fail with ENOTSUP if used and not supported. |
unsigned long ff_crc04C11DB7_update | ( | unsigned long | checksum, | |
const uint8_t * | buf, | |||
unsigned int | len | |||
) |
uint64_t ff_get_v | ( | ByteIOContext * | bc | ) |
int ff_rewind_with_probe_data | ( | ByteIOContext * | s, | |
unsigned char * | buf, | |||
int | buf_size | |||
) |
Rewinds the ByteIOContext using the specified buffer containing the first buf_size bytes of the file.
Used after probing to avoid seeking. Joins buf and s->buffer, taking any overlap into consideration.
This function is NOT part of the public API
s | The read-only ByteIOContext to rewind | |
buf | The probe buffer containing the first buf_size bytes of the file | |
buf_size | The size of buf |
unsigned int get_be16 | ( | ByteIOContext * | s | ) |
unsigned int get_be24 | ( | ByteIOContext * | s | ) |
unsigned int get_be32 | ( | ByteIOContext * | s | ) |
uint64_t get_be64 | ( | ByteIOContext * | s | ) |
int get_buffer | ( | ByteIOContext * | s, | |
unsigned char * | buf, | |||
int | size | |||
) |
int get_byte | ( | ByteIOContext * | s | ) |
unsigned long get_checksum | ( | ByteIOContext * | s | ) |
unsigned int get_le16 | ( | ByteIOContext * | s | ) |
unsigned int get_le24 | ( | ByteIOContext * | s | ) |
unsigned int get_le32 | ( | ByteIOContext * | s | ) |
uint64_t get_le64 | ( | ByteIOContext * | s | ) |
int get_partial_buffer | ( | ByteIOContext * | s, | |
unsigned char * | buf, | |||
int | size | |||
) |
Reads size bytes from ByteIOContext into buf.
This reads at most 1 packet. If that is not enough fewer bytes will be returned.
char* get_strz | ( | ByteIOContext * | s, | |
char * | buf, | |||
int | maxlen | |||
) |
void init_checksum | ( | ByteIOContext * | s, | |
unsigned long(*)(unsigned long c, const uint8_t *p, unsigned int len) | update_checksum, | |||
unsigned long | checksum | |||
) |
int init_put_byte | ( | ByteIOContext * | s, | |
unsigned char * | buffer, | |||
int | buffer_size, | |||
int | write_flag, | |||
void * | opaque, | |||
int(*)(void *opaque, uint8_t *buf, int buf_size) | read_packet, | |||
int(*)(void *opaque, uint8_t *buf, int buf_size) | write_packet, | |||
int64_t(*)(void *opaque, int64_t offset, int whence) | seek | |||
) |
void put_be16 | ( | ByteIOContext * | s, | |
unsigned int | val | |||
) |
void put_be24 | ( | ByteIOContext * | s, | |
unsigned int | val | |||
) |
void put_be32 | ( | ByteIOContext * | s, | |
unsigned int | val | |||
) |
void put_be64 | ( | ByteIOContext * | s, | |
uint64_t | val | |||
) |
void put_buffer | ( | ByteIOContext * | s, | |
const unsigned char * | buf, | |||
int | size | |||
) |
void put_byte | ( | ByteIOContext * | s, | |
int | b | |||
) |
void put_flush_packet | ( | ByteIOContext * | s | ) |
void put_le16 | ( | ByteIOContext * | s, | |
unsigned int | val | |||
) |
void put_le24 | ( | ByteIOContext * | s, | |
unsigned int | val | |||
) |
void put_le32 | ( | ByteIOContext * | s, | |
unsigned int | val | |||
) |
void put_le64 | ( | ByteIOContext * | s, | |
uint64_t | val | |||
) |
void put_strz | ( | ByteIOContext * | s, | |
const char * | buf | |||
) |
void put_tag | ( | ByteIOContext * | s, | |
const char * | tag | |||
) |
attribute_deprecated int register_protocol | ( | URLProtocol * | protocol | ) |
int udp_get_file_handle | ( | URLContext * | h | ) |
int udp_get_local_port | ( | URLContext * | h | ) |
int udp_set_remote_url | ( | URLContext * | h, | |
const char * | uri | |||
) |
If no filename is given to av_open_input_file because you want to get the local port first, then you must call this function to set the remote server address.
url syntax: udp://host:port[?option=val...] option: 'ttl=n' : set the ttl value (for multicast only) 'localport=n' : set the local port 'pkt_size=n' : set max packet size 'reuse=1' : enable reusing the socket
s1 | media file context | |
uri | of the remote server |
int url_close | ( | URLContext * | h | ) |
Closes the resource accessed by the URLContext h, and frees the memory used by it.
int url_close_buf | ( | ByteIOContext * | s | ) |
int url_close_dyn_buf | ( | ByteIOContext * | s, | |
uint8_t ** | pbuffer | |||
) |
int url_exist | ( | const char * | url | ) |
int url_fclose | ( | ByteIOContext * | s | ) |
int url_fdopen | ( | ByteIOContext ** | s, | |
URLContext * | h | |||
) |
Creates and initializes a ByteIOContext for accessing the resource referenced by the URLContext h.
s | Used to return the pointer to the created ByteIOContext. In case of failure the pointed to value is set to NULL. |
int url_feof | ( | ByteIOContext * | s | ) |
int url_ferror | ( | ByteIOContext * | s | ) |
int url_fget_max_packet_size | ( | ByteIOContext * | s | ) |
int url_fgetc | ( | ByteIOContext * | s | ) |
char* url_fgets | ( | ByteIOContext * | s, | |
char * | buf, | |||
int | buf_size | |||
) |
URLContext* url_fileno | ( | ByteIOContext * | s | ) |
int64_t url_filesize | ( | URLContext * | h | ) |
int url_fopen | ( | ByteIOContext ** | s, | |
const char * | url, | |||
int | flags | |||
) |
Creates and initializes a ByteIOContext for accessing the resource indicated by url.
s | Used to return the pointer to the created ByteIOContext. In case of failure the pointed to value is set to NULL. | |
flags | flags which control how the resource indicated by url is to be opened |
int url_fprintf | ( | ByteIOContext * | s, | |
const char * | fmt, | |||
... | ||||
) |
int64_t url_fseek | ( | ByteIOContext * | s, | |
int64_t | offset, | |||
int | whence | |||
) |
int64_t url_fsize | ( | ByteIOContext * | s | ) |
void url_fskip | ( | ByteIOContext * | s, | |
int64_t | offset | |||
) |
int64_t url_ftell | ( | ByteIOContext * | s | ) |
int url_get_file_handle | ( | URLContext * | h | ) |
Return the file descriptor associated with this URL.
For RTP, this will return only the RTP file descriptor, not the RTCP file descriptor. To get both, use rtp_get_file_handles().
void url_get_filename | ( | URLContext * | h, | |
char * | buf, | |||
int | buf_size | |||
) |
int url_get_max_packet_size | ( | URLContext * | h | ) |
static int url_is_streamed | ( | ByteIOContext * | s | ) | [inline, static] |
int url_open | ( | URLContext ** | h, | |
const char * | url, | |||
int | flags | |||
) |
Creates an URLContext for accessing to the resource indicated by url, and opens it.
puc | pointer to the location where, in case of success, the function puts the pointer to the created URLContext | |
flags | flags which control how the resource indicated by url is to be opened |
int url_open_buf | ( | ByteIOContext ** | s, | |
uint8_t * | buf, | |||
int | buf_size, | |||
int | flags | |||
) |
int url_open_dyn_buf | ( | ByteIOContext ** | s | ) |
int url_open_dyn_packet_buf | ( | ByteIOContext ** | s, | |
int | max_packet_size | |||
) |
Open a write only packetized memory stream with a maximum packet size of 'max_packet_size'.
The stream is stored in a memory buffer with a big endian 4 byte header giving the packet size in bytes.
s | new IO context | |
max_packet_size | maximum packet size (must be > 0) |
int url_open_protocol | ( | URLContext ** | puc, | |
struct URLProtocol * | up, | |||
const char * | url, | |||
int | flags | |||
) |
Creates an URLContext for accessing to the resource indicated by url, and opens it using the URLProtocol up.
puc | pointer to the location where, in case of success, the function puts the pointer to the created URLContext | |
flags | flags which control how the resource indicated by url is to be opened |
int url_poll | ( | URLPollEntry * | poll_table, | |
int | n, | |||
int | timeout | |||
) |
int url_read | ( | URLContext * | h, | |
unsigned char * | buf, | |||
int | size | |||
) |
Reads up to size bytes from the resource accessed by h, and stores the read bytes in buf.
int url_read_complete | ( | URLContext * | h, | |
unsigned char * | buf, | |||
int | size | |||
) |
Read as many bytes as possible (up to size), calling the read function multiple times if necessary.
Will also retry if the read function returns AVERROR(EAGAIN). This makes special short-read handling in applications unnecessary, if the return value is < size then it is certain there was either an error or the end of file was reached.
int url_resetbuf | ( | ByteIOContext * | s, | |
int | flags | |||
) |
int64_t url_seek | ( | URLContext * | h, | |
int64_t | pos, | |||
int | whence | |||
) |
Changes the position that will be used by the next read/write operation on the resource accessed by h.
pos | specifies the new position to set | |
whence | specifies how pos should be interpreted, it must be one of SEEK_SET (seek from the beginning), SEEK_CUR (seek from the current position), SEEK_END (seek from the end), or AVSEEK_SIZE (return the filesize of the requested resource, pos is ignored). |
void url_set_interrupt_cb | ( | URLInterruptCB * | interrupt_cb | ) |
The callback is called in blocking functions to test regulary if asynchronous interruption is needed.
AVERROR(EINTR) is returned in this case by the interrupted function. 'NULL' means no interrupt callback is given.
int url_setbufsize | ( | ByteIOContext * | s, | |
int | buf_size | |||
) |
int url_write | ( | URLContext * | h, | |
unsigned char * | buf, | |||
int | size | |||
) |