summaryrefslogtreecommitdiff
path: root/src/codec
diff options
context:
space:
mode:
authorAndrew Opalach <andrew@akon.city> 2026-09-07 15:06:14 -0400
committerAndrew Opalach <andrew@akon.city> 2026-09-07 15:06:14 -0400
commitc66c7c64ebd16287b892f8a780cffcabafba3799 (patch)
treeb2195902ef055147878b591cf1171be7e6133c97 /src/codec
parent1758ae9e860bd3b65b661e3c804288c3599f4fd4 (diff)
downloadcamu-c66c7c64ebd16287b892f8a780cffcabafba3799.tar.gz
camu-c66c7c64ebd16287b892f8a780cffcabafba3799.tar.bz2
camu-c66c7c64ebd16287b892f8a780cffcabafba3799.zip
Better OSD behavior, lots of build stuff
Signed-off-by: Andrew Opalach <andrew@akon.city>
Diffstat (limited to 'src/codec')
-rw-r--r--src/codec/codecs.c16
-rw-r--r--src/codec/codecs.h3
-rw-r--r--src/codec/ffmpeg/decoder.c9
-rw-r--r--src/codec/ffmpeg/meson.build4
4 files changed, 20 insertions, 12 deletions
diff --git a/src/codec/codecs.c b/src/codec/codecs.c
index a373daf..de0a785 100644
--- a/src/codec/codecs.c
+++ b/src/codec/codecs.c
@@ -18,7 +18,8 @@
struct camu_codec_info codec_information[] = {
#ifdef CAMU_HAVE_WUFFS
{
- .name = al_str_c("wuffs"),
+ .id = al_str_c("wuffs"),
+ .name = al_str_c("Wuffs"),
.supported = (s32[]){ CAMU_CODEC_PNG, CAMU_CODEC_NONE },
#ifdef LIANA_SERVER
.create_demuxer = camu_wuffs_demuxer_create,
@@ -30,7 +31,12 @@ struct camu_codec_info codec_information[] = {
#endif
#ifdef CAMU_HAVE_STB_IMAGE
{
+ .id = al_str_c("stbi"),
+#ifdef CAMU_STBI_USE_WUFFS
+ .name = al_str_c("Wuffs (via stb_image API)"),
+#else
.name = al_str_c("stb_image"),
+#endif
.supported = (s32[]){ CAMU_CODEC_PNG, CAMU_CODEC_JPEG, CAMU_CODEC_NONE },
#ifdef LIANA_SERVER
.create_demuxer = camu_stbi_demuxer_create,
@@ -42,6 +48,7 @@ struct camu_codec_info codec_information[] = {
#endif
#ifdef CAMU_HAVE_SPNG
{
+ .id = al_str_c("spng"),
.name = al_str_c("spng"),
.supported = (s32[]){ CAMU_CODEC_PNG, CAMU_CODEC_NONE },
#ifdef LIANA_SERVER
@@ -54,6 +61,7 @@ struct camu_codec_info codec_information[] = {
#endif
#ifdef CAMU_HAVE_FFMPEG
{
+ .id = al_str_c("ff"),
.name = al_str_c("FFmpeg"),
.supported = (s32[]){ CAMU_CODEC_FALLBACK },
#ifdef LIANA_SERVER
@@ -81,13 +89,13 @@ struct camu_codec_info *camu_codec_info_by_type(s32 type)
return NULL;
}
-struct camu_codec_info *camu_codec_info_by_name(str *name)
+struct camu_codec_info *camu_codec_info_by_id(str *id)
{
- if (al_str_eq(name, &al_str_c("pcm_s16le"))) {
+ if (al_str_eq(id, &al_str_c("pcm_s16le"))) {
return (struct camu_codec_info *)0xcdda;
}
for (u32 i = 0; i < ARRAY_SIZE(codec_information); i++) {
- if (al_str_eq(&codec_information[i].name, name)) {
+ if (al_str_eq(&codec_information[i].id, id)) {
return &codec_information[i];
}
}
diff --git a/src/codec/codecs.h b/src/codec/codecs.h
index d383eec..e61ee42 100644
--- a/src/codec/codecs.h
+++ b/src/codec/codecs.h
@@ -3,6 +3,7 @@
#include <al/str.h>
struct camu_codec_info {
+ str id;
str name;
s32 *supported;
struct camu_demuxer *(*create_demuxer)(void);
@@ -12,4 +13,4 @@ struct camu_codec_info {
extern struct camu_codec_info codec_information[];
struct camu_codec_info *camu_codec_info_by_type(s32 type);
-struct camu_codec_info *camu_codec_info_by_name(str *name);
+struct camu_codec_info *camu_codec_info_by_id(str *id);
diff --git a/src/codec/ffmpeg/decoder.c b/src/codec/ffmpeg/decoder.c
index d24677a..95fb0bf 100644
--- a/src/codec/ffmpeg/decoder.c
+++ b/src/codec/ffmpeg/decoder.c
@@ -81,7 +81,7 @@ static s32 init_hwframe_context(struct camu_ff_decoder *av, AVCodecContext *cont
static bool fallback_to_sw_codec(struct camu_ff_decoder *av, const AVCodec *codec)
{
- log_warn("Attempting software decoding fallback...");
+ log_warn("Falling back to software decoding.");
// Remake AVCodecContext as a software decoder.
AVCodecParameters *codecpar = av->codecpar;
av->errored_hw_context = av->codec_context;
@@ -96,7 +96,7 @@ static bool fallback_to_sw_codec(struct camu_ff_decoder *av, const AVCodec *code
return false;
}
log_codec_name(codec, NULL);
- log_info("Using software fallback with %i threads for decoder.", av->thread_count);
+ log_debug("Using software fallback with %i threads for decoder.", av->thread_count);
return true;
}
@@ -248,8 +248,7 @@ static bool ff_decoder_init(struct camu_decoder *dec, struct camu_renderer *rend
}
#ifdef CAMU_FF_DECODER_HWACCEL
av->sw_codec = codec;
- // @TODO: How do you correctly probe avcodec_get_hw_config() if find_decoder()
- // always returns libdav1d first?
+ // @TODO: How to correctly probe avcodec_get_hw_config() if find_decoder() always returns libdav1d first?
if (al_strscmp(codec->name, "libdav1d") == 0) {
if (!(codec = avcodec_find_decoder_by_name("av1"))) {
codec = av->sw_codec;
@@ -333,7 +332,7 @@ static bool ff_decoder_init(struct camu_decoder *dec, struct camu_renderer *rend
// - https://ffmpeg.org/ffmpeg-codecs.html#Codec-Options
av->codec_context->thread_type = FF_THREAD_FRAME;
av->codec_context->thread_count = av->thread_count;
- log_info("Using %i threads for decoder.", av->thread_count);
+ log_debug("Using %i threads for decoder.", av->thread_count);
#ifdef CAMU_FF_DECODER_HWACCEL
}
#endif
diff --git a/src/codec/ffmpeg/meson.build b/src/codec/ffmpeg/meson.build
index 1691c29..401c93a 100644
--- a/src/codec/ffmpeg/meson.build
+++ b/src/codec/ffmpeg/meson.build
@@ -64,13 +64,13 @@ if not ffmpeg_force_fallback
ffmpeg_args += ['-DCAMU_TRY_HWACCEL']
endif
elif ffmpeg_version_option == 'system'
- error('System FFmpeg requested but not found. Add \'--force-fallback-for=ffmpeg\' or \'-Dcodec-ffmpeg-version=[8,7,6,...]\'.')
+ error('System FFmpeg requested but not found. Add \'--force-fallback-for=ffmpeg\' or \'-Dcodec-ffmpeg-version=[9,8,7,...]\'.')
endif
endif
# Fallback if requested or necessary.
if ffmpeg_force_fallback or not libavutil.found()
if ffmpeg_version_option == 'system'
- ffmpeg_version_option = '8' # Default to current latest.
+ ffmpeg_version_option = '9' # Default to current latest.
endif
subproject('ffmpeg' + ffmpeg_version_option) # Override libav dependencies.
endif