diff rtpproto.c @ 4640:b34d9614b887 libavformat

Add url_get_file_handle(), which is used to get the file descriptor associated with the I/O handle (e.g. the fd returned by open()). See "[RFC] rtsp.c EOF support" thread. There were previously some URI-specific implementations of the same idea, e.g. rtp_get_file_handles() and udp_get_file_handle(). All of these are deprecated by this patch and will be removed at the next major API bump.
author rbultje
date Tue, 03 Mar 2009 17:04:51 +0000
parents 49c1d3b27727
children 334f223fc455
line wrap: on
line diff
--- a/rtpproto.c	Tue Mar 03 16:53:04 2009 +0000
+++ b/rtpproto.c	Tue Mar 03 17:04:51 2009 +0000
@@ -169,8 +169,8 @@
 
     /* just to ease handle access. XXX: need to suppress direct handle
        access */
-    s->rtp_fd = udp_get_file_handle(s->rtp_hd);
-    s->rtcp_fd = udp_get_file_handle(s->rtcp_hd);
+    s->rtp_fd = url_get_file_handle(s->rtp_hd);
+    s->rtcp_fd = url_get_file_handle(s->rtcp_hd);
 
     h->max_packet_size = url_get_max_packet_size(s->rtp_hd);
     h->is_streamed = 1;
@@ -296,6 +296,7 @@
     return udp_get_local_port(s->rtp_hd);
 }
 
+#if (LIBAVFORMAT_VERSION_MAJOR <= 52)
 /**
  * Return the rtp and rtcp file handles for select() usage to wait for
  * several RTP streams at the same time.
@@ -309,6 +310,13 @@
     *prtp_fd = s->rtp_fd;
     *prtcp_fd = s->rtcp_fd;
 }
+#endif
+
+static int rtp_get_file_handle(URLContext *h)
+{
+    RTPContext *s = h->priv_data;
+    return s->rtp_fd;
+}
 
 URLProtocol rtp_protocol = {
     "rtp",
@@ -317,4 +325,5 @@
     rtp_write,
     NULL, /* seek */
     rtp_close,
+    .url_get_file_handle = rtp_get_file_handle,
 };