#include "libavcodec/get_bits.h"
#include "avformat.h"
+#include "avio_internal.h"
#include "rtpdec_formats.h"
#define RTP_H261_PAYLOAD_HEADER_SIZE 4
uint32_t timestamp;
};
-static void h261_free_dyn_buffer(AVIOContext **dyn_buf)
-{
- uint8_t *ptr_dyn_buffer;
- avio_close_dyn_buf(*dyn_buf, &ptr_dyn_buffer);
- av_free(ptr_dyn_buffer);
- *dyn_buf = NULL;
-}
-
-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)
return;
/* free buffer if it is valid */
- if (pl_ctx->buf) {
- h261_free_dyn_buffer(&pl_ctx->buf);
- }
+ ffio_free_dyn_buf(&pl_ctx->buf);
}
static int h261_handle_packet(AVFormatContext *ctx, PayloadContext *rtp_h261_ctx,
/* drop data of previous packets in case of non-continuous (lossy) packet stream */
if (rtp_h261_ctx->buf && rtp_h261_ctx->timestamp != *timestamp) {
- h261_free_dyn_buffer(&rtp_h261_ctx->buf);
+ ffio_free_dyn_buf(&rtp_h261_ctx->buf);
rtp_h261_ctx->endbyte_bits = 0;
}
.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,
};