From 846e17728f2ed2af3672987ef61853f0bc96c224 Mon Sep 17 00:00:00 2001 From: Andrew Opalach Date: Mon, 28 Oct 2024 13:08:13 -0400 Subject: Refactor video buffer and scaler, better A/V sync Signed-off-by: Andrew Opalach --- src/codec/stb_image/impl.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/codec/stb_image') diff --git a/src/codec/stb_image/impl.c b/src/codec/stb_image/impl.c index 98d9e2c..ac1cbc5 100644 --- a/src/codec/stb_image/impl.c +++ b/src/codec/stb_image/impl.c @@ -40,9 +40,10 @@ static bool stbi_demuxer_init(struct camu_demuxer *demux, struct cch_handle *han struct camu_codec_stream stream = { 0 }; stream.mode = CAMU_NORMAL; stream.type = CAMU_STREAM_VIDEO; - stream.video.width = w; - stream.video.height = h; - stream.video.format = camu_pixel_format_from_channels(channels); + struct camu_video_format *fmt = &stream.video.fmt; + fmt->width = w; + fmt->height = h; + fmt->format = camu_pixel_format_from_channels(channels); al_array_push(stb->demux.streams, stream); @@ -106,7 +107,8 @@ static s32 stbi_decoder_push(struct camu_decoder *dec, struct camu_codec_packet u8 *data = aki_buffer_get_ptr(packet->buffer, 0); u8 *pixels = stbi_load_from_memory(data, packet->buffer->size, &w, &h, &channels, 0); if (!pixels) return CAMU_ERR_ERROR; - al_assert(w == stb->stream->video.width && h == stb->stream->video.height); + struct camu_video_format *fmt = &stb->stream->video.fmt; + al_assert(w == fmt->width && h == fmt->height); struct camu_codec_frame *frame = al_alloc_object(struct camu_codec_frame); frame->mode = CAMU_NORMAL; @@ -115,7 +117,7 @@ static s32 stbi_decoder_push(struct camu_decoder *dec, struct camu_codec_packet frame->video.width = w; frame->video.height = h; frame->format = camu_pixel_format_from_channels(channels); - al_assert(frame->format == stb->stream->video.format); + al_assert(frame->format == fmt->format); frame->pts = 0.0; stb->callback(stb->userdata, frame); -- cgit v1.2.3-101-g0448