diff options
Diffstat (limited to 'src/codec/stb_image.c')
| -rw-r--r-- | src/codec/stb_image.c | 18 |
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); |