summaryrefslogtreecommitdiff
path: root/src/codec/ffmpeg
diff options
context:
space:
mode:
authorAndrew Opalach <andrew@akon.city> 2025-08-12 17:47:45 -0400
committerAndrew Opalach <andrew@akon.city> 2025-08-12 17:47:45 -0400
commit7e796649557bfeae6eccba751d4a1ffae75de45c (patch)
treed58251d50b5db4ecf34b5ef99ff3edf8b86735d2 /src/codec/ffmpeg
parent2cc385b71e161eae39915bf24de53d5b704e7ea0 (diff)
downloadcamu-7e796649557bfeae6eccba751d4a1ffae75de45c.tar.gz
camu-7e796649557bfeae6eccba751d4a1ffae75de45c.tar.bz2
camu-7e796649557bfeae6eccba751d4a1ffae75de45c.zip
Runtime codec selection, Vulkan deconstruction
Signed-off-by: Andrew Opalach <andrew@akon.city>
Diffstat (limited to 'src/codec/ffmpeg')
-rw-r--r--src/codec/ffmpeg/decoder.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/codec/ffmpeg/decoder.c b/src/codec/ffmpeg/decoder.c
index cfa1dc2..7be21a2 100644
--- a/src/codec/ffmpeg/decoder.c
+++ b/src/codec/ffmpeg/decoder.c
@@ -151,11 +151,11 @@ static bool hw_device_supported_by_type(struct camu_ff_decoder *av, enum AVHWDev
}
*/
-static enum AVHWDeviceType hw_device_supported_by_name(struct camu_ff_decoder *av, const char *name)
+static enum AVHWDeviceType hw_device_supported_by_name(struct camu_ff_decoder *av, const char *name, size_t length)
{
enum AVHWDeviceType supported_type;
al_array_foreach(av->supported_hw_devices, i, supported_type) {
- if (strcmp(av_hwdevice_get_type_name(supported_type), name) == 0) {
+ if (al_strncmp(av_hwdevice_get_type_name(supported_type), name, length) == 0) {
return supported_type;
}
}
@@ -236,7 +236,8 @@ static bool ff_decoder_init(struct camu_decoder *dec, struct camu_renderer *rend
av->hw_device_type = AV_HWDEVICE_TYPE_NONE;
av->hw_pix_fmt = AV_PIX_FMT_NONE;
for (u32 i = 0; i < ARRAY_SIZE(hwdevces); i++) {
- av->hw_device_type = hw_device_supported_by_name(av, hwdevces[i]);
+ size_t length = sizeof(hwdevces[i]) - 1;
+ av->hw_device_type = hw_device_supported_by_name(av, hwdevces[i], length);
if (!get_hwdevice_config(av, codec, av->hw_device_type)) {
av->hw_device_type = AV_HWDEVICE_TYPE_NONE;
} else {
@@ -247,7 +248,8 @@ static bool ff_decoder_init(struct camu_decoder *dec, struct camu_renderer *rend
const AVCodec *hw_codec;
al_array_foreach(av->supported_hw_codecs, i, hw_codec) {
if (hw_codec->id == codecpar->codec_id) {
- av->hw_device_type = hw_device_supported_by_name(av, hw_codec->wrapper_name);
+ size_t length = al_strlen(hw_codec->wrapper_name);
+ av->hw_device_type = hw_device_supported_by_name(av, hw_codec->wrapper_name, length);
if (get_hwdevice_config(av, hw_codec, av->hw_device_type)) {
codec = hw_codec;
break;