]> git.alsa-project.org Git - alsa-gobject.git/commitdiff
ctl: card: add virtual method to handle disconnection of sound card
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Sun, 1 Dec 2019 01:27:16 +0000 (10:27 +0900)
committerTakashi Sakamoto <o-takashi@sakamocchi.jp>
Thu, 12 Dec 2019 05:29:12 +0000 (14:29 +0900)
src/ctl/card.c
src/ctl/card.h
tests/alsactl-card

index 03809183241438188fbe2cf2f6f25ace4c3bc225..1adf01a1ac26e35eb74d708bbd02844a99a8b5d1 100644 (file)
@@ -135,7 +135,7 @@ static void alsactl_card_class_init(ALSACtlCardClass *klass)
         g_signal_new("handle-disconnection",
                      G_OBJECT_CLASS_TYPE(klass),
                      G_SIGNAL_RUN_LAST,
-                     0,
+                     G_STRUCT_OFFSET(ALSACtlCardClass, handle_disconnection),
                      NULL, NULL,
                      g_cclosure_marshal_VOID__VOID,
                      G_TYPE_NONE, 0, G_TYPE_NONE, 0);
index eb48633c2bac09c1212e130c1fc65a77db5671c5..72446de38c1f09baeb0b23d9fc49b11b363765a2 100644 (file)
@@ -58,6 +58,17 @@ struct _ALSACtlCardClass {
      */
     void (*handle_elem_event)(ALSACtlCard *self, const ALSACtlElemId *elem_id,
                               ALSACtlEventMaskFlag events);
+
+    /**
+     * ALSACtlCardClass::handle_disconnection:
+     * @self: A #ALSACtlCard.
+     *
+     * When the sound card is not available anymore due to unbinding driver or
+     * hot unplugging, this signal is emit. The owner of this object should
+     * call g_object_free() as quickly as possible to release ALSA control
+     * character device.
+     */
+    void (*handle_disconnection)(ALSACtlCard *self);
 };
 
 GType alsactl_card_get_type() G_GNUC_CONST;
index d4276e1829b88db600a1e0a4738b87246323059d..b9491086906e446a7a309de796112e3391c003a4 100644 (file)
@@ -29,6 +29,7 @@ methods = (
     'remove_elems',
     'create_source',
     'do_handle_elem_event',
+    'do_handle_disconnection',
 )
 signals = (
     'handle-elem-event',