summaryrefslogtreecommitdiff
path: root/src/codec/stb_image.c
diff options
context:
space:
mode:
authorAndrew Opalach <andrew@akon.city> 2026-04-13 17:01:47 -0400
committerAndrew Opalach <andrew@akon.city> 2026-04-13 17:01:47 -0400
commit77b54c35bf9587450cd636e0d7df37e190e28bfb (patch)
treea290efdd8b09066847199f3f52a32be70d24ef51 /src/codec/stb_image.c
parent20617b9c80cf8d8051ecdb53a2c22f68c012f21b (diff)
downloadcamu-77b54c35bf9587450cd636e0d7df37e190e28bfb.tar.gz
camu-77b54c35bf9587450cd636e0d7df37e190e28bfb.tar.bz2
camu-77b54c35bf9587450cd636e0d7df37e190e28bfb.zip
Smaller stuff that went uncommitted
Signed-off-by: Andrew Opalach <andrew@akon.city>
Diffstat (limited to 'src/codec/stb_image.c')
-rw-r--r--src/codec/stb_image.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/codec/stb_image.c b/src/codec/stb_image.c
index 0cc61c8..b37d6da 100644
--- a/src/codec/stb_image.c
+++ b/src/codec/stb_image.c
@@ -8,10 +8,16 @@
#define STBI_NO_STDIO
#define STBI_NO_FAILURE_STRINGS
#define STB_IMAGE_IMPLEMENTATION
+#ifdef CAMU_LOCAL_STB
#include <stb_image.h>
+#else
+#include <stb/stb_image.h>
+#endif
#include "stb_image.h"
+#define FORCE_RGBA
+
#ifdef LIANA_SERVER
#include "../cache/entry.h"
@@ -43,7 +49,11 @@ static bool stbi_demuxer_init(struct camu_demuxer *demux, struct cch_handle *han
struct camu_video_format *fmt = &stream.video.fmt;
fmt->width = (u32)w;
fmt->height = (u32)h;
+#ifdef FORCE_RGBA
+ fmt->format = camu_pixel_format_from_channels(4);
+#else
fmt->format = camu_pixel_format_from_channels(channels);
+#endif
al_array_push(stb->demux.streams, stream);
@@ -118,10 +128,8 @@ static s32 stbi_decoder_push(struct camu_decoder *dec, struct camu_codec_packet
s32 w, h, channels;
u8 *data = nn_buffer_get_ptr(packet->buffer, 0);
-#ifdef NAUNET_ON_WINDOWS
-#define STB_FORCE_RGBA
-#endif
-#ifdef STB_FORCE_RGBA
+
+#ifdef FORCE_RGBA
u8 *pixels = stbi_load_from_memory(data, packet->buffer->size, &w, &h, &channels, 4);
#else
u8 *pixels = stbi_load_from_memory(data, packet->buffer->size, &w, &h, &channels, 0);
@@ -140,7 +148,7 @@ static s32 stbi_decoder_push(struct camu_decoder *dec, struct camu_codec_packet
frame->data = pixels;
frame->video.width = (u32)w;
frame->video.height = (u32)h;
-#ifdef STB_FORCE_RGBA
+#ifdef FORCE_RGBA
frame->format = camu_pixel_format_from_channels(4);
#else
frame->format = camu_pixel_format_from_channels(channels);