From f2bd2ef6fba6d20d6059281a48050d80fe538d25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= Date: Thu, 16 Jun 2022 17:18:19 +0200 Subject: [PATCH] spa: ffmpeg: implement spa_handle_factory::get_size This method is necessary for the creation of a handle, so implement it for both the encoder and decoder. --- spa/plugins/ffmpeg/ffmpeg-dec.c | 6 ++++++ spa/plugins/ffmpeg/ffmpeg-enc.c | 6 ++++++ spa/plugins/ffmpeg/ffmpeg.c | 2 ++ spa/plugins/ffmpeg/ffmpeg.h | 4 ++++ 4 files changed, 18 insertions(+) diff --git a/spa/plugins/ffmpeg/ffmpeg-dec.c b/spa/plugins/ffmpeg/ffmpeg-dec.c index 20952bf34..cab58ba69 100644 --- a/spa/plugins/ffmpeg/ffmpeg-dec.c +++ b/spa/plugins/ffmpeg/ffmpeg-dec.c @@ -458,6 +458,12 @@ impl_get_interface(struct spa_handle *handle, const char *type, void **interface return 0; } +size_t +spa_ffmpeg_dec_get_size(const struct spa_handle_factory *factory, const struct spa_dict *params) +{ + return sizeof(struct impl); +} + int spa_ffmpeg_dec_init(struct spa_handle *handle, const struct spa_dict *info, diff --git a/spa/plugins/ffmpeg/ffmpeg-enc.c b/spa/plugins/ffmpeg/ffmpeg-enc.c index 008db7b68..4123c2a29 100644 --- a/spa/plugins/ffmpeg/ffmpeg-enc.c +++ b/spa/plugins/ffmpeg/ffmpeg-enc.c @@ -437,6 +437,12 @@ impl_get_interface(struct spa_handle *handle, const char *type, void **interface return 0; } +size_t +spa_ffmpeg_enc_get_size(const struct spa_handle_factory *factory, const struct spa_dict *params) +{ + return sizeof(struct impl); +} + int spa_ffmpeg_enc_init(struct spa_handle *handle, const struct spa_dict *info, diff --git a/spa/plugins/ffmpeg/ffmpeg.c b/spa/plugins/ffmpeg/ffmpeg.c index f91979128..a39c93d3b 100644 --- a/spa/plugins/ffmpeg/ffmpeg.c +++ b/spa/plugins/ffmpeg/ffmpeg.c @@ -141,9 +141,11 @@ int spa_handle_factory_enum(const struct spa_handle_factory **factory, uint32_t if (av_codec_is_encoder(c)) { snprintf(name, sizeof(name), "encoder.%s", c->name); + f.get_size = spa_ffmpeg_enc_get_size; f.init = ffmpeg_enc_init; } else { snprintf(name, sizeof(name), "decoder.%s", c->name); + f.get_size = spa_ffmpeg_dec_get_size; f.init = ffmpeg_dec_init; } diff --git a/spa/plugins/ffmpeg/ffmpeg.h b/spa/plugins/ffmpeg/ffmpeg.h index e0ef98f27..19078d813 100644 --- a/spa/plugins/ffmpeg/ffmpeg.h +++ b/spa/plugins/ffmpeg/ffmpeg.h @@ -7,10 +7,14 @@ struct spa_dict; struct spa_handle; struct spa_support; +struct spa_handle_factory; int spa_ffmpeg_dec_init(struct spa_handle *handle, const struct spa_dict *info, const struct spa_support *support, uint32_t n_support); int spa_ffmpeg_enc_init(struct spa_handle *handle, const struct spa_dict *info, const struct spa_support *support, uint32_t n_support); +size_t spa_ffmpeg_dec_get_size(const struct spa_handle_factory *factory, const struct spa_dict *params); +size_t spa_ffmpeg_enc_get_size(const struct spa_handle_factory *factory, const struct spa_dict *params); + #endif