wasapi2, mfvideosrc: Update "dispatcher" property to be only writable
authorSeungha Yang <seungha@centricular.com>
Fri, 31 Jul 2020 11:57:29 +0000 (20:57 +0900)
committerSeungha Yang <seungha@centricular.com>
Fri, 31 Jul 2020 12:50:16 +0000 (21:50 +0900)
Disallow getting dispatcher pointer, since it doesn't seem to be useful
and might not be safe.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1480>

sys/mediafoundation/gstmfvideosrc.c
sys/wasapi2/gstwasapi2sink.c
sys/wasapi2/gstwasapi2src.c

index ed67ddf..8db9c69 100644 (file)
@@ -144,13 +144,23 @@ gst_mf_video_src_class_init (GstMFVideoSrcClass * klass)
           G_PARAM_READWRITE | GST_PARAM_MUTABLE_READY |
           G_PARAM_STATIC_STRINGS));
 #if GST_MF_WINAPI_APP
+  /**
+   * GstMFVideoSrc:dispatcher:
+   *
+   * ICoreDispatcher COM object used for activating device from UI thread.
+   *
+   * Since: 1.18
+   */
   g_object_class_install_property (gobject_class, PROP_DISPATCHER,
       g_param_spec_pointer ("dispatcher", "Dispatcher",
           "ICoreDispatcher COM object to use. In order for application to ask "
           "permission of capture device, device activation should be running "
-          "on UI thread via ICoreDispatcher",
+          "on UI thread via ICoreDispatcher. This element will increase "
+          "the reference count of given ICoreDispatcher and release it after "
+          "use. Therefore, caller does not need to consider additional "
+          "reference count management",
           GST_PARAM_CONDITIONALLY_AVAILABLE | GST_PARAM_MUTABLE_READY |
-          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+          G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));
 #endif
 
   gst_element_class_set_static_metadata (element_class,
@@ -212,11 +222,6 @@ gst_mf_video_src_get_property (GObject * object, guint prop_id, GValue * value,
     case PROP_DEVICE_INDEX:
       g_value_set_int (value, self->device_index);
       break;
-#if GST_MF_WINAPI_APP
-    case PROP_DISPATCHER:
-      g_value_set_pointer (value, self->dispatcher);
-      break;
-#endif
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
index 4471105..031a6f3 100644 (file)
@@ -159,13 +159,22 @@ gst_wasapi2_sink_class_init (GstWasapi2SinkClass * klass)
           GST_PARAM_MUTABLE_PLAYING | G_PARAM_READWRITE |
           G_PARAM_STATIC_STRINGS));
 
+  /**
+   * GstWasapi2Sink:dispatcher:
+   *
+   * ICoreDispatcher COM object used for activating device from UI thread.
+   *
+   * Since: 1.18
+   */
   g_object_class_install_property (gobject_class, PROP_DISPATCHER,
       g_param_spec_pointer ("dispatcher", "Dispatcher",
           "ICoreDispatcher COM object to use. In order for application to ask "
           "permission of audio device, device activation should be running "
-          "on UI thread via ICoreDispatcher",
-          GST_PARAM_MUTABLE_READY | G_PARAM_READWRITE |
-          G_PARAM_STATIC_STRINGS));
+          "on UI thread via ICoreDispatcher. This element will increase "
+          "the reference count of given ICoreDispatcher and release it after "
+          "use. Therefore, caller does not need to consider additional "
+          "reference count management",
+          GST_PARAM_MUTABLE_READY | G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));
 
   gst_element_class_add_static_pad_template (element_class, &sink_template);
   gst_element_class_set_static_metadata (element_class, "Wasapi2Sink",
@@ -271,9 +280,6 @@ gst_wasapi2_sink_get_property (GObject * object, guint prop_id,
     case PROP_VOLUME:
       g_value_set_double (value, gst_wasapi2_sink_get_volume (self));
       break;
-    case PROP_DISPATCHER:
-      g_value_set_pointer (value, self->dispatcher);
-      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
index 6d2e790..3ab6956 100644 (file)
@@ -156,13 +156,22 @@ gst_wasapi2_src_class_init (GstWasapi2SrcClass * klass)
           GST_PARAM_MUTABLE_PLAYING | G_PARAM_READWRITE |
           G_PARAM_STATIC_STRINGS));
 
+  /**
+   * GstWasapi2Src:dispatcher:
+   *
+   * ICoreDispatcher COM object used for activating device from UI thread.
+   *
+   * Since: 1.18
+   */
   g_object_class_install_property (gobject_class, PROP_DISPATCHER,
       g_param_spec_pointer ("dispatcher", "Dispatcher",
           "ICoreDispatcher COM object to use. In order for application to ask "
           "permission of audio device, device activation should be running "
-          "on UI thread via ICoreDispatcher",
-          GST_PARAM_MUTABLE_READY | G_PARAM_READWRITE |
-          G_PARAM_STATIC_STRINGS));
+          "on UI thread via ICoreDispatcher. This element will increase "
+          "the reference count of given ICoreDispatcher and release it after "
+          "use. Therefore, caller does not need to consider additional "
+          "reference count management",
+          GST_PARAM_MUTABLE_READY | G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));
 
   gst_element_class_add_static_pad_template (element_class, &src_template);
   gst_element_class_set_static_metadata (element_class, "Wasapi2Src",
@@ -268,9 +277,6 @@ gst_wasapi2_src_get_property (GObject * object, guint prop_id,
     case PROP_VOLUME:
       g_value_set_double (value, gst_wasapi2_src_get_volume (self));
       break;
-    case PROP_DISPATCHER:
-      g_value_set_pointer (value, self->dispatcher);
-      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;