[FFmpeg-devel] [PATCH] rtsp.h: rename tx variables

Ronald S. Bultje rsbultje
Thu Feb 5 21:54:31 CET 2009


Hi,

On Thu, Feb 5, 2009 at 11:40 AM, Ronald S. Bultje <rsbultje at gmail.com> wrote:
> On Thu, Feb 5, 2009 at 11:38 AM, Luca Barbato <lu_zero at gentoo.org> wrote:
>> Ronald S. Bultje wrote:
>>> tx_ctx  -> transport_priv_ctx
>>
>> either priv or ctx, both looks overkill IMHO.
>
> transport_priv_data?

As $attached. I prefer priv_data because it's used in AVCodec/FormatContext.

Ronald
-------------- next part --------------
Index: ffmpeg-svn/libavformat/rtsp.c
===================================================================
--- ffmpeg-svn.orig/libavformat/rtsp.c	2009-02-05 11:57:40.000000000 -0500
+++ ffmpeg-svn/libavformat/rtsp.c	2009-02-05 12:11:11.000000000 -0500
@@ -829,11 +829,11 @@
     for(i=0;i<rt->nb_rtsp_streams;i++) {
         rtsp_st = rt->rtsp_streams[i];
         if (rtsp_st) {
-            if (rtsp_st->tx_ctx) {
+            if (rtsp_st->transport_priv_data) {
                 if (rt->transport == RTSP_TRANSPORT_RDT)
-                    ff_rdt_parse_close(rtsp_st->tx_ctx);
+                    ff_rdt_parse_close(rtsp_st->transport_priv_data);
                 else
-                    rtp_parse_close(rtsp_st->tx_ctx);
+                    rtp_parse_close(rtsp_st->transport_priv_data);
             }
             if (rtsp_st->rtp_handle)
                 url_close(rtsp_st->rtp_handle);
@@ -857,19 +857,19 @@
         s->ctx_flags |= AVFMTCTX_NOHEADER;
 
     if (rt->transport == RTSP_TRANSPORT_RDT)
-        rtsp_st->tx_ctx = ff_rdt_parse_open(s, st->index,
+        rtsp_st->transport_priv_data = ff_rdt_parse_open(s, st->index,
                                             rtsp_st->dynamic_protocol_context,
                                             rtsp_st->dynamic_handler);
     else
-        rtsp_st->tx_ctx = rtp_parse_open(s, st, rtsp_st->rtp_handle,
+        rtsp_st->transport_priv_data = rtp_parse_open(s, st, rtsp_st->rtp_handle,
                                          rtsp_st->sdp_payload_type,
                                          &rtsp_st->rtp_payload_data);
 
-    if (!rtsp_st->tx_ctx) {
+    if (!rtsp_st->transport_priv_data) {
          return AVERROR(ENOMEM);
     } else if (rt->transport != RTSP_TRANSPORT_RDT) {
         if(rtsp_st->dynamic_handler) {
-            rtp_parse_set_dynamic_protocol(rtsp_st->tx_ctx,
+            rtp_parse_set_dynamic_protocol(rtsp_st->transport_priv_data,
                                            rtsp_st->dynamic_protocol_context,
                                            rtsp_st->dynamic_handler);
         }
@@ -1374,18 +1374,18 @@
     }
 
     /* get next frames from the same RTP packet */
-    if (rt->cur_tx) {
+    if (rt->cur_transport_priv_data) {
         if (rt->transport == RTSP_TRANSPORT_RDT)
-            ret = ff_rdt_parse_packet(rt->cur_tx, pkt, NULL, 0);
+            ret = ff_rdt_parse_packet(rt->cur_transport_priv_data, pkt, NULL, 0);
         else
-            ret = rtp_parse_packet(rt->cur_tx, pkt, NULL, 0);
+            ret = rtp_parse_packet(rt->cur_transport_priv_data, pkt, NULL, 0);
         if (ret == 0) {
-            rt->cur_tx = NULL;
+            rt->cur_transport_priv_data = NULL;
             return 0;
         } else if (ret == 1) {
             return 0;
         } else {
-            rt->cur_tx = NULL;
+            rt->cur_transport_priv_data = NULL;
         }
     }
 
@@ -1399,21 +1399,21 @@
     case RTSP_LOWER_TRANSPORT_UDP:
     case RTSP_LOWER_TRANSPORT_UDP_MULTICAST:
         len = udp_read_packet(s, &rtsp_st, buf, sizeof(buf));
-        if (len >=0 && rtsp_st->tx_ctx && rt->transport == RTSP_TRANSPORT_RTP)
-            rtp_check_and_send_back_rr(rtsp_st->tx_ctx, len);
+        if (len >=0 && rtsp_st->transport_priv_data && rt->transport == RTSP_TRANSPORT_RTP)
+            rtp_check_and_send_back_rr(rtsp_st->transport_priv_data, len);
         break;
     }
     if (len < 0)
         return len;
     if (rt->transport == RTSP_TRANSPORT_RDT)
-        ret = ff_rdt_parse_packet(rtsp_st->tx_ctx, pkt, buf, len);
+        ret = ff_rdt_parse_packet(rtsp_st->transport_priv_data, pkt, buf, len);
     else
-        ret = rtp_parse_packet(rtsp_st->tx_ctx, pkt, buf, len);
+        ret = rtp_parse_packet(rtsp_st->transport_priv_data, pkt, buf, len);
     if (ret < 0)
         goto redo;
     if (ret == 1) {
         /* more packets may follow, so we save the RTP context */
-        rt->cur_tx = rtsp_st->tx_ctx;
+        rt->cur_transport_priv_data = rtsp_st->transport_priv_data;
     }
     return 0;
 }
Index: ffmpeg-svn/libavformat/rtsp.h
===================================================================
--- ffmpeg-svn.orig/libavformat/rtsp.h	2009-02-05 11:57:40.000000000 -0500
+++ ffmpeg-svn/libavformat/rtsp.h	2009-02-05 12:11:29.000000000 -0500
@@ -104,7 +104,7 @@
     enum RTSPLowerTransport lower_transport;
     enum RTSPServerType server_type;
     char last_reply[2048]; /* XXX: allocate ? */
-    void *cur_tx;
+    void *cur_transport_priv_data;
     int need_subscription;
     enum AVDiscard real_setup_cache[MAX_STREAMS];
     char last_subscription[1024];
@@ -112,7 +112,7 @@
 
 typedef struct RTSPStream {
     URLContext *rtp_handle; /* RTP stream handle */
-    void *tx_ctx; /* RTP/RDT parse context */
+    void *transport_priv_data; /* RTP/RDT parse context */
 
     int stream_index; /* corresponding stream index, if any. -1 if none (MPEG2TS case) */
     int interleaved_min, interleaved_max;  /* interleave ids, if TCP transport */



More information about the ffmpeg-devel mailing list