diff options
| author | 2024-10-28 13:08:13 -0400 | |
|---|---|---|
| committer | 2024-10-28 13:23:02 -0400 | |
| commit | 846e17728f2ed2af3672987ef61853f0bc96c224 (patch) | |
| tree | e8e81fc8a2a7de208bd9ba397ef3928d33110824 /src/codec/stb_image | |
| parent | d6735566cebf82a5d22a3ade22b9acd52fbe11a5 (diff) | |
| download | camu-846e17728f2ed2af3672987ef61853f0bc96c224.tar.gz camu-846e17728f2ed2af3672987ef61853f0bc96c224.tar.bz2 camu-846e17728f2ed2af3672987ef61853f0bc96c224.zip | |
Refactor video buffer and scaler, better A/V sync
Signed-off-by: Andrew Opalach <andrew@akon.city>
Diffstat (limited to 'src/codec/stb_image')
| -rw-r--r-- | src/codec/stb_image/impl.c | 12 |
1 files changed, 7 insertions, 5 deletions
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); |