summaryrefslogtreecommitdiff
path: root/src/codec
diff options
context:
space:
mode:
Diffstat (limited to 'src/codec')
-rw-r--r--src/codec/ffmpeg/decoder.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/codec/ffmpeg/decoder.c b/src/codec/ffmpeg/decoder.c
index affe9fa..47b5b01 100644
--- a/src/codec/ffmpeg/decoder.c
+++ b/src/codec/ffmpeg/decoder.c
@@ -141,7 +141,6 @@ static bool get_hwdevice_config(struct camu_ff_decoder *av, const AVCodec *codec
static bool collect_supported_hwaccels(struct camu_ff_decoder *av)
{
- al_array_init(av->supported_hw_codecs);
const AVCodec *codec;
void *iter = NULL;
while ((codec = av_codec_iterate(&iter))) {
@@ -151,7 +150,6 @@ static bool collect_supported_hwaccels(struct camu_ff_decoder *av)
}
}
- al_array_init(av->supported_hw_devices);
enum AVHWDeviceType hw_device_type = AV_HWDEVICE_TYPE_NONE;
while ((hw_device_type = av_hwdevice_iterate_types(hw_device_type)) != AV_HWDEVICE_TYPE_NONE) {
al_array_push(av->supported_hw_devices, hw_device_type);
@@ -166,6 +164,10 @@ static bool collect_supported_hwaccels(struct camu_ff_decoder *av)
static void close_internal(struct camu_ff_decoder *av)
{
if (av->codec_context) avcodec_free_context(&av->codec_context);
+#ifdef CAMU_FF_DECODER_HWACCEL
+ al_array_free(av->supported_hw_codecs);
+ al_array_free(av->supported_hw_devices);
+#endif
}
static bool ff_decoder_init(struct camu_decoder *dec, struct camu_renderer *renderer, struct camu_codec_stream *stream,
@@ -174,6 +176,10 @@ static bool ff_decoder_init(struct camu_decoder *dec, struct camu_renderer *rend
struct camu_ff_decoder *av = (struct camu_ff_decoder *)dec;
av->codec_context = NULL;
+#ifdef CAMU_FF_DECODER_HWACCEL
+ al_array_init(av->supported_hw_codecs);
+ al_array_init(av->supported_hw_devices);
+#endif
AVCodecParameters *codecpar = stream->av.stream->codecpar;
const AVCodec *codec = avcodec_find_decoder(codecpar->codec_id);