diff options
Diffstat (limited to 'src/fw_iso_ctx.c')
-rw-r--r-- | src/fw_iso_ctx.c | 55 |
1 files changed, 15 insertions, 40 deletions
diff --git a/src/fw_iso_ctx.c b/src/fw_iso_ctx.c index 4a9f4d6..e777cd3 100644 --- a/src/fw_iso_ctx.c +++ b/src/fw_iso_ctx.c @@ -49,41 +49,18 @@ typedef struct { GError **error); } FwIsoCtxSource; -enum fw_iso_ctx_prop_type { - FW_ISO_CTX_PROP_TYPE_BYTES_PER_CHUNK = 1, - FW_ISO_CTX_PROP_TYPE_CHUNKS_PER_BUFFER, - FW_ISO_CTX_PROP_TYPE_REGISTERED_CHUNK_COUNT, - FW_ISO_CTX_PROP_TYPE_COUNT, -}; -static GParamSpec *fw_iso_ctx_props[FW_ISO_CTX_PROP_TYPE_COUNT] = { NULL, }; - enum fw_iso_ctx_sig_type { FW_ISO_CTX_SIG_TYPE_STOPPED = 1, FW_ISO_CTX_SIG_TYPE_COUNT, }; static guint fw_iso_ctx_sigs[FW_ISO_CTX_SIG_TYPE_COUNT] = { 0 }; -static void fw_iso_ctx_get_property(GObject *obj, guint id, GValue *val, - GParamSpec *spec) +static void fw_iso_ctx_get_property(GObject *obj, guint id, GValue *val, GParamSpec *spec) { HinokoFwIsoCtx *self = HINOKO_FW_ISO_CTX(obj); - HinokoFwIsoCtxPrivate *priv = - hinoko_fw_iso_ctx_get_instance_private(self); - - switch (id) { - case FW_ISO_CTX_PROP_TYPE_BYTES_PER_CHUNK: - g_value_set_uint(val, priv->bytes_per_chunk); - break; - case FW_ISO_CTX_PROP_TYPE_CHUNKS_PER_BUFFER: - g_value_set_uint(val, priv->chunks_per_buffer); - break; - case FW_ISO_CTX_PROP_TYPE_REGISTERED_CHUNK_COUNT: - g_value_set_uint(val, priv->registered_chunk_count); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, id, spec); - break; - } + const HinokoFwIsoCtxPrivate *priv = hinoko_fw_iso_ctx_get_instance_private(self); + + fw_iso_ctx_state_get_property(priv, obj, id, val, spec); } static void fw_iso_ctx_set_property(GObject *obj, guint id, const GValue *val, @@ -109,26 +86,24 @@ static void hinoko_fw_iso_ctx_class_init(HinokoFwIsoCtxClass *klass) gobject_class->set_property = fw_iso_ctx_set_property; gobject_class->finalize = fw_iso_ctx_finalize; - fw_iso_ctx_props[FW_ISO_CTX_PROP_TYPE_BYTES_PER_CHUNK] = - g_param_spec_uint("bytes-per-chunk", "bytes-per-chunk", + g_object_class_install_property(gobject_class, FW_ISO_CTX_PROP_TYPE_BYTES_PER_CHUNK, + g_param_spec_uint(BYTES_PER_CHUNK_PROP_NAME, "bytes-per-chunk", "The number of bytes for chunk in buffer.", 0, G_MAXUINT, 0, - G_PARAM_READABLE); - fw_iso_ctx_props[FW_ISO_CTX_PROP_TYPE_CHUNKS_PER_BUFFER] = - g_param_spec_uint("chunks-per-buffer", "chunks-per-buffer", + G_PARAM_READABLE)); + + g_object_class_install_property(gobject_class, FW_ISO_CTX_PROP_TYPE_CHUNKS_PER_BUFFER, + g_param_spec_uint(CHUNKS_PER_BUFFER_PROP_NAME, "chunks-per-buffer", "The number of chunks in buffer.", 0, G_MAXUINT, 0, - G_PARAM_READABLE); - fw_iso_ctx_props[FW_ISO_CTX_PROP_TYPE_REGISTERED_CHUNK_COUNT] = - g_param_spec_uint("registered-chunk-count", + G_PARAM_READABLE)); + + g_object_class_install_property(gobject_class, FW_ISO_CTX_PROP_TYPE_REGISTERED_CHUNK_COUNT, + g_param_spec_uint(REGISTERED_CHUNK_COUNT_PROP_NAME, "registered-chunk-count", "The number of chunk to be registered.", 0, G_MAXUINT, 0, - G_PARAM_READABLE); - - g_object_class_install_properties(gobject_class, - FW_ISO_CTX_PROP_TYPE_COUNT, - fw_iso_ctx_props); + G_PARAM_READABLE)); /** * HinokoFwIsoCtx::stopped: |