Go to the documentation of this file.
48 for (
i = 0;
i <
s->nb_streams;
i++) {
55 s->streams[
i]->priv_data =
NULL;
72 char host[1024], path[1024], url[1024], announce_addr[50] =
"";
74 int port = 9875, base_port = 5004,
i,
pos = 0, same_port = 0, ttl = 255;
78 socklen_t addrlen =
sizeof(localaddr);
87 path,
sizeof(path),
s->url);
92 option_list = strrchr(path,
'?');
96 port = strtol(buf,
NULL, 10);
99 same_port = strtol(buf,
NULL, 10);
102 ttl = strtol(buf,
NULL, 10);
105 av_strlcpy(announce_addr, buf,
sizeof(announce_addr));
109 if (!announce_addr[0]) {
117 if (ai->ai_family == AF_INET) {
119 av_strlcpy(announce_addr,
"224.2.127.254",
sizeof(announce_addr));
120 #if HAVE_STRUCT_SOCKADDR_IN6
121 }
else if (ai->ai_family == AF_INET6) {
125 av_strlcpy(announce_addr,
"ff0e::2:7ffe",
sizeof(announce_addr));
130 "address family\n", host);
137 contexts =
av_calloc(
s->nb_streams,
sizeof(*contexts));
143 if (
s->start_time_realtime == 0 ||
s->start_time_realtime ==
AV_NOPTS_VALUE)
145 for (
i = 0;
i <
s->nb_streams;
i++) {
154 &
s->interrupt_callback,
NULL,
155 s->protocol_whitelist,
s->protocol_blacklist,
NULL);
163 s->streams[
i]->priv_data = contexts[
i];
173 if (
s->nb_streams > 0 && title)
177 "?ttl=%d&connect=1", ttl);
179 &
s->interrupt_callback,
NULL,
180 s->protocol_whitelist,
s->protocol_blacklist,
NULL);
187 if (getsockname(udp_fd, (
struct sockaddr*) &localaddr, &addrlen)) {
191 if (localaddr.ss_family != AF_INET
192 #
if HAVE_STRUCT_SOCKADDR_IN6
193 && localaddr.ss_family != AF_INET6
207 #if HAVE_STRUCT_SOCKADDR_IN6
208 if (localaddr.ss_family == AF_INET6)
215 if (localaddr.ss_family == AF_INET) {
216 memcpy(&sap->
ann[
pos], &((
struct sockaddr_in*)&localaddr)->sin_addr,
217 sizeof(
struct in_addr));
218 pos +=
sizeof(
struct in_addr);
219 #if HAVE_STRUCT_SOCKADDR_IN6
221 memcpy(&sap->
ann[
pos], &((
struct sockaddr_in6*)&localaddr)->sin6_addr,
222 sizeof(
struct in6_addr));
223 pos +=
sizeof(
struct in6_addr);
274 .priv_data_size =
sizeof(
struct SAPState),
int64_t av_gettime_relative(void)
Get the current time in microseconds since some unspecified starting point.
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
int av_find_info_tag(char *arg, int arg_size, const char *tag1, const char *info)
Attempt to find a specific tag in a URL.
static int sap_write_packet(AVFormatContext *s, AVPacket *pkt)
static int ffurl_write(URLContext *h, const uint8_t *buf, int size)
Write size bytes from buf to the resource accessed by h.
AVStream ** streams
A list of all streams in the file.
int max_packet_size
if non zero, the stream is packetized with this max packet size
#define AV_LOG_VERBOSE
Detailed information.
const FFOutputFormat ff_sap_muxer
void ff_network_close(void)
int ff_network_init(void)
uint32_t av_get_random_seed(void)
Get a seed to use in conjunction with random functions.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
int ffurl_open_whitelist(URLContext **puc, const char *filename, int flags, const AVIOInterruptCB *int_cb, AVDictionary **options, const char *whitelist, const char *blacklist, URLContext *parent)
Create an URLContext for accessing to the resource indicated by url, and open it.
int ff_url_join(char *str, int size, const char *proto, const char *authorization, const char *hostname, int port, const char *fmt,...)
#define AVIO_FLAG_WRITE
write-only
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.
AVIOContext * pb
I/O context.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
#define AV_NOPTS_VALUE
Undefined timestamp value.
int av_sdp_create(AVFormatContext *ac[], int n_files, char *buf, int size)
Generate an SDP for an RTP session.
int avio_closep(AVIOContext **s)
Close the resource accessed by the AVIOContext *s, free it and set the pointer pointing to it to NULL...
int av_write_trailer(AVFormatContext *s)
Write the stream trailer to an output media file and free the file private data.
#define i(width, name, range_min, range_max)
void av_url_split(char *proto, int proto_size, char *authorization, int authorization_size, char *hostname, int hostname_size, int *port_ptr, char *path, int path_size, const char *url)
Split a URL string into components.
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
void * av_calloc(size_t nmemb, size_t size)
int ffurl_closep(URLContext **hh)
Close the resource accessed by the URLContext h, and free the memory used by it.
int ff_rtp_chain_mux_open(AVFormatContext **out, AVFormatContext *s, AVStream *st, URLContext *handle, int packet_size, int idx)
static int sap_write_header(AVFormatContext *s)
void avformat_free_context(AVFormatContext *s)
Free an AVFormatContext and all its streams.
int64_t av_gettime(void)
Get the current time in microseconds.
char * av_strdup(const char *s)
Duplicate a string.
static int sap_write_close(AVFormatContext *s)
This structure stores compressed data.
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
size_t av_strlcpy(char *dst, const char *src, size_t size)
Copy the string src to dst, but no more than size - 1 bytes, and null-terminate dst.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
int ffurl_get_file_handle(URLContext *h)
Return the file descriptor associated with this URL.