[MPlayer-cvslog] r38475 - trunk/gui/util/bitmap.c
ib
subversion at mplayerhq.hu
Fri Apr 26 12:36:22 EEST 2024
Author: ib
Date: Fri Apr 26 12:36:22 2024
New Revision: 38475
Log:
Replace deprecated av_init_packet() with av_packet_alloc().
Modified:
trunk/gui/util/bitmap.c
Modified: trunk/gui/util/bitmap.c
==============================================================================
--- trunk/gui/util/bitmap.c Fri Apr 26 12:34:06 2024 (r38474)
+++ trunk/gui/util/bitmap.c Fri Apr 26 12:36:22 2024 (r38475)
@@ -83,7 +83,7 @@ static int pngRead(const char *fname, gu
int decode_ok, bpl;
AVCodecContext *avctx;
AVFrame *frame;
- AVPacket pkt;
+ AVPacket *pkt;
file = fopen(fname, "rb");
@@ -115,10 +115,12 @@ static int pngRead(const char *fname, gu
}
avctx = avcodec_alloc_context3(NULL);
+ pkt = av_packet_alloc();
frame = av_frame_alloc();
- if (!(avctx && frame)) {
+ if (!(avctx && pkt && frame)) {
av_frame_free(&frame);
+ av_packet_free(&pkt);
avcodec_free_context(&avctx);
av_free(data);
return 6;
@@ -126,18 +128,18 @@ static int pngRead(const char *fname, gu
if (avcodec_open2(avctx, avcodec_find_decoder(AV_CODEC_ID_PNG), NULL) < 0) {
av_frame_free(&frame);
+ av_packet_free(&pkt);
avcodec_free_context(&avctx);
av_free(data);
return 7;
}
- av_init_packet(&pkt);
- pkt.data = data;
- pkt.size = len;
+ pkt->data = data;
+ pkt->size = len;
/* HACK: Make PNGs decode normally instead of as CorePNG delta frames. */
- pkt.flags = AV_PKT_FLAG_KEY;
+ pkt->flags = AV_PKT_FLAG_KEY;
- decode_ok = (avcodec_send_packet(avctx, &pkt) == 0 &&
+ decode_ok = (avcodec_send_packet(avctx, pkt) == 0 &&
avcodec_receive_frame(avctx, frame) == 0);
memset(img, 0, sizeof(*img));
@@ -189,6 +191,7 @@ static int pngRead(const char *fname, gu
avcodec_close(avctx);
av_frame_free(&frame);
+ av_packet_free(&pkt);
avcodec_free_context(&avctx);
av_free(data);
More information about the MPlayer-cvslog
mailing list