diff options
author | Jordi Ortiz <nenjordi@gmail.com> | 2012-08-17 20:38:59 +0400 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2012-08-17 23:14:30 +0400 |
commit | d6b9da1178a8e84d1bf999337c058440826d3f54 (patch) | |
tree | 29e00dd205c3c4c2c5670a1e639742ca04706c91 /libavformat/rtpproto.c | |
parent | 2e8f3cbcda536970aee03f5543185d7fc01232a1 (diff) |
avio: add (ff)url_get_multi_file_handle() for getting more than one fd
Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavformat/rtpproto.c')
-rw-r--r-- | libavformat/rtpproto.c | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/libavformat/rtpproto.c b/libavformat/rtpproto.c index e70b89ec9e..fc1ae06df3 100644 --- a/libavformat/rtpproto.c +++ b/libavformat/rtpproto.c @@ -320,13 +320,27 @@ int ff_rtp_get_rtcp_file_handle(URLContext *h) { return s->rtcp_fd; } +static int rtp_get_multi_file_handle(URLContext *h, int **handles, + int *numhandles) +{ + RTPContext *s = h->priv_data; + int *hs = *handles = av_malloc(sizeof(**handles) * 2); + if (!hs) + return AVERROR(ENOMEM); + hs[0] = s->rtp_fd; + hs[1] = s->rtcp_fd; + *numhandles = 2; + return 0; +} + URLProtocol ff_rtp_protocol = { - .name = "rtp", - .url_open = rtp_open, - .url_read = rtp_read, - .url_write = rtp_write, - .url_close = rtp_close, - .url_get_file_handle = rtp_get_file_handle, - .priv_data_size = sizeof(RTPContext), - .flags = URL_PROTOCOL_FLAG_NETWORK, + .name = "rtp", + .url_open = rtp_open, + .url_read = rtp_read, + .url_write = rtp_write, + .url_close = rtp_close, + .url_get_file_handle = rtp_get_file_handle, + .url_get_multi_file_handle = rtp_get_multi_file_handle, + .priv_data_size = sizeof(RTPContext), + .flags = URL_PROTOCOL_FLAG_NETWORK, }; |