|
|
|
@@ -445,10 +445,18 @@ static int librav1e_receive_packet(AVCodecContext *avctx, AVPacket *pkt) |
|
|
|
if (frame->buf[0]) { |
|
|
|
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(frame->format); |
|
|
|
|
|
|
|
int64_t *pts = av_malloc(sizeof(int64_t)); |
|
|
|
if (!pts) { |
|
|
|
av_log(avctx, AV_LOG_ERROR, "Could not allocate PTS buffer.\n"); |
|
|
|
return AVERROR(ENOMEM); |
|
|
|
} |
|
|
|
*pts = frame->pts; |
|
|
|
|
|
|
|
rframe = rav1e_frame_new(ctx->ctx); |
|
|
|
if (!rframe) { |
|
|
|
av_log(avctx, AV_LOG_ERROR, "Could not allocate new rav1e frame.\n"); |
|
|
|
av_frame_unref(frame); |
|
|
|
av_freep(&pts); |
|
|
|
return AVERROR(ENOMEM); |
|
|
|
} |
|
|
|
|
|
|
|
@@ -460,6 +468,7 @@ static int librav1e_receive_packet(AVCodecContext *avctx, AVPacket *pkt) |
|
|
|
frame->linesize[i], bytes); |
|
|
|
} |
|
|
|
av_frame_unref(frame); |
|
|
|
rav1e_frame_set_opaque(rframe, pts, av_free); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@@ -535,7 +544,8 @@ retry: |
|
|
|
if (rpkt->frame_type == RA_FRAME_TYPE_KEY) |
|
|
|
pkt->flags |= AV_PKT_FLAG_KEY; |
|
|
|
|
|
|
|
pkt->pts = pkt->dts = rpkt->input_frameno * avctx->ticks_per_frame; |
|
|
|
pkt->pts = pkt->dts = *((int64_t *) rpkt->opaque); |
|
|
|
av_free(rpkt->opaque); |
|
|
|
rav1e_packet_unref(rpkt); |
|
|
|
|
|
|
|
if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) { |
|
|
|
|