mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-26 06:35:58 +01:00
examples/dmabuf-capture: stop using av_init_packet
It's deprecated in ffmpeg >= 4.4. Closes: https://github.com/swaywm/wlroots/issues/2798
This commit is contained in:
parent
e8ad05913f
commit
6230f7be4f
1 changed files with 8 additions and 7 deletions
|
@ -490,26 +490,27 @@ static void *vid_encode_thread(void *arg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
AVPacket pkt;
|
AVPacket *pkt = av_packet_alloc();
|
||||||
av_init_packet(&pkt);
|
int ret = avcodec_receive_packet(ctx->avctx, pkt);
|
||||||
|
|
||||||
int ret = avcodec_receive_packet(ctx->avctx, &pkt);
|
|
||||||
if (ret == AVERROR(EAGAIN)) {
|
if (ret == AVERROR(EAGAIN)) {
|
||||||
|
av_packet_free(&pkt);
|
||||||
break;
|
break;
|
||||||
} else if (ret == AVERROR_EOF) {
|
} else if (ret == AVERROR_EOF) {
|
||||||
av_log(ctx, AV_LOG_INFO, "Encoder flushed!\n");
|
av_log(ctx, AV_LOG_INFO, "Encoder flushed!\n");
|
||||||
|
av_packet_free(&pkt);
|
||||||
goto end;
|
goto end;
|
||||||
} else if (ret) {
|
} else if (ret) {
|
||||||
av_log(ctx, AV_LOG_ERROR, "Error encoding: %s!\n",
|
av_log(ctx, AV_LOG_ERROR, "Error encoding: %s!\n",
|
||||||
av_err2str(ret));
|
av_err2str(ret));
|
||||||
|
av_packet_free(&pkt);
|
||||||
err = ret;
|
err = ret;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
pkt.stream_index = 0;
|
pkt->stream_index = 0;
|
||||||
err = av_interleaved_write_frame(ctx->avf, &pkt);
|
err = av_interleaved_write_frame(ctx->avf, pkt);
|
||||||
|
|
||||||
av_packet_unref(&pkt);
|
av_packet_free(&pkt);
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
av_log(ctx, AV_LOG_ERROR, "Writing packet fail: %s!\n",
|
av_log(ctx, AV_LOG_ERROR, "Writing packet fail: %s!\n",
|
||||||
|
|
Loading…
Reference in a new issue