mirror of
https://github.com/mpv-player/mpv.git
synced 2025-12-26 12:50:19 +00:00
Replace deprecated av_free_packet() calls
av_free_packet() got finally deprecated. Use av_packet_unref() instead, which has almost the same semantics, has existed for a while, and is available in all FFmpeg and Libav versions we support.
This commit is contained in:
@@ -146,7 +146,7 @@ static void uninit(struct af_instance* af)
|
||||
af_ac3enc_t *s = af->priv;
|
||||
|
||||
if (s) {
|
||||
av_free_packet(&s->pkt);
|
||||
av_packet_unref(&s->pkt);
|
||||
if(s->lavc_actx) {
|
||||
avcodec_close(s->lavc_actx);
|
||||
av_free(s->lavc_actx);
|
||||
|
||||
@@ -853,7 +853,7 @@ static int demux_lavf_fill_buffer(demuxer_t *demux)
|
||||
AVPacket *pkt = &(AVPacket){0};
|
||||
int r = av_read_frame(priv->avfc, pkt);
|
||||
if (r < 0) {
|
||||
av_free_packet(pkt);
|
||||
av_packet_unref(pkt);
|
||||
if (r == AVERROR(EAGAIN))
|
||||
return 1;
|
||||
if (r == AVERROR_EOF)
|
||||
@@ -870,13 +870,13 @@ static int demux_lavf_fill_buffer(demuxer_t *demux)
|
||||
AVStream *st = priv->avfc->streams[pkt->stream_index];
|
||||
|
||||
if (!demux_stream_is_selected(stream)) {
|
||||
av_free_packet(pkt);
|
||||
av_packet_unref(pkt);
|
||||
return 1; // don't signal EOF if skipping a packet
|
||||
}
|
||||
|
||||
struct demux_packet *dp = new_demux_packet_from_avpacket(pkt);
|
||||
if (!dp) {
|
||||
av_free_packet(pkt);
|
||||
av_packet_unref(pkt);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -896,7 +896,7 @@ static int demux_lavf_fill_buffer(demuxer_t *demux)
|
||||
} else if (dp->dts != MP_NOPTS_VALUE) {
|
||||
priv->last_pts = dp->dts * AV_TIME_BASE;
|
||||
}
|
||||
av_free_packet(pkt);
|
||||
av_packet_unref(pkt);
|
||||
|
||||
if (priv->format_hack.clear_filepos)
|
||||
dp->pos = -1;
|
||||
|
||||
@@ -183,7 +183,7 @@ static int parse_webvtt(AVPacket *in, AVPacket *pkt)
|
||||
AV_PKT_DATA_WEBVTT_IDENTIFIER,
|
||||
id_len);
|
||||
if (buf == NULL) {
|
||||
av_free_packet(pkt);
|
||||
av_packet_unref(pkt);
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
memcpy(buf, id, id_len);
|
||||
@@ -194,7 +194,7 @@ static int parse_webvtt(AVPacket *in, AVPacket *pkt)
|
||||
AV_PKT_DATA_WEBVTT_SETTINGS,
|
||||
settings_len);
|
||||
if (buf == NULL) {
|
||||
av_free_packet(pkt);
|
||||
av_packet_unref(pkt);
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
memcpy(buf, settings, settings_len);
|
||||
@@ -256,7 +256,7 @@ static void decode(struct sd *sd, struct demux_packet *packet)
|
||||
|
||||
done:
|
||||
avsubtitle_free(&sub);
|
||||
av_free_packet(&parsed_pkt);
|
||||
av_packet_unref(&parsed_pkt);
|
||||
}
|
||||
|
||||
static void reset(struct sd *sd)
|
||||
|
||||
@@ -146,7 +146,7 @@ error_exit:
|
||||
avcodec_close(avctx);
|
||||
av_free(avctx);
|
||||
av_frame_free(&pic);
|
||||
av_free_packet(&pkt);
|
||||
av_packet_unref(&pkt);
|
||||
return success;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user