summaryrefslogtreecommitdiff
path: root/src/codec/stb_image
diff options
context:
space:
mode:
Diffstat (limited to 'src/codec/stb_image')
-rw-r--r--src/codec/stb_image/client.c7
-rw-r--r--src/codec/stb_image/server.c4
2 files changed, 6 insertions, 5 deletions
diff --git a/src/codec/stb_image/client.c b/src/codec/stb_image/client.c
index 3742def..250876f 100644
--- a/src/codec/stb_image/client.c
+++ b/src/codec/stb_image/client.c
@@ -22,15 +22,16 @@ static s32 stbi_decoder_push(struct camu_decoder *dec, struct camu_codec_packet
u8 *data = nn_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;
+
struct camu_video_format *fmt = &stb->stream->video.fmt;
- al_assert(w == fmt->width && h == fmt->height);
+ al_assert(w > 0 && h > 0 && (u32)w == fmt->width && (u32)h == fmt->height);
struct camu_codec_frame *frame = al_alloc_object(struct camu_codec_frame);
frame->mode = CAMU_NORMAL;
frame->flags = 0;
frame->data = pixels;
- frame->video.width = w;
- frame->video.height = h;
+ frame->video.width = (u32)w;
+ frame->video.height = (u32)h;
frame->format = camu_pixel_format_from_channels(channels);
al_assert(frame->format == fmt->format);
frame->pts = 0.0;
diff --git a/src/codec/stb_image/server.c b/src/codec/stb_image/server.c
index 3642a64..79327d0 100644
--- a/src/codec/stb_image/server.c
+++ b/src/codec/stb_image/server.c
@@ -28,8 +28,8 @@ static bool stbi_demuxer_init(struct camu_demuxer *demux, struct cch_handle *han
stream.mode = CAMU_NORMAL;
stream.type = CAMU_STREAM_VIDEO;
struct camu_video_format *fmt = &stream.video.fmt;
- fmt->width = w;
- fmt->height = h;
+ fmt->width = (u32)w;
+ fmt->height = (u32)h;
fmt->format = camu_pixel_format_from_channels(channels);
al_array_push(stb->demux.streams, stream);