Commit d594dbec authored by Martin Storsjö's avatar 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: 's avatarMartin Storsjö <martin@martin.st>
parent 8e32b1f0
......@@ -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 \
}
......
......@@ -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);
......
......@@ -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,
};
......@@ -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, \
}
......
......@@ -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,
};
......@@ -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,
};
......@@ -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,
};
......@@ -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,
};
......@@ -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,
};
......@@ -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,
};
......@@ -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,
};
......@@ -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,
};
......@@ -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,
};
......@@ -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, \
}
......
......@@ -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,
};
......@@ -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,
};
......@@ -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,
};
......@@ -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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment