rtpdec: Add ff_ prefix to all nonstatic symbols

Message ID 1318419841-2190-1-git-send-email-martin@martin.st
State Committed
Commit bfc6db4477cd1ca6c32ab533783238cf8381f177
Headers show

Commit Message

Martin Storsjö Oct. 12, 2011, 11:44 a.m.
---
 avserver.c             |    4 ++--
 libavformat/rtpdec.c   |   16 ++++++++--------
 libavformat/rtpdec.h   |   24 ++++++++++++------------
 libavformat/rtpproto.c |    8 ++++----
 libavformat/rtsp.c     |   26 +++++++++++++-------------
 5 files changed, 39 insertions(+), 39 deletions(-)

Comments

Luca Barbato Oct. 12, 2011, 11:47 a.m. | #1
On 10/12/11 1:44 PM, Martin Storsjö wrote:
> ---
>   avserver.c             |    4 ++--
>   libavformat/rtpdec.c   |   16 ++++++++--------
>   libavformat/rtpdec.h   |   24 ++++++++++++------------
>   libavformat/rtpproto.c |    8 ++++----
>   libavformat/rtsp.c     |   26 +++++++++++++-------------
>   5 files changed, 39 insertions(+), 39 deletions(-)
>

Ok, once we got enough time and will we should think about expose more 
rtp layer properly I'm afraid...

lu
Martin Storsjö Oct. 12, 2011, 11:54 a.m. | #2
On Wed, 12 Oct 2011, Luca Barbato wrote:

> On 10/12/11 1:44 PM, Martin Storsjö wrote:
>> ---
>>   avserver.c             |    4 ++--
>>   libavformat/rtpdec.c   |   16 ++++++++--------
>>   libavformat/rtpdec.h   |   24 ++++++++++++------------
>>   libavformat/rtpproto.c |    8 ++++----
>>   libavformat/rtsp.c     |   26 +++++++++++++-------------
>>   5 files changed, 39 insertions(+), 39 deletions(-)
>> 
>
> Ok, once we got enough time and will we should think about expose more rtp 
> layer properly I'm afraid...

Applied

And yes, exposing parts of that might be valuable, but as it is today it 
isn't really ready for that...

// Martin
Luca Barbato Oct. 12, 2011, 12:16 p.m. | #3
On 10/12/11 1:54 PM, Martin Storsjö wrote:
> On Wed, 12 Oct 2011, Luca Barbato wrote:
>
>> On 10/12/11 1:44 PM, Martin Storsjö wrote:
>>> ---
>>> avserver.c | 4 ++--
>>> libavformat/rtpdec.c | 16 ++++++++--------
>>> libavformat/rtpdec.h | 24 ++++++++++++------------
>>> libavformat/rtpproto.c | 8 ++++----
>>> libavformat/rtsp.c | 26 +++++++++++++-------------
>>> 5 files changed, 39 insertions(+), 39 deletions(-)
>>>
>>
>> Ok, once we got enough time and will we should think about expose more
>> rtp layer properly I'm afraid...
>
> Applied
>
> And yes, exposing parts of that might be valuable, but as it is today it
> isn't really ready for that...

I'd love to be able to directly use it from feng and I guess others 
would like as well ^^;

lu
Martin Storsjö Oct. 12, 2011, 12:25 p.m. | #4
On Wed, 12 Oct 2011, Luca Barbato wrote:

> On 10/12/11 1:54 PM, Martin Storsjö wrote:
>> On Wed, 12 Oct 2011, Luca Barbato wrote:
>> 
>>> Ok, once we got enough time and will we should think about expose more
>>> rtp layer properly I'm afraid...
>> 
>> Applied
>> 
>> And yes, exposing parts of that might be valuable, but as it is today it
>> isn't really ready for that...
>
> I'd love to be able to directly use it from feng and I guess others would 
> like as well ^^;

Actually, you should be able to do what you want to do in feng with the 
public APIs already. What you want to do is RTP packetization and perhaps 
also sending the data over UDP, right? That's possible with the RTP muxer 
interface. The RTSP muxer does this using only the public APIs - for 
sending data over UDP, it opens one RTP muxer and one rtp:// AVIOContext 
for each stream, and just writes data using that. For sending data over 
TCP, it uses the RTP muxer in the same way, but uses avio_dyn_buf for 
getting a custom AVIOContext that you can extract the data from later, and 
send it in any TCP socket.

(Actually, it seems to be using ffio_open_dyn_packet_buf which has become 
private in the avio remodelling, but we can either make that a public 
function, or you can do the same yourself with a bit of custom AVIOContext 
callbacks.)

// Martin
Luca Barbato Oct. 12, 2011, 12:31 p.m. | #5
On 10/12/11 2:25 PM, Martin Storsjö wrote:
> Actually, you should be able to do what you want to do in feng with the
> public APIs already. What you want to do is RTP packetization and
> perhaps also sending the data over UDP, right?

No =) I'd like to use the rtp packetizers but keep the network part on 
my side.

> That's possible with the RTP muxer interface. The RTSP muxer does this
> using only the public APIs - for sending data over UDP, it opens one RTP
> muxer and one rtp:// AVIOContext for each stream, and just writes data
> using that.
> For sending data over TCP, it uses the RTP muxer in the same way, but uses
> avio_dyn_buf for getting a custom AVIOContext that you can extract the
> data from later, and send it in any TCP socket.

That might work up to a point but there are some pitfalls =\

> (Actually, it seems to be using ffio_open_dyn_packet_buf which has
> become private in the avio remodelling, but we can either make that a
> public function, or you can do the same yourself with a bit of custom
> AVIOContext callbacks.)

Yes, some part of ffio will need to be public again to do such stuff ^^;

lu
Martin Storsjö Oct. 12, 2011, 12:37 p.m. | #6
On Wed, 12 Oct 2011, Luca Barbato wrote:

> On 10/12/11 2:25 PM, Martin Storsjö wrote:
>> Actually, you should be able to do what you want to do in feng with the
>> public APIs already. What you want to do is RTP packetization and
>> perhaps also sending the data over UDP, right?
>
> No =) I'd like to use the rtp packetizers but keep the network part on my 
> side.

Ok, well that should be exactly what the RTSP muxer does for TCP 
interleaved sending - once you've got the packetized data, you can do 
whatever you want with it :-)

>> That's possible with the RTP muxer interface. The RTSP muxer does this
>> using only the public APIs - for sending data over UDP, it opens one RTP
>> muxer and one rtp:// AVIOContext for each stream, and just writes data
>> using that.
>> For sending data over TCP, it uses the RTP muxer in the same way, but uses
>> avio_dyn_buf for getting a custom AVIOContext that you can extract the
>> data from later, and send it in any TCP socket.
>
> That might work up to a point but there are some pitfalls =\

Hmm, I don't know of any such - it works well for the RTSP muxer at least 
afaik.

>> (Actually, it seems to be using ffio_open_dyn_packet_buf which has
>> become private in the avio remodelling, but we can either make that a
>> public function, or you can do the same yourself with a bit of custom
>> AVIOContext callbacks.)
>
> Yes, some part of ffio will need to be public again to do such stuff ^^;

Yeah - most of it is public, except for that three line function.

// Martin
Luca Barbato Oct. 12, 2011, 2:01 p.m. | #7
On 10/12/11 2:37 PM, Martin Storsjö wrote:
> On Wed, 12 Oct 2011, Luca Barbato wrote:
>
>> On 10/12/11 2:25 PM, Martin Storsjö wrote:
>>> Actually, you should be able to do what you want to do in feng with the
>>> public APIs already. What you want to do is RTP packetization and
>>> perhaps also sending the data over UDP, right?
>>
>> No =) I'd like to use the rtp packetizers but keep the network part on
>> my side.
>
> Ok, well that should be exactly what the RTSP muxer does for TCP
> interleaved sending - once you've got the packetized data, you can do
> whatever you want with it :-)

I need to look over it again. Might be interesting adding a way to 
consume what the rtsp muxer produces so we could have avconv doing a 
good chunk of flux is doing now...

>>> That's possible with the RTP muxer interface. The RTSP muxer does this
>>> using only the public APIs - for sending data over UDP, it opens one RTP
>>> muxer and one rtp:// AVIOContext for each stream, and just writes data
>>> using that.
>>> For sending data over TCP, it uses the RTP muxer in the same way, but
>>> uses
>>> avio_dyn_buf for getting a custom AVIOContext that you can extract the
>>> data from later, and send it in any TCP socket.
>>
>> That might work up to a point but there are some pitfalls =\
> Hmm, I don't know of any such - it works well for the RTSP muxer at
> least afaik.

I need to check how well it mixes.

lu

Patch

diff --git a/avserver.c b/avserver.c
index 7b8bf13..ff7a15c 100644
--- a/avserver.c
+++ b/avserver.c
@@ -3169,8 +3169,8 @@  static void rtsp_cmd_setup(HTTPContext *c, const char *url,
 
     switch(rtp_c->rtp_protocol) {
     case RTSP_LOWER_TRANSPORT_UDP:
-        rtp_port = rtp_get_local_rtp_port(rtp_c->rtp_handles[stream_index]);
-        rtcp_port = rtp_get_local_rtcp_port(rtp_c->rtp_handles[stream_index]);
+        rtp_port = ff_rtp_get_local_rtp_port(rtp_c->rtp_handles[stream_index]);
+        rtcp_port = ff_rtp_get_local_rtcp_port(rtp_c->rtp_handles[stream_index]);
         avio_printf(c->pb, "Transport: RTP/AVP/UDP;unicast;"
                     "client_port=%d-%d;server_port=%d-%d",
                     th->client_port_min, th->client_port_max,
diff --git a/libavformat/rtpdec.c b/libavformat/rtpdec.c
index 0f6ed27..92535ec 100644
--- a/libavformat/rtpdec.c
+++ b/libavformat/rtpdec.c
@@ -218,7 +218,7 @@  static int rtp_valid_packet_in_sequence(RTPStatistics *s, uint16_t seq)
     return 1;
 }
 
-int rtp_check_and_send_back_rr(RTPDemuxContext *s, int count)
+int ff_rtp_check_and_send_back_rr(RTPDemuxContext *s, int count)
 {
     AVIOContext *pb;
     uint8_t *buf;
@@ -315,7 +315,7 @@  int rtp_check_and_send_back_rr(RTPDemuxContext *s, int count)
     return 0;
 }
 
-void rtp_send_punch_packets(URLContext* rtp_handle)
+void ff_rtp_send_punch_packets(URLContext* rtp_handle)
 {
     AVIOContext *pb;
     uint8_t *buf;
@@ -359,7 +359,7 @@  void rtp_send_punch_packets(URLContext* rtp_handle)
  * MPEG2TS streams to indicate that they should be demuxed inside the
  * rtp demux (otherwise CODEC_ID_MPEG2TS packets are returned)
  */
-RTPDemuxContext *rtp_parse_open(AVFormatContext *s1, AVStream *st, URLContext *rtpc, int payload_type, int queue_size)
+RTPDemuxContext *ff_rtp_parse_open(AVFormatContext *s1, AVStream *st, URLContext *rtpc, int payload_type, int queue_size)
 {
     RTPDemuxContext *s;
 
@@ -407,8 +407,8 @@  RTPDemuxContext *rtp_parse_open(AVFormatContext *s1, AVStream *st, URLContext *r
 }
 
 void
-rtp_parse_set_dynamic_protocol(RTPDemuxContext *s, PayloadContext *ctx,
-                               RTPDynamicProtocolHandler *handler)
+ff_rtp_parse_set_dynamic_protocol(RTPDemuxContext *s, PayloadContext *ctx,
+                                  RTPDynamicProtocolHandler *handler)
 {
     s->dynamic_protocol_context = ctx;
     s->parse_packet = handler->parse_packet;
@@ -722,8 +722,8 @@  static int rtp_parse_one_packet(RTPDemuxContext *s, AVPacket *pkt,
  * @return 0 if a packet is returned, 1 if a packet is returned and more can follow
  * (use buf as NULL to read the next). -1 if no packet (error or no more packet).
  */
-int rtp_parse_packet(RTPDemuxContext *s, AVPacket *pkt,
-                     uint8_t **bufptr, int len)
+int ff_rtp_parse_packet(RTPDemuxContext *s, AVPacket *pkt,
+                        uint8_t **bufptr, int len)
 {
     int rv = rtp_parse_one_packet(s, pkt, bufptr, len);
     s->prev_ret = rv;
@@ -732,7 +732,7 @@  int rtp_parse_packet(RTPDemuxContext *s, AVPacket *pkt,
     return rv ? rv : has_next_packet(s);
 }
 
-void rtp_parse_close(RTPDemuxContext *s)
+void ff_rtp_parse_close(RTPDemuxContext *s)
 {
     ff_rtp_reset_packet_queue(s);
     if (!strcmp(ff_rtp_enc_name(s->payload_type), "MP2T")) {
diff --git a/libavformat/rtpdec.h b/libavformat/rtpdec.h
index a4d21aa..d58eddd 100644
--- a/libavformat/rtpdec.h
+++ b/libavformat/rtpdec.h
@@ -38,18 +38,18 @@  typedef struct RTPDynamicProtocolHandler_s RTPDynamicProtocolHandler;
 #define RTP_NOTS_VALUE ((uint32_t)-1)
 
 typedef struct RTPDemuxContext RTPDemuxContext;
-RTPDemuxContext *rtp_parse_open(AVFormatContext *s1, AVStream *st, URLContext *rtpc, int payload_type, int queue_size);
-void rtp_parse_set_dynamic_protocol(RTPDemuxContext *s, PayloadContext *ctx,
-                                    RTPDynamicProtocolHandler *handler);
-int rtp_parse_packet(RTPDemuxContext *s, AVPacket *pkt,
-                     uint8_t **buf, int len);
-void rtp_parse_close(RTPDemuxContext *s);
+RTPDemuxContext *ff_rtp_parse_open(AVFormatContext *s1, AVStream *st, URLContext *rtpc, int payload_type, int queue_size);
+void ff_rtp_parse_set_dynamic_protocol(RTPDemuxContext *s, PayloadContext *ctx,
+                                       RTPDynamicProtocolHandler *handler);
+int ff_rtp_parse_packet(RTPDemuxContext *s, AVPacket *pkt,
+                        uint8_t **buf, int len);
+void ff_rtp_parse_close(RTPDemuxContext *s);
 int64_t ff_rtp_queued_packet_time(RTPDemuxContext *s);
 void ff_rtp_reset_packet_queue(RTPDemuxContext *s);
-int rtp_get_local_rtp_port(URLContext *h);
-int rtp_get_local_rtcp_port(URLContext *h);
+int ff_rtp_get_local_rtp_port(URLContext *h);
+int ff_rtp_get_local_rtcp_port(URLContext *h);
 
-int rtp_set_remote_url(URLContext *h, const char *uri);
+int ff_rtp_set_remote_url(URLContext *h, const char *uri);
 
 /**
  * Send a dummy packet on both port pairs to set up the connection
@@ -62,19 +62,19 @@  int rtp_set_remote_url(URLContext *h, const char *uri);
  * The same routine is used with RDT too, even if RDT doesn't use normal
  * RTP packets otherwise.
  */
-void rtp_send_punch_packets(URLContext* rtp_handle);
+void ff_rtp_send_punch_packets(URLContext* rtp_handle);
 
 /**
  * some rtp servers assume client is dead if they don't hear from them...
  * so we send a Receiver Report to the provided ByteIO context
  * (we don't have access to the rtcp handle from here)
  */
-int rtp_check_and_send_back_rr(RTPDemuxContext *s, int count);
+int ff_rtp_check_and_send_back_rr(RTPDemuxContext *s, int count);
 
 /**
  * Get the file handle for the RTCP socket.
  */
-int rtp_get_rtcp_file_handle(URLContext *h);
+int ff_rtp_get_rtcp_file_handle(URLContext *h);
 
 // these statistics are used for rtcp receiver reports...
 typedef struct {
diff --git a/libavformat/rtpproto.c b/libavformat/rtpproto.c
index 0367198..9a18157 100644
--- a/libavformat/rtpproto.c
+++ b/libavformat/rtpproto.c
@@ -60,7 +60,7 @@  typedef struct RTPContext {
  * @return zero if no error.
  */
 
-int rtp_set_remote_url(URLContext *h, const char *uri)
+int ff_rtp_set_remote_url(URLContext *h, const char *uri)
 {
     RTPContext *s = h->priv_data;
     char hostname[256];
@@ -300,7 +300,7 @@  static int rtp_close(URLContext *h)
  * @return the local port number
  */
 
-int rtp_get_local_rtp_port(URLContext *h)
+int ff_rtp_get_local_rtp_port(URLContext *h)
 {
     RTPContext *s = h->priv_data;
     return ff_udp_get_local_port(s->rtp_hd);
@@ -312,7 +312,7 @@  int rtp_get_local_rtp_port(URLContext *h)
  * @return the local port number
  */
 
-int rtp_get_local_rtcp_port(URLContext *h)
+int ff_rtp_get_local_rtcp_port(URLContext *h)
 {
     RTPContext *s = h->priv_data;
     return ff_udp_get_local_port(s->rtcp_hd);
@@ -324,7 +324,7 @@  static int rtp_get_file_handle(URLContext *h)
     return s->rtp_fd;
 }
 
-int rtp_get_rtcp_file_handle(URLContext *h) {
+int ff_rtp_get_rtcp_file_handle(URLContext *h) {
     RTPContext *s = h->priv_data;
     return s->rtcp_fd;
 }
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index 8b70c8b..ff4d16a 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -501,7 +501,7 @@  void ff_rtsp_undo_setup(AVFormatContext *s)
             } else if (rt->transport == RTSP_TRANSPORT_RDT && CONFIG_RTPDEC)
                 ff_rdt_parse_close(rtsp_st->transport_priv);
             else if (CONFIG_RTPDEC)
-                rtp_parse_close(rtsp_st->transport_priv);
+                ff_rtp_parse_close(rtsp_st->transport_priv);
         }
         rtsp_st->transport_priv = NULL;
         if (rtsp_st->rtp_handle)
@@ -558,7 +558,7 @@  static int rtsp_open_transport_ctx(AVFormatContext *s, RTSPStream *rtsp_st)
                                             rtsp_st->dynamic_protocol_context,
                                             rtsp_st->dynamic_handler);
     else if (CONFIG_RTPDEC)
-        rtsp_st->transport_priv = rtp_parse_open(s, st, rtsp_st->rtp_handle,
+        rtsp_st->transport_priv = ff_rtp_parse_open(s, st, rtsp_st->rtp_handle,
                                          rtsp_st->sdp_payload_type,
             (rt->lower_transport == RTSP_LOWER_TRANSPORT_TCP || !s->max_delay)
             ? 0 : RTP_REORDER_QUEUE_DEFAULT_SIZE);
@@ -567,9 +567,9 @@  static int rtsp_open_transport_ctx(AVFormatContext *s, RTSPStream *rtsp_st)
          return AVERROR(ENOMEM);
     } else if (rt->transport != RTSP_TRANSPORT_RDT && CONFIG_RTPDEC) {
         if (rtsp_st->dynamic_handler) {
-            rtp_parse_set_dynamic_protocol(rtsp_st->transport_priv,
-                                           rtsp_st->dynamic_protocol_context,
-                                           rtsp_st->dynamic_handler);
+            ff_rtp_parse_set_dynamic_protocol(rtsp_st->transport_priv,
+                                              rtsp_st->dynamic_protocol_context,
+                                              rtsp_st->dynamic_handler);
         }
     }
 
@@ -1121,7 +1121,7 @@  int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port,
             goto fail;
 
         rtp_opened:
-            port = rtp_get_local_rtp_port(rtsp_st->rtp_handle);
+            port = ff_rtp_get_local_rtp_port(rtsp_st->rtp_handle);
         have_port:
             snprintf(transport, sizeof(transport) - 1,
                      "%s/UDP;", trans_pref);
@@ -1225,7 +1225,7 @@  int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port,
                             reply->transports[0].server_port_min, "%s", options);
             }
             if (!(rt->server_type == RTSP_SERVER_WMS && i > 1) &&
-                rtp_set_remote_url(rtsp_st->rtp_handle, url) < 0) {
+                ff_rtp_set_remote_url(rtsp_st->rtp_handle, url) < 0) {
                 err = AVERROR_INVALIDDATA;
                 goto fail;
             }
@@ -1235,7 +1235,7 @@  int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port,
              */
             if (!(rt->server_type == RTSP_SERVER_WMS && i > 1) && s->iformat &&
                 CONFIG_RTPDEC)
-                rtp_send_punch_packets(rtsp_st->rtp_handle);
+                ff_rtp_send_punch_packets(rtsp_st->rtp_handle);
             break;
         }
         case RTSP_LOWER_TRANSPORT_UDP_MULTICAST: {
@@ -1569,7 +1569,7 @@  static int udp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st,
             if (rtsp_st->rtp_handle) {
                 p[max_p].fd = ffurl_get_file_handle(rtsp_st->rtp_handle);
                 p[max_p++].events = POLLIN;
-                p[max_p].fd = rtp_get_rtcp_file_handle(rtsp_st->rtp_handle);
+                p[max_p].fd = ff_rtp_get_rtcp_file_handle(rtsp_st->rtp_handle);
                 p[max_p++].events = POLLIN;
             }
         }
@@ -1624,7 +1624,7 @@  int ff_rtsp_fetch_packet(AVFormatContext *s, AVPacket *pkt)
         if (rt->transport == RTSP_TRANSPORT_RDT) {
             ret = ff_rdt_parse_packet(rt->cur_transport_priv, pkt, NULL, 0);
         } else
-            ret = rtp_parse_packet(rt->cur_transport_priv, pkt, NULL, 0);
+            ret = ff_rtp_parse_packet(rt->cur_transport_priv, pkt, NULL, 0);
         if (ret == 0) {
             rt->cur_transport_priv = NULL;
             return 0;
@@ -1672,13 +1672,13 @@  int ff_rtsp_fetch_packet(AVFormatContext *s, AVPacket *pkt)
     case RTSP_LOWER_TRANSPORT_UDP_MULTICAST:
         len = udp_read_packet(s, &rtsp_st, rt->recvbuf, RECVBUF_SIZE, wait_end);
         if (len > 0 && rtsp_st->transport_priv && rt->transport == RTSP_TRANSPORT_RTP)
-            rtp_check_and_send_back_rr(rtsp_st->transport_priv, len);
+            ff_rtp_check_and_send_back_rr(rtsp_st->transport_priv, len);
         break;
     }
     if (len == AVERROR(EAGAIN) && first_queue_st &&
         rt->transport == RTSP_TRANSPORT_RTP) {
         rtsp_st = first_queue_st;
-        ret = rtp_parse_packet(rtsp_st->transport_priv, pkt, NULL, 0);
+        ret = ff_rtp_parse_packet(rtsp_st->transport_priv, pkt, NULL, 0);
         goto end;
     }
     if (len < 0)
@@ -1688,7 +1688,7 @@  int ff_rtsp_fetch_packet(AVFormatContext *s, AVPacket *pkt)
     if (rt->transport == RTSP_TRANSPORT_RDT) {
         ret = ff_rdt_parse_packet(rtsp_st->transport_priv, pkt, &rt->recvbuf, len);
     } else {
-        ret = rtp_parse_packet(rtsp_st->transport_priv, pkt, &rt->recvbuf, len);
+        ret = ff_rtp_parse_packet(rtsp_st->transport_priv, pkt, &rt->recvbuf, len);
         if (ret < 0) {
             /* Either bad packet, or a RTCP packet. Check if the
              * first_rtcp_ntp_time field was initialized. */