[FFmpeg-cvslog] rtpdec: Rename the free method to close

Martin Storsjö git at videolan.org
Wed Feb 25 01:05:24 CET 2015


ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Tue Feb 24 17:01:48 2015 +0200| [d594dbecce5f3af7f80bbf5bb1b516d740b69ccd] | committer: Martin Storsjö

rtpdec: Rename the free method to close

Many of these functions were named foo_free_context, and since
the functions no longer should free the context itself, only
allocated elements within it, the previous naming was slightly
misleading.

Signed-off-by: Martin Storsjö <martin at martin.st>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d594dbecce5f3af7f80bbf5bb1b516d740b69ccd
---

 libavformat/rdt.c                 |    4 ++--
 libavformat/rtpdec.h              |    2 +-
 libavformat/rtpdec_ac3.c          |    4 ++--
 libavformat/rtpdec_asf.c          |    4 ++--
 libavformat/rtpdec_dv.c           |    4 ++--
 libavformat/rtpdec_h261.c         |    4 ++--
 libavformat/rtpdec_h263_rfc2190.c |    4 ++--
 libavformat/rtpdec_h264.c         |    4 ++--
 libavformat/rtpdec_jpeg.c         |    4 ++--
 libavformat/rtpdec_latm.c         |    4 ++--
 libavformat/rtpdec_mpa_robust.c   |    4 ++--
 libavformat/rtpdec_mpeg4.c        |    4 ++--
 libavformat/rtpdec_mpegts.c       |    4 ++--
 libavformat/rtpdec_qt.c           |    4 ++--
 libavformat/rtpdec_svq3.c         |    4 ++--
 libavformat/rtpdec_vp8.c          |    4 ++--
 libavformat/rtpdec_xiph.c         |    6 +++---
 libavformat/rtsp.c                |    8 ++++----
 18 files changed, 38 insertions(+), 38 deletions(-)

diff --git a/libavformat/rdt.c b/libavformat/rdt.c
index 96b9eeb..b596334 100644
--- a/libavformat/rdt.c
+++ b/libavformat/rdt.c
@@ -527,7 +527,7 @@ static av_cold int rdt_init(AVFormatContext *s, int st_index, PayloadContext *rd
 }
 
 static void
-rdt_free_context (PayloadContext *rdt)
+rdt_close_context (PayloadContext *rdt)
 {
     int i;
 
@@ -550,7 +550,7 @@ static RTPDynamicProtocolHandler rdt_ ## n ## _handler = { \
     .priv_data_size   = sizeof(PayloadContext), \
     .init             = rdt_init, \
     .parse_sdp_a_line = rdt_parse_sdp_line, \
-    .free             = rdt_free_context, \
+    .close            = rdt_close_context, \
     .parse_packet     = rdt_parse_packet \
 }
 
diff --git a/libavformat/rtpdec.h b/libavformat/rtpdec.h
index 6087b7e..9282c4f 100644
--- a/libavformat/rtpdec.h
+++ b/libavformat/rtpdec.h
@@ -130,7 +130,7 @@ struct RTPDynamicProtocolHandler {
     /** Free any data needed by the rtp parsing for this dynamic data.
       * Don't free the protocol_data pointer itself, that is freed by the
       * caller. This is called even if the init method failed. */
-    void (*free)(PayloadContext *protocol_data);
+    void (*close)(PayloadContext *protocol_data);
     /** Parse handler for this dynamic packet */
     DynamicPayloadPacketHandlerProc parse_packet;
     int (*need_keyframe)(PayloadContext *context);
diff --git a/libavformat/rtpdec_ac3.c b/libavformat/rtpdec_ac3.c
index a2ff961..e519b28 100644
--- a/libavformat/rtpdec_ac3.c
+++ b/libavformat/rtpdec_ac3.c
@@ -32,7 +32,7 @@ struct PayloadContext {
     AVIOContext *fragment;
 };
 
-static void ac3_free_context(PayloadContext *data)
+static void ac3_close_context(PayloadContext *data)
 {
     ffio_free_dyn_buf(&data->fragment);
 }
@@ -128,6 +128,6 @@ RTPDynamicProtocolHandler ff_ac3_dynamic_handler = {
     .codec_id           = AV_CODEC_ID_AC3,
     .need_parsing       = AVSTREAM_PARSE_FULL,
     .priv_data_size     = sizeof(PayloadContext),
-    .free               = ac3_free_context,
+    .close              = ac3_close_context,
     .parse_packet       = ac3_handle_packet,
 };
diff --git a/libavformat/rtpdec_asf.c b/libavformat/rtpdec_asf.c
index 7eb720b..82ea12f 100644
--- a/libavformat/rtpdec_asf.c
+++ b/libavformat/rtpdec_asf.c
@@ -274,7 +274,7 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf,
     return res == 1 ? -1 : res;
 }
 
-static void asfrtp_free_context(PayloadContext *asf)
+static void asfrtp_close_context(PayloadContext *asf)
 {
     ffio_free_dyn_buf(&asf->pktbuf);
     av_freep(&asf->buf);
@@ -288,7 +288,7 @@ RTPDynamicProtocolHandler ff_ms_rtp_ ## n ## _handler = { \
     .codec_id         = AV_CODEC_ID_NONE, \
     .priv_data_size   = sizeof(PayloadContext), \
     .parse_sdp_a_line = asfrtp_parse_sdp_line, \
-    .free             = asfrtp_free_context, \
+    .close            = asfrtp_close_context, \
     .parse_packet     = asfrtp_parse_packet,   \
 }
 
diff --git a/libavformat/rtpdec_dv.c b/libavformat/rtpdec_dv.c
index 72d06f7..09d497a 100644
--- a/libavformat/rtpdec_dv.c
+++ b/libavformat/rtpdec_dv.c
@@ -32,7 +32,7 @@ struct PayloadContext {
     int         bundled_audio;
 };
 
-static av_cold void dv_free_context(PayloadContext *data)
+static av_cold void dv_close_context(PayloadContext *data)
 {
     ffio_free_dyn_buf(&data->buf);
 }
@@ -138,6 +138,6 @@ RTPDynamicProtocolHandler ff_dv_dynamic_handler = {
     .need_parsing     = AVSTREAM_PARSE_FULL,
     .parse_sdp_a_line = dv_parse_sdp_line,
     .priv_data_size   = sizeof(PayloadContext),
-    .free             = dv_free_context,
+    .close             = dv_close_context,
     .parse_packet     = dv_handle_packet,
 };
diff --git a/libavformat/rtpdec_h261.c b/libavformat/rtpdec_h261.c
index 6ca385f..00086c2 100644
--- a/libavformat/rtpdec_h261.c
+++ b/libavformat/rtpdec_h261.c
@@ -33,7 +33,7 @@ struct PayloadContext {
     uint32_t     timestamp;
 };
 
-static av_cold void h261_free_context(PayloadContext *pl_ctx)
+static av_cold void h261_close_context(PayloadContext *pl_ctx)
 {
     /* return if context is invalid */
     if (!pl_ctx)
@@ -168,7 +168,7 @@ RTPDynamicProtocolHandler ff_h261_dynamic_handler = {
     .codec_id          = AV_CODEC_ID_H261,
     .need_parsing      = AVSTREAM_PARSE_FULL,
     .priv_data_size    = sizeof(PayloadContext),
-    .free              = h261_free_context,
+    .close             = h261_close_context,
     .parse_packet      = h261_handle_packet,
     .static_payload_id = 31,
 };
diff --git a/libavformat/rtpdec_h263_rfc2190.c b/libavformat/rtpdec_h263_rfc2190.c
index f0794c7..3a58aee 100644
--- a/libavformat/rtpdec_h263_rfc2190.c
+++ b/libavformat/rtpdec_h263_rfc2190.c
@@ -40,7 +40,7 @@ struct PayloadContext {
     int          newformat;
 };
 
-static void h263_free_context(PayloadContext *data)
+static void h263_close_context(PayloadContext *data)
 {
     ffio_free_dyn_buf(&data->buf);
 }
@@ -189,6 +189,6 @@ RTPDynamicProtocolHandler ff_h263_rfc2190_dynamic_handler = {
     .need_parsing      = AVSTREAM_PARSE_FULL,
     .parse_packet      = h263_handle_packet,
     .priv_data_size    = sizeof(PayloadContext),
-    .free              = h263_free_context,
+    .close             = h263_close_context,
     .static_payload_id = 34,
 };
diff --git a/libavformat/rtpdec_h264.c b/libavformat/rtpdec_h264.c
index 99365d6..1a69011 100644
--- a/libavformat/rtpdec_h264.c
+++ b/libavformat/rtpdec_h264.c
@@ -371,7 +371,7 @@ static int h264_handle_packet(AVFormatContext *ctx, PayloadContext *data,
     return result;
 }
 
-static void h264_free_context(PayloadContext *data)
+static void h264_close_context(PayloadContext *data)
 {
 #ifdef DEBUG
     int ii;
@@ -413,6 +413,6 @@ RTPDynamicProtocolHandler ff_h264_dynamic_handler = {
     .need_parsing     = AVSTREAM_PARSE_FULL,
     .priv_data_size   = sizeof(PayloadContext),
     .parse_sdp_a_line = parse_h264_sdp_line,
-    .free             = h264_free_context,
+    .close            = h264_close_context,
     .parse_packet     = h264_handle_packet,
 };
diff --git a/libavformat/rtpdec_jpeg.c b/libavformat/rtpdec_jpeg.c
index d2ca6ab..44121d4 100644
--- a/libavformat/rtpdec_jpeg.c
+++ b/libavformat/rtpdec_jpeg.c
@@ -60,7 +60,7 @@ static const uint8_t default_quantizers[128] = {
     99,  99,  99,  99,  99,  99,  99,  99
 };
 
-static void jpeg_free_context(PayloadContext *jpeg)
+static void jpeg_close_context(PayloadContext *jpeg)
 {
     ffio_free_dyn_buf(&jpeg->frame);
 }
@@ -371,7 +371,7 @@ RTPDynamicProtocolHandler ff_jpeg_dynamic_handler = {
     .codec_type        = AVMEDIA_TYPE_VIDEO,
     .codec_id          = AV_CODEC_ID_MJPEG,
     .priv_data_size    = sizeof(PayloadContext),
-    .free              = jpeg_free_context,
+    .close             = jpeg_close_context,
     .parse_packet      = jpeg_parse_packet,
     .static_payload_id = 26,
 };
diff --git a/libavformat/rtpdec_latm.c b/libavformat/rtpdec_latm.c
index 81f3ae4..5c54c20 100644
--- a/libavformat/rtpdec_latm.c
+++ b/libavformat/rtpdec_latm.c
@@ -32,7 +32,7 @@ struct PayloadContext {
     uint32_t timestamp;
 };
 
-static void latm_free_context(PayloadContext *data)
+static void latm_close_context(PayloadContext *data)
 {
     ffio_free_dyn_buf(&data->dyn_buf);
     av_free(data->buf);
@@ -171,6 +171,6 @@ RTPDynamicProtocolHandler ff_mp4a_latm_dynamic_handler = {
     .codec_id           = AV_CODEC_ID_AAC,
     .priv_data_size     = sizeof(PayloadContext),
     .parse_sdp_a_line   = latm_parse_sdp_line,
-    .free               = latm_free_context,
+    .close              = latm_close_context,
     .parse_packet       = latm_parse_packet,
 };
diff --git a/libavformat/rtpdec_mpa_robust.c b/libavformat/rtpdec_mpa_robust.c
index 36b4691..028be09 100644
--- a/libavformat/rtpdec_mpa_robust.c
+++ b/libavformat/rtpdec_mpa_robust.c
@@ -34,7 +34,7 @@ struct PayloadContext {
     AVIOContext *fragment;
 };
 
-static void mpa_robust_free_context(PayloadContext *data)
+static void mpa_robust_close_context(PayloadContext *data)
 {
     ffio_free_dyn_buf(&data->fragment);
     av_free(data->split_buf);
@@ -195,6 +195,6 @@ RTPDynamicProtocolHandler ff_mpeg_audio_robust_dynamic_handler = {
     .codec_id          = AV_CODEC_ID_MP3ADU,
     .need_parsing      = AVSTREAM_PARSE_HEADERS,
     .priv_data_size    = sizeof(PayloadContext),
-    .free              = mpa_robust_free_context,
+    .close             = mpa_robust_close_context,
     .parse_packet      = mpa_robust_parse_packet,
 };
diff --git a/libavformat/rtpdec_mpeg4.c b/libavformat/rtpdec_mpeg4.c
index b5dc2eb..c08242e 100644
--- a/libavformat/rtpdec_mpeg4.c
+++ b/libavformat/rtpdec_mpeg4.c
@@ -91,7 +91,7 @@ static const AttrNameMap attr_names[] = {
     { NULL, -1, -1 },
 };
 
-static void free_context(PayloadContext *data)
+static void close_context(PayloadContext *data)
 {
     av_free(data->au_headers);
     av_free(data->mode);
@@ -330,6 +330,6 @@ RTPDynamicProtocolHandler ff_mpeg4_generic_dynamic_handler = {
     .codec_id           = AV_CODEC_ID_AAC,
     .priv_data_size     = sizeof(PayloadContext),
     .parse_sdp_a_line   = parse_sdp_line,
-    .free               = free_context,
+    .close              = close_context,
     .parse_packet       = aac_parse_packet,
 };
diff --git a/libavformat/rtpdec_mpegts.c b/libavformat/rtpdec_mpegts.c
index eb88873..0fb0a0d 100644
--- a/libavformat/rtpdec_mpegts.c
+++ b/libavformat/rtpdec_mpegts.c
@@ -30,7 +30,7 @@ struct PayloadContext {
     uint8_t buf[RTP_MAX_PACKET_LENGTH];
 };
 
-static void mpegts_free_context(PayloadContext *data)
+static void mpegts_close_context(PayloadContext *data)
 {
     if (!data)
         return;
@@ -94,6 +94,6 @@ RTPDynamicProtocolHandler ff_mpegts_dynamic_handler = {
     .priv_data_size    = sizeof(PayloadContext),
     .parse_packet      = mpegts_handle_packet,
     .init              = mpegts_init,
-    .free              = mpegts_free_context,
+    .close             = mpegts_close_context,
     .static_payload_id = 33,
 };
diff --git a/libavformat/rtpdec_qt.c b/libavformat/rtpdec_qt.c
index 3836a955..a8e41ea 100644
--- a/libavformat/rtpdec_qt.c
+++ b/libavformat/rtpdec_qt.c
@@ -235,7 +235,7 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt,
     }
 }
 
-static void qt_rtp_free(PayloadContext *qt)
+static void qt_rtp_close(PayloadContext *qt)
 {
     av_freep(&qt->pkt.data);
 }
@@ -246,7 +246,7 @@ RTPDynamicProtocolHandler ff_ ## m ## _rtp_ ## n ## _handler = { \
     .codec_type       = t, \
     .codec_id         = AV_CODEC_ID_NONE, \
     .priv_data_size   = sizeof(PayloadContext), \
-    .free             = qt_rtp_free,   \
+    .close            = qt_rtp_close,   \
     .parse_packet     = qt_rtp_parse_packet, \
 }
 
diff --git a/libavformat/rtpdec_svq3.c b/libavformat/rtpdec_svq3.c
index 030b379..3104795 100644
--- a/libavformat/rtpdec_svq3.c
+++ b/libavformat/rtpdec_svq3.c
@@ -106,7 +106,7 @@ static int svq3_parse_packet (AVFormatContext *s, PayloadContext *sv,
     return AVERROR(EAGAIN);
 }
 
-static void svq3_extradata_free(PayloadContext *sv)
+static void svq3_close_context(PayloadContext *sv)
 {
     ffio_free_dyn_buf(&sv->pktbuf);
 }
@@ -116,6 +116,6 @@ RTPDynamicProtocolHandler ff_svq3_dynamic_handler = {
     .codec_type       = AVMEDIA_TYPE_VIDEO,
     .codec_id         = AV_CODEC_ID_NONE,      // see if (config_packet) above
     .priv_data_size   = sizeof(PayloadContext),
-    .free             = svq3_extradata_free,
+    .close            = svq3_close_context,
     .parse_packet     = svq3_parse_packet,
 };
diff --git a/libavformat/rtpdec_vp8.c b/libavformat/rtpdec_vp8.c
index d156cd3..ae2c716 100644
--- a/libavformat/rtpdec_vp8.c
+++ b/libavformat/rtpdec_vp8.c
@@ -266,7 +266,7 @@ static av_cold int vp8_init(AVFormatContext *s, int st_index, PayloadContext *vp
     return 0;
 }
 
-static void vp8_free_context(PayloadContext *vp8)
+static void vp8_close_context(PayloadContext *vp8)
 {
     ffio_free_dyn_buf(&vp8->data);
 }
@@ -282,7 +282,7 @@ RTPDynamicProtocolHandler ff_vp8_dynamic_handler = {
     .codec_id       = AV_CODEC_ID_VP8,
     .priv_data_size = sizeof(PayloadContext),
     .init           = vp8_init,
-    .free           = vp8_free_context,
+    .close          = vp8_close_context,
     .parse_packet   = vp8_handle_packet,
     .need_keyframe  = vp8_need_keyframe,
 };
diff --git a/libavformat/rtpdec_xiph.c b/libavformat/rtpdec_xiph.c
index 83cccd9..66e6191 100644
--- a/libavformat/rtpdec_xiph.c
+++ b/libavformat/rtpdec_xiph.c
@@ -50,7 +50,7 @@ struct PayloadContext {
     int split_pkts;
 };
 
-static void xiph_free_context(PayloadContext * data)
+static void xiph_close_context(PayloadContext * data)
 {
     ffio_free_dyn_buf(&data->fragment);
     av_free(data->split_buf);
@@ -372,7 +372,7 @@ RTPDynamicProtocolHandler ff_theora_dynamic_handler = {
     .codec_id         = AV_CODEC_ID_THEORA,
     .priv_data_size   = sizeof(PayloadContext),
     .parse_sdp_a_line = xiph_parse_sdp_line,
-    .free             = xiph_free_context,
+    .close            = xiph_close_context,
     .parse_packet     = xiph_handle_packet,
 };
 
@@ -383,6 +383,6 @@ RTPDynamicProtocolHandler ff_vorbis_dynamic_handler = {
     .need_parsing     = AVSTREAM_PARSE_HEADERS,
     .priv_data_size   = sizeof(PayloadContext),
     .parse_sdp_a_line = xiph_parse_sdp_line,
-    .free             = xiph_free_context,
+    .close            = xiph_close_context,
     .parse_packet     = xiph_handle_packet,
 };
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index f7b7b32..55a7896 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -201,8 +201,8 @@ static void finalize_rtp_handler_init(AVFormatContext *s, RTSPStream *rtsp_st,
                                                  rtsp_st->dynamic_protocol_context);
         if (ret < 0) {
             if (rtsp_st->dynamic_protocol_context) {
-                if (rtsp_st->dynamic_handler->free)
-                    rtsp_st->dynamic_handler->free(
+                if (rtsp_st->dynamic_handler->close)
+                    rtsp_st->dynamic_handler->close(
                         rtsp_st->dynamic_protocol_context);
                 av_free(rtsp_st->dynamic_protocol_context);
             }
@@ -734,8 +734,8 @@ void ff_rtsp_close_streams(AVFormatContext *s)
         rtsp_st = rt->rtsp_streams[i];
         if (rtsp_st) {
             if (rtsp_st->dynamic_handler && rtsp_st->dynamic_protocol_context) {
-                if (rtsp_st->dynamic_handler->free)
-                    rtsp_st->dynamic_handler->free(
+                if (rtsp_st->dynamic_handler->close)
+                    rtsp_st->dynamic_handler->close(
                         rtsp_st->dynamic_protocol_context);
                 av_free(rtsp_st->dynamic_protocol_context);
             }



More information about the ffmpeg-cvslog mailing list