aboutsummaryrefslogtreecommitdiff
path: root/gst
diff options
context:
space:
mode:
Diffstat (limited to 'gst')
-rw-r--r--gst/Makefile.am12
-rw-r--r--gst/Makefile.in56
-rw-r--r--gst/gst.h4
-rw-r--r--gst/gst_private.h10
-rw-r--r--gst/gstallocator.c5
-rw-r--r--gst/gstatomicqueue.c4
-rw-r--r--gst/gstbin.c26
-rw-r--r--gst/gstbuffer.c19
-rw-r--r--gst/gstbuffer.h6
-rw-r--r--gst/gstbufferlist.c5
-rw-r--r--gst/gstbufferlist.h2
-rw-r--r--gst/gstbufferpool.c4
-rw-r--r--gst/gstbus.c43
-rw-r--r--gst/gstcaps.c4
-rw-r--r--gst/gstcaps.h4
-rw-r--r--gst/gstcapsfeatures.c5
-rw-r--r--gst/gstchildproxy.c8
-rw-r--r--gst/gstclock.c5
-rw-r--r--gst/gstcontrolbinding.c4
-rw-r--r--gst/gstdatetime.c16
-rw-r--r--gst/gstdevice.c23
-rw-r--r--gst/gstdevicemonitor.c805
-rw-r--r--gst/gstdevicemonitor.h88
-rw-r--r--gst/gstdevicemonitorfactory.c594
-rw-r--r--gst/gstdevicemonitorfactory.h90
-rw-r--r--gst/gstdeviceprovider.c591
-rw-r--r--gst/gstdeviceprovider.h142
-rw-r--r--gst/gstdeviceproviderfactory.c580
-rw-r--r--gst/gstdeviceproviderfactory.h90
-rw-r--r--gst/gstelement.c31
-rw-r--r--gst/gstelement.h3
-rw-r--r--gst/gstelementfactory.c16
-rw-r--r--gst/gstevent.h12
-rw-r--r--gst/gstformat.c7
-rw-r--r--gst/gstghostpad.c25
-rw-r--r--gst/gstglobaldevicemonitor.c501
-rw-r--r--gst/gstglobaldevicemonitor.h105
-rw-r--r--gst/gstinfo.h2
-rw-r--r--gst/gstmemory.c4
-rw-r--r--gst/gstmessage.c20
-rw-r--r--gst/gstmessage.h8
-rw-r--r--gst/gstmeta.c4
-rw-r--r--gst/gstminiobject.c12
-rw-r--r--gst/gstobject.c27
-rw-r--r--gst/gstpad.c40
-rw-r--r--gst/gstpad.h56
-rw-r--r--gst/gstplugin.c6
-rw-r--r--gst/gstplugin.h11
-rw-r--r--gst/gstpluginfeature.c13
-rw-r--r--gst/gstpluginfeature.h2
-rw-r--r--gst/gstpoll.c8
-rw-r--r--gst/gstpreset.c11
-rw-r--r--gst/gstquery.h4
-rw-r--r--gst/gstregistry.c36
-rw-r--r--gst/gstregistrybinary.c4
-rw-r--r--gst/gstregistrychunks.c20
-rw-r--r--gst/gstregistrychunks.h8
-rw-r--r--gst/gstsample.c16
-rw-r--r--gst/gststructure.c14
-rw-r--r--gst/gsttaglist.c19
-rw-r--r--gst/gsttagsetter.c4
-rw-r--r--gst/gsttaskpool.c6
-rw-r--r--gst/gsttoc.c26
-rw-r--r--gst/gsttocsetter.c4
-rw-r--r--gst/gsttypefind.c4
-rw-r--r--gst/gsttypefindfactory.c4
-rw-r--r--gst/gsturi.c20
-rw-r--r--gst/gstutils.c36
-rw-r--r--gst/gstvalue.c16
69 files changed, 2299 insertions, 2111 deletions
diff --git a/gst/Makefile.am b/gst/Makefile.am
index 86d226e..2e2a79c 100644
--- a/gst/Makefile.am
+++ b/gst/Makefile.am
@@ -72,15 +72,15 @@ libgstreamer_@GST_API_VERSION@_la_SOURCES = \
gstdatetime.c \
gstdebugutils.c \
gstdevice.c \
- gstdevicemonitor.c \
- gstdevicemonitorfactory.c \
+ gstdeviceprovider.c \
+ gstdeviceproviderfactory.c \
gstelement.c \
gstelementfactory.c \
gsterror.c \
gstevent.c \
gstformat.c \
gstghostpad.c \
- gstglobaldevicemonitor.c \
+ gstdevicemonitor.c \
gstinfo.c \
gstiterator.c \
gstatomicqueue.c \
@@ -177,14 +177,14 @@ gst_headers = \
gstelement.h \
gstelementmetadata.h \
gstdevice.h \
- gstdevicemonitor.h \
- gstdevicemonitorfactory.h \
+ gstdeviceprovider.h \
+ gstdeviceproviderfactory.h \
gstelementfactory.h \
gsterror.h \
gstevent.h \
gstformat.h \
gstghostpad.h \
- gstglobaldevicemonitor.h \
+ gstdevicemonitor.h \
gstinfo.h \
gstiterator.h \
gstatomicqueue.h \
diff --git a/gst/Makefile.in b/gst/Makefile.in
index eb59429..85f129d 100644
--- a/gst/Makefile.in
+++ b/gst/Makefile.in
@@ -175,9 +175,9 @@ am__libgstreamer_@GST_API_VERSION@_la_SOURCES_DIST = gst.c gstobject.c \
gstbufferpool.c gstbus.c gstcaps.c gstcapsfeatures.c \
gstchildproxy.c gstclock.c gstcontext.c gstcontrolbinding.c \
gstcontrolsource.c gstdatetime.c gstdebugutils.c gstdevice.c \
- gstdevicemonitor.c gstdevicemonitorfactory.c gstelement.c \
+ gstdeviceprovider.c gstdeviceproviderfactory.c gstelement.c \
gstelementfactory.c gsterror.c gstevent.c gstformat.c \
- gstghostpad.c gstglobaldevicemonitor.c gstinfo.c gstiterator.c \
+ gstghostpad.c gstdevicemonitor.c gstinfo.c gstiterator.c \
gstatomicqueue.c gstmessage.c gstmeta.c gstmemory.c \
gstminiobject.c gstpad.c gstpadtemplate.c gstparamspecs.c \
gstpipeline.c gstplugin.c gstpluginfeature.c gstpluginloader.c \
@@ -208,15 +208,15 @@ am_libgstreamer_@GST_API_VERSION@_la_OBJECTS = \
libgstreamer_@GST_API_VERSION@_la-gstdatetime.lo \
libgstreamer_@GST_API_VERSION@_la-gstdebugutils.lo \
libgstreamer_@GST_API_VERSION@_la-gstdevice.lo \
- libgstreamer_@GST_API_VERSION@_la-gstdevicemonitor.lo \
- libgstreamer_@GST_API_VERSION@_la-gstdevicemonitorfactory.lo \
+ libgstreamer_@GST_API_VERSION@_la-gstdeviceprovider.lo \
+ libgstreamer_@GST_API_VERSION@_la-gstdeviceproviderfactory.lo \
libgstreamer_@GST_API_VERSION@_la-gstelement.lo \
libgstreamer_@GST_API_VERSION@_la-gstelementfactory.lo \
libgstreamer_@GST_API_VERSION@_la-gsterror.lo \
libgstreamer_@GST_API_VERSION@_la-gstevent.lo \
libgstreamer_@GST_API_VERSION@_la-gstformat.lo \
libgstreamer_@GST_API_VERSION@_la-gstghostpad.lo \
- libgstreamer_@GST_API_VERSION@_la-gstglobaldevicemonitor.lo \
+ libgstreamer_@GST_API_VERSION@_la-gstdevicemonitor.lo \
libgstreamer_@GST_API_VERSION@_la-gstinfo.lo \
libgstreamer_@GST_API_VERSION@_la-gstiterator.lo \
libgstreamer_@GST_API_VERSION@_la-gstatomicqueue.lo \
@@ -701,15 +701,15 @@ libgstreamer_@GST_API_VERSION@_la_SOURCES = \
gstdatetime.c \
gstdebugutils.c \
gstdevice.c \
- gstdevicemonitor.c \
- gstdevicemonitorfactory.c \
+ gstdeviceprovider.c \
+ gstdeviceproviderfactory.c \
gstelement.c \
gstelementfactory.c \
gsterror.c \
gstevent.c \
gstformat.c \
gstghostpad.c \
- gstglobaldevicemonitor.c \
+ gstdevicemonitor.c \
gstinfo.c \
gstiterator.c \
gstatomicqueue.c \
@@ -808,14 +808,14 @@ gst_headers = \
gstelement.h \
gstelementmetadata.h \
gstdevice.h \
- gstdevicemonitor.h \
- gstdevicemonitorfactory.h \
+ gstdeviceprovider.h \
+ gstdeviceproviderfactory.h \
gstelementfactory.h \
gsterror.h \
gstevent.h \
gstformat.h \
gstghostpad.h \
- gstglobaldevicemonitor.h \
+ gstdevicemonitor.h \
gstinfo.h \
gstiterator.h \
gstatomicqueue.h \
@@ -988,7 +988,8 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstreamer_@GST_API_VERSION@_la-gstdebugutils.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstreamer_@GST_API_VERSION@_la-gstdevice.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstreamer_@GST_API_VERSION@_la-gstdevicemonitor.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstreamer_@GST_API_VERSION@_la-gstdevicemonitorfactory.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstreamer_@GST_API_VERSION@_la-gstdeviceprovider.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstreamer_@GST_API_VERSION@_la-gstdeviceproviderfactory.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstreamer_@GST_API_VERSION@_la-gstelement.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstreamer_@GST_API_VERSION@_la-gstelementfactory.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstreamer_@GST_API_VERSION@_la-gstenumtypes.Plo@am__quote@
@@ -996,7 +997,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstreamer_@GST_API_VERSION@_la-gstevent.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstreamer_@GST_API_VERSION@_la-gstformat.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstreamer_@GST_API_VERSION@_la-gstghostpad.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstreamer_@GST_API_VERSION@_la-gstglobaldevicemonitor.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstreamer_@GST_API_VERSION@_la-gstinfo.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstreamer_@GST_API_VERSION@_la-gstiterator.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstreamer_@GST_API_VERSION@_la-gstmemory.Plo@am__quote@
@@ -1186,19 +1186,19 @@ libgstreamer_@GST_API_VERSION@_la-gstdevice.lo: gstdevice.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstreamer_@GST_API_VERSION@_la_CFLAGS) $(CFLAGS) -c -o libgstreamer_@GST_API_VERSION@_la-gstdevice.lo `test -f 'gstdevice.c' || echo '$(srcdir)/'`gstdevice.c
-libgstreamer_@GST_API_VERSION@_la-gstdevicemonitor.lo: gstdevicemonitor.c
-@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstreamer_@GST_API_VERSION@_la_CFLAGS) $(CFLAGS) -MT libgstreamer_@GST_API_VERSION@_la-gstdevicemonitor.lo -MD -MP -MF $(DEPDIR)/libgstreamer_@GST_API_VERSION@_la-gstdevicemonitor.Tpo -c -o libgstreamer_@GST_API_VERSION@_la-gstdevicemonitor.lo `test -f 'gstdevicemonitor.c' || echo '$(srcdir)/'`gstdevicemonitor.c
-@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgstreamer_@GST_API_VERSION@_la-gstdevicemonitor.Tpo $(DEPDIR)/libgstreamer_@GST_API_VERSION@_la-gstdevicemonitor.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gstdevicemonitor.c' object='libgstreamer_@GST_API_VERSION@_la-gstdevicemonitor.lo' libtool=yes @AMDEPBACKSLASH@
+libgstreamer_@GST_API_VERSION@_la-gstdeviceprovider.lo: gstdeviceprovider.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstreamer_@GST_API_VERSION@_la_CFLAGS) $(CFLAGS) -MT libgstreamer_@GST_API_VERSION@_la-gstdeviceprovider.lo -MD -MP -MF $(DEPDIR)/libgstreamer_@GST_API_VERSION@_la-gstdeviceprovider.Tpo -c -o libgstreamer_@GST_API_VERSION@_la-gstdeviceprovider.lo `test -f 'gstdeviceprovider.c' || echo '$(srcdir)/'`gstdeviceprovider.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgstreamer_@GST_API_VERSION@_la-gstdeviceprovider.Tpo $(DEPDIR)/libgstreamer_@GST_API_VERSION@_la-gstdeviceprovider.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gstdeviceprovider.c' object='libgstreamer_@GST_API_VERSION@_la-gstdeviceprovider.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstreamer_@GST_API_VERSION@_la_CFLAGS) $(CFLAGS) -c -o libgstreamer_@GST_API_VERSION@_la-gstdevicemonitor.lo `test -f 'gstdevicemonitor.c' || echo '$(srcdir)/'`gstdevicemonitor.c
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstreamer_@GST_API_VERSION@_la_CFLAGS) $(CFLAGS) -c -o libgstreamer_@GST_API_VERSION@_la-gstdeviceprovider.lo `test -f 'gstdeviceprovider.c' || echo '$(srcdir)/'`gstdeviceprovider.c
-libgstreamer_@GST_API_VERSION@_la-gstdevicemonitorfactory.lo: gstdevicemonitorfactory.c
-@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstreamer_@GST_API_VERSION@_la_CFLAGS) $(CFLAGS) -MT libgstreamer_@GST_API_VERSION@_la-gstdevicemonitorfactory.lo -MD -MP -MF $(DEPDIR)/libgstreamer_@GST_API_VERSION@_la-gstdevicemonitorfactory.Tpo -c -o libgstreamer_@GST_API_VERSION@_la-gstdevicemonitorfactory.lo `test -f 'gstdevicemonitorfactory.c' || echo '$(srcdir)/'`gstdevicemonitorfactory.c
-@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgstreamer_@GST_API_VERSION@_la-gstdevicemonitorfactory.Tpo $(DEPDIR)/libgstreamer_@GST_API_VERSION@_la-gstdevicemonitorfactory.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gstdevicemonitorfactory.c' object='libgstreamer_@GST_API_VERSION@_la-gstdevicemonitorfactory.lo' libtool=yes @AMDEPBACKSLASH@
+libgstreamer_@GST_API_VERSION@_la-gstdeviceproviderfactory.lo: gstdeviceproviderfactory.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstreamer_@GST_API_VERSION@_la_CFLAGS) $(CFLAGS) -MT libgstreamer_@GST_API_VERSION@_la-gstdeviceproviderfactory.lo -MD -MP -MF $(DEPDIR)/libgstreamer_@GST_API_VERSION@_la-gstdeviceproviderfactory.Tpo -c -o libgstreamer_@GST_API_VERSION@_la-gstdeviceproviderfactory.lo `test -f 'gstdeviceproviderfactory.c' || echo '$(srcdir)/'`gstdeviceproviderfactory.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgstreamer_@GST_API_VERSION@_la-gstdeviceproviderfactory.Tpo $(DEPDIR)/libgstreamer_@GST_API_VERSION@_la-gstdeviceproviderfactory.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gstdeviceproviderfactory.c' object='libgstreamer_@GST_API_VERSION@_la-gstdeviceproviderfactory.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstreamer_@GST_API_VERSION@_la_CFLAGS) $(CFLAGS) -c -o libgstreamer_@GST_API_VERSION@_la-gstdevicemonitorfactory.lo `test -f 'gstdevicemonitorfactory.c' || echo '$(srcdir)/'`gstdevicemonitorfactory.c
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstreamer_@GST_API_VERSION@_la_CFLAGS) $(CFLAGS) -c -o libgstreamer_@GST_API_VERSION@_la-gstdeviceproviderfactory.lo `test -f 'gstdeviceproviderfactory.c' || echo '$(srcdir)/'`gstdeviceproviderfactory.c
libgstreamer_@GST_API_VERSION@_la-gstelement.lo: gstelement.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstreamer_@GST_API_VERSION@_la_CFLAGS) $(CFLAGS) -MT libgstreamer_@GST_API_VERSION@_la-gstelement.lo -MD -MP -MF $(DEPDIR)/libgstreamer_@GST_API_VERSION@_la-gstelement.Tpo -c -o libgstreamer_@GST_API_VERSION@_la-gstelement.lo `test -f 'gstelement.c' || echo '$(srcdir)/'`gstelement.c
@@ -1242,12 +1242,12 @@ libgstreamer_@GST_API_VERSION@_la-gstghostpad.lo: gstghostpad.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstreamer_@GST_API_VERSION@_la_CFLAGS) $(CFLAGS) -c -o libgstreamer_@GST_API_VERSION@_la-gstghostpad.lo `test -f 'gstghostpad.c' || echo '$(srcdir)/'`gstghostpad.c
-libgstreamer_@GST_API_VERSION@_la-gstglobaldevicemonitor.lo: gstglobaldevicemonitor.c
-@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstreamer_@GST_API_VERSION@_la_CFLAGS) $(CFLAGS) -MT libgstreamer_@GST_API_VERSION@_la-gstglobaldevicemonitor.lo -MD -MP -MF $(DEPDIR)/libgstreamer_@GST_API_VERSION@_la-gstglobaldevicemonitor.Tpo -c -o libgstreamer_@GST_API_VERSION@_la-gstglobaldevicemonitor.lo `test -f 'gstglobaldevicemonitor.c' || echo '$(srcdir)/'`gstglobaldevicemonitor.c
-@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgstreamer_@GST_API_VERSION@_la-gstglobaldevicemonitor.Tpo $(DEPDIR)/libgstreamer_@GST_API_VERSION@_la-gstglobaldevicemonitor.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gstglobaldevicemonitor.c' object='libgstreamer_@GST_API_VERSION@_la-gstglobaldevicemonitor.lo' libtool=yes @AMDEPBACKSLASH@
+libgstreamer_@GST_API_VERSION@_la-gstdevicemonitor.lo: gstdevicemonitor.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstreamer_@GST_API_VERSION@_la_CFLAGS) $(CFLAGS) -MT libgstreamer_@GST_API_VERSION@_la-gstdevicemonitor.lo -MD -MP -MF $(DEPDIR)/libgstreamer_@GST_API_VERSION@_la-gstdevicemonitor.Tpo -c -o libgstreamer_@GST_API_VERSION@_la-gstdevicemonitor.lo `test -f 'gstdevicemonitor.c' || echo '$(srcdir)/'`gstdevicemonitor.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgstreamer_@GST_API_VERSION@_la-gstdevicemonitor.Tpo $(DEPDIR)/libgstreamer_@GST_API_VERSION@_la-gstdevicemonitor.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gstdevicemonitor.c' object='libgstreamer_@GST_API_VERSION@_la-gstdevicemonitor.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstreamer_@GST_API_VERSION@_la_CFLAGS) $(CFLAGS) -c -o libgstreamer_@GST_API_VERSION@_la-gstglobaldevicemonitor.lo `test -f 'gstglobaldevicemonitor.c' || echo '$(srcdir)/'`gstglobaldevicemonitor.c
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstreamer_@GST_API_VERSION@_la_CFLAGS) $(CFLAGS) -c -o libgstreamer_@GST_API_VERSION@_la-gstdevicemonitor.lo `test -f 'gstdevicemonitor.c' || echo '$(srcdir)/'`gstdevicemonitor.c
libgstreamer_@GST_API_VERSION@_la-gstinfo.lo: gstinfo.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstreamer_@GST_API_VERSION@_la_CFLAGS) $(CFLAGS) -MT libgstreamer_@GST_API_VERSION@_la-gstinfo.lo -MD -MP -MF $(DEPDIR)/libgstreamer_@GST_API_VERSION@_la-gstinfo.Tpo -c -o libgstreamer_@GST_API_VERSION@_la-gstinfo.lo `test -f 'gstinfo.c' || echo '$(srcdir)/'`gstinfo.c
diff --git a/gst/gst.h b/gst/gst.h
index 9b20ba1..6532809 100644
--- a/gst/gst.h
+++ b/gst/gst.h
@@ -43,13 +43,13 @@
#include <gst/gstdatetime.h>
#include <gst/gstdebugutils.h>
#include <gst/gstdevice.h>
-#include <gst/gstdevicemonitor.h>
+#include <gst/gstdeviceprovider.h>
#include <gst/gstelement.h>
#include <gst/gstelementmetadata.h>
#include <gst/gsterror.h>
#include <gst/gstevent.h>
#include <gst/gstghostpad.h>
-#include <gst/gstglobaldevicemonitor.h>
+#include <gst/gstdevicemonitor.h>
#include <gst/gstinfo.h>
#include <gst/gstiterator.h>
#include <gst/gstmessage.h>
diff --git a/gst/gst_private.h b/gst/gst_private.h
index e85d5c5..b25707c 100644
--- a/gst/gst_private.h
+++ b/gst/gst_private.h
@@ -54,8 +54,8 @@ extern const char g_log_domain_gstreamer[];
/* for GstElement */
#include "gstelement.h"
-/* for GstDeviceMonitor */
-#include "gstdevicemonitor.h"
+/* for GstDeviceProvider */
+#include "gstdeviceprovider.h"
/* for GstToc */
#include "gsttoc.h"
@@ -399,19 +399,19 @@ struct _GstElementFactoryClass {
gpointer _gst_reserved[GST_PADDING];
};
-struct _GstDeviceMonitorFactory {
+struct _GstDeviceProviderFactory {
GstPluginFeature feature;
/* <private> */
GType type; /* unique GType the device factory or 0 if not loaded */
- volatile GstDeviceMonitor *monitor;
+ volatile GstDeviceProvider *provider;
gpointer metadata;
gpointer _gst_reserved[GST_PADDING];
};
-struct _GstDeviceMonitorFactoryClass {
+struct _GstDeviceProviderFactoryClass {
GstPluginFeatureClass parent;
/* <private> */
diff --git a/gst/gstallocator.c b/gst/gstallocator.c
index cbcb1e4..c6763e1 100644
--- a/gst/gstallocator.c
+++ b/gst/gstallocator.c
@@ -221,8 +221,9 @@ gst_allocator_register (const gchar * name, GstAllocator * allocator)
* Find a previously registered allocator with @name. When @name is %NULL, the
* default allocator will be returned.
*
- * Returns: (transfer full): a #GstAllocator or %NULL when the allocator with @name was not
- * registered. Use gst_object_unref() to release the allocator after usage.
+ * Returns: (transfer full) (nullable): a #GstAllocator or %NULL when
+ * the allocator with @name was not registered. Use gst_object_unref()
+ * to release the allocator after usage.
*/
GstAllocator *
gst_allocator_find (const gchar * name)
diff --git a/gst/gstatomicqueue.c b/gst/gstatomicqueue.c
index 72ad2e3..a80089c 100644
--- a/gst/gstatomicqueue.c
+++ b/gst/gstatomicqueue.c
@@ -214,8 +214,8 @@ gst_atomic_queue_unref (GstAtomicQueue * queue)
*
* Peek the head element of the queue without removing it from the queue.
*
- * Returns: (transfer none): the head element of @queue or %NULL when
- * the queue is empty.
+ * Returns: (transfer none) (nullable): the head element of @queue or
+ * %NULL when the queue is empty.
*/
gpointer
gst_atomic_queue_peek (GstAtomicQueue * queue)
diff --git a/gst/gstbin.c b/gst/gstbin.c
index 77bbc3e..634b6e4 100644
--- a/gst/gstbin.c
+++ b/gst/gstbin.c
@@ -1633,7 +1633,8 @@ no_function:
*
* MT safe. Caller owns returned value.
*
- * Returns: (transfer full): a #GstIterator of #GstElement, or %NULL
+ * Returns: (transfer full) (nullable): a #GstIterator of #GstElement,
+ * or %NULL
*/
GstIterator *
gst_bin_iterate_elements (GstBin * bin)
@@ -1673,7 +1674,8 @@ iterate_child_recurse (GstIterator * it, const GValue * item)
*
* MT safe. Caller owns returned value.
*
- * Returns: (transfer full): a #GstIterator of #GstElement, or %NULL
+ * Returns: (transfer full) (nullable): a #GstIterator of #GstElement,
+ * or %NULL
*/
GstIterator *
gst_bin_iterate_recurse (GstBin * bin)
@@ -1730,7 +1732,8 @@ sink_iterator_filter (const GValue * vchild, GValue * vbin)
*
* MT safe. Caller owns returned value.
*
- * Returns: (transfer full): a #GstIterator of #GstElement, or %NULL
+ * Returns: (transfer full) (nullable): a #GstIterator of #GstElement,
+ * or %NULL
*/
GstIterator *
gst_bin_iterate_sinks (GstBin * bin)
@@ -1790,7 +1793,8 @@ src_iterator_filter (const GValue * vchild, GValue * vbin)
*
* MT safe. Caller owns returned value.
*
- * Returns: (transfer full): a #GstIterator of #GstElement, or %NULL
+ * Returns: (transfer full) (nullable): a #GstIterator of #GstElement,
+ * or %NULL
*/
GstIterator *
gst_bin_iterate_sources (GstBin * bin)
@@ -2166,7 +2170,8 @@ gst_bin_sort_iterator_new (GstBin * bin)
*
* MT safe. Caller owns returned value.
*
- * Returns: (transfer full): a #GstIterator of #GstElement, or %NULL
+ * Returns: (transfer full) (nullable): a #GstIterator of #GstElement,
+ * or %NULL
*/
GstIterator *
gst_bin_iterate_sorted (GstBin * bin)
@@ -4126,7 +4131,8 @@ compare_name (const GValue * velement, const gchar * name)
*
* MT safe. Caller owns returned reference.
*
- * Returns: (transfer full): the #GstElement with the given name, or %NULL
+ * Returns: (transfer full) (nullable): the #GstElement with the given
+ * name, or %NULL
*/
GstElement *
gst_bin_get_by_name (GstBin * bin, const gchar * name)
@@ -4169,7 +4175,8 @@ gst_bin_get_by_name (GstBin * bin, const gchar * name)
*
* MT safe. Caller owns returned reference.
*
- * Returns: (transfer full): the #GstElement with the given name, or %NULL
+ * Returns: (transfer full) (nullable): the #GstElement with the given
+ * name, or %NULL
*/
GstElement *
gst_bin_get_by_name_recurse_up (GstBin * bin, const gchar * name)
@@ -4269,8 +4276,9 @@ gst_bin_get_by_interface (GstBin * bin, GType iface)
*
* MT safe. Caller owns returned value.
*
- * Returns: (transfer full): a #GstIterator of #GstElement for all elements
- * in the bin implementing the given interface, or %NULL
+ * Returns: (transfer full) (nullable): a #GstIterator of #GstElement
+ * for all elements in the bin implementing the given interface,
+ * or %NULL
*/
GstIterator *
gst_bin_iterate_all_by_interface (GstBin * bin, GType iface)
diff --git a/gst/gstbuffer.c b/gst/gstbuffer.c
index 8aef1c2..24efc56 100644
--- a/gst/gstbuffer.c
+++ b/gst/gstbuffer.c
@@ -650,8 +650,8 @@ gst_buffer_new (void)
*
* MT safe.
*
- * Returns: (transfer full): a new #GstBuffer, or %NULL if the memory couldn't
- * be allocated.
+ * Returns: (transfer full) (nullable): a new #GstBuffer, or %NULL if
+ * the memory couldn't be allocated.
*/
GstBuffer *
gst_buffer_new_allocate (GstAllocator * allocator, gsize size,
@@ -1235,8 +1235,8 @@ gst_buffer_is_all_memory_writable (GstBuffer * buffer)
/**
* gst_buffer_get_sizes:
* @buffer: a #GstBuffer.
- * @offset: (out): a pointer to the offset
- * @maxsize: (out): a pointer to the maxsize
+ * @offset: (out) (allow-none): a pointer to the offset
+ * @maxsize: (out) (allow-none): a pointer to the maxsize
*
* Get the total size of the memory blocks in @b.
*
@@ -1273,8 +1273,8 @@ gst_buffer_get_size (GstBuffer * buffer)
* @buffer: a #GstBuffer.
* @idx: an index
* @length: a length
- * @offset: (out): a pointer to the offset
- * @maxsize: (out): a pointer to the maxsize
+ * @offset: (out) (allow-none): a pointer to the offset
+ * @maxsize: (out) (allow-none): a pointer to the maxsize
*
* Get the total size of @length memory blocks stating from @idx in @buffer.
*
@@ -1934,7 +1934,8 @@ gst_buffer_append_region (GstBuffer * buf1, GstBuffer * buf2, gssize offset,
* Get the metadata for @api on buffer. When there is no such
* metadata, %NULL is returned.
*
- * Returns: (transfer none): the metadata for @api on @buffer.
+ * Returns: (transfer none) (nullable): the metadata for @api on
+ * @buffer.
*/
GstMeta *
gst_buffer_get_meta (GstBuffer * buffer, GType api)
@@ -2063,8 +2064,8 @@ gst_buffer_remove_meta (GstBuffer * buffer, GstMeta * meta)
*
* @state will be updated with an opaque state pointer
*
- * Returns: (transfer none): The next #GstMeta or %NULL when there are
- * no more items.
+ * Returns: (transfer none) (nullable): The next #GstMeta or %NULL
+ * when there are no more items.
*/
GstMeta *
gst_buffer_iterate_meta (GstBuffer * buffer, gpointer * state)
diff --git a/gst/gstbuffer.h b/gst/gstbuffer.h
index 0ebf142..643db7d 100644
--- a/gst/gstbuffer.h
+++ b/gst/gstbuffer.h
@@ -457,8 +457,8 @@ gboolean gst_buffer_copy_into (GstBuffer *dest, GstBuffer *src
/**
* gst_buffer_replace:
- * @obuf: (inout) (transfer full): pointer to a pointer to a #GstBuffer to be
- * replaced.
+ * @obuf: (inout) (transfer full) (nullable): pointer to a pointer to
+ * a #GstBuffer to be replaced.
* @nbuf: (transfer none) (allow-none): pointer to a #GstBuffer that will
* replace the buffer pointed to by @obuf.
*
@@ -496,7 +496,7 @@ GstBuffer* gst_buffer_append (GstBuffer *buf1, GstBuffer *buf
/**
* GstBufferForeachMetaFunc:
* @buffer: a #GstBuffer
- * @meta: a pointer to a #GstMeta
+ * @meta: (out) (nullable): a pointer to a #GstMeta
* @user_data: user data passed to gst_buffer_foreach_meta()
*
* A function that will be called from gst_buffer_foreach_meta(). The @meta
diff --git a/gst/gstbufferlist.c b/gst/gstbufferlist.c
index dca866c..7b8558c 100644
--- a/gst/gstbufferlist.c
+++ b/gst/gstbufferlist.c
@@ -227,8 +227,9 @@ gst_buffer_list_foreach (GstBufferList * list, GstBufferListFunc func,
*
* Get the buffer at @idx.
*
- * Returns: (transfer none): the buffer at @idx in @group or %NULL when there
- * is no buffer. The buffer remains valid as long as @list is valid.
+ * Returns: (transfer none) (nullable): the buffer at @idx in @group
+ * or %NULL when there is no buffer. The buffer remains valid as
+ * long as @list is valid.
*/
GstBuffer *
gst_buffer_list_get (GstBufferList * list, guint idx)
diff --git a/gst/gstbufferlist.h b/gst/gstbufferlist.h
index df8c455..e5ddb08 100644
--- a/gst/gstbufferlist.h
+++ b/gst/gstbufferlist.h
@@ -38,7 +38,7 @@ typedef struct _GstBufferList GstBufferList;
/**
* GstBufferListFunc:
- * @buffer: pointer the buffer
+ * @buffer: (out) (nullable): pointer the buffer
* @idx: the index of @buffer
* @user_data: user data passed to gst_buffer_list_foreach()
*
diff --git a/gst/gstbufferpool.c b/gst/gstbufferpool.c
index 6c14ce4..92f6648 100644
--- a/gst/gstbufferpool.c
+++ b/gst/gstbufferpool.c
@@ -823,8 +823,8 @@ gst_buffer_pool_config_set_params (GstStructure * config, GstCaps * caps,
/**
* gst_buffer_pool_config_set_allocator:
* @config: a #GstBufferPool configuration
- * @allocator: a #GstAllocator
- * @params: #GstAllocationParams
+ * @allocator: (allow-none): a #GstAllocator
+ * @params: (allow-none): #GstAllocationParams
*
* Set the @allocator and @params on @config.
*
diff --git a/gst/gstbus.c b/gst/gstbus.c
index 69cf6b9..0d784e1 100644
--- a/gst/gstbus.c
+++ b/gst/gstbus.c
@@ -467,10 +467,11 @@ gst_bus_set_flushing (GstBus * bus, gboolean flushing)
* @timeout is #GST_CLOCK_TIME_NONE, this function will block forever until a
* matching message was posted on the bus.
*
- * Returns: (transfer full): a #GstMessage matching the filter in @types,
- * or %NULL if no matching message was found on the bus until the timeout
- * expired. The message is taken from the bus and needs to be unreffed
- * with gst_message_unref() after usage.
+ * Returns: (transfer full) (nullable): a #GstMessage matching the
+ * filter in @types, or %NULL if no matching message was found on
+ * the bus until the timeout expired. The message is taken from
+ * the bus and needs to be unreffed with gst_message_unref() after
+ * usage.
*
* MT safe.
*/
@@ -568,10 +569,10 @@ beach:
* #GST_CLOCK_TIME_NONE, this function will block forever until a message was
* posted on the bus.
*
- * Returns: (transfer full): the #GstMessage that is on the bus after the
- * specified timeout or %NULL if the bus is empty after the timeout expired.
- * The message is taken from the bus and needs to be unreffed with
- * gst_message_unref() after usage.
+ * Returns: (transfer full) (nullable): the #GstMessage that is on the
+ * bus after the specified timeout or %NULL if the bus is empty
+ * after the timeout expired. The message is taken from the bus
+ * and needs to be unreffed with gst_message_unref() after usage.
*
* MT safe.
*/
@@ -594,10 +595,10 @@ gst_bus_timed_pop (GstBus * bus, GstClockTime timeout)
* the bus, all messages will be discarded. It is not possible to use message
* enums beyond #GST_MESSAGE_EXTENDED in the @events mask.
*
- * Returns: (transfer full): the next #GstMessage matching @type that is on
- * the bus, or %NULL if the bus is empty or there is no message matching
- * @type. The message is taken from the bus and needs to be unreffed with
- * gst_message_unref() after usage.
+ * Returns: (transfer full) (nullable): the next #GstMessage matching
+ * @type that is on the bus, or %NULL if the bus is empty or there
+ * is no message matching @type. The message is taken from the bus
+ * and needs to be unreffed with gst_message_unref() after usage.
*
* MT safe.
*/
@@ -616,9 +617,10 @@ gst_bus_pop_filtered (GstBus * bus, GstMessageType types)
*
* Get a message from the bus.
*
- * Returns: (transfer full): the #GstMessage that is on the bus, or %NULL if the
- * bus is empty. The message is taken from the bus and needs to be unreffed
- * with gst_message_unref() after usage.
+ * Returns: (transfer full) (nullable): the #GstMessage that is on the
+ * bus, or %NULL if the bus is empty. The message is taken from
+ * the bus and needs to be unreffed with gst_message_unref() after
+ * usage.
*
* MT safe.
*/
@@ -638,8 +640,8 @@ gst_bus_pop (GstBus * bus)
* on the bus' message queue. A reference is returned, and needs to be unreffed
* by the caller.
*
- * Returns: (transfer full): the #GstMessage that is on the bus, or %NULL if the
- * bus is empty.
+ * Returns: (transfer full) (nullable): the #GstMessage that is on the
+ * bus, or %NULL if the bus is empty.
*
* MT safe.
*/
@@ -1054,9 +1056,10 @@ poll_destroy_timeout (GstBusPollData * poll_data)
* better handled by setting up an asynchronous bus watch and doing things
* from there.
*
- * Returns: (transfer full): the message that was received, or %NULL if the
- * poll timed out. The message is taken from the bus and needs to be
- * unreffed with gst_message_unref() after usage.
+ * Returns: (transfer full) (nullable): the message that was received,
+ * or %NULL if the poll timed out. The message is taken from the
+ * bus and needs to be unreffed with gst_message_unref() after
+ * usage.
*/
GstMessage *
gst_bus_poll (GstBus * bus, GstMessageType events, GstClockTime timeout)
diff --git a/gst/gstcaps.c b/gst/gstcaps.c
index 4525ead..51f7ae4 100644
--- a/gst/gstcaps.c
+++ b/gst/gstcaps.c
@@ -901,8 +901,10 @@ gst_caps_set_features (GstCaps * caps, guint index, GstCapsFeatures * features)
if (features)
gst_caps_features_set_parent_refcount (features, &GST_CAPS_REFCOUNT (caps));
- if (old)
+ if (old) {
+ gst_caps_features_set_parent_refcount (old, NULL);
gst_caps_features_free (old);
+ }
}
/**
diff --git a/gst/gstcaps.h b/gst/gstcaps.h
index e29da34..2acf84c 100644
--- a/gst/gstcaps.h
+++ b/gst/gstcaps.h
@@ -288,8 +288,8 @@ gst_caps_copy (const GstCaps * caps)
/**
* gst_caps_replace:
- * @old_caps: (inout) (transfer full): pointer to a pointer to a #GstCaps to be
- * replaced.
+ * @old_caps: (inout) (transfer full) (nullable): pointer to a pointer
+ * to a #GstCaps to be replaced.
* @new_caps: (transfer none) (allow-none): pointer to a #GstCaps that will
* replace the caps pointed to by @ocaps.
*
diff --git a/gst/gstcapsfeatures.c b/gst/gstcapsfeatures.c
index e1e8f90..dade216 100644
--- a/gst/gstcapsfeatures.c
+++ b/gst/gstcapsfeatures.c
@@ -471,8 +471,9 @@ priv_gst_caps_features_append_to_gstring (const GstCapsFeatures * features,
*
* Free-function: gst_caps_features_free
*
- * Returns: (transfer full): a new #GstCapsFeatures or %NULL when the string could
- * not be parsed. Free with gst_caps_features_free() after use.
+ * Returns: (transfer full) (nullable): a new #GstCapsFeatures or
+ * %NULL when the string could not be parsed. Free with
+ * gst_caps_features_free() after use.
*
* Since: 1.2
*/
diff --git a/gst/gstchildproxy.c b/gst/gstchildproxy.c
index a83356a..f2a2595 100644
--- a/gst/gstchildproxy.c
+++ b/gst/gstchildproxy.c
@@ -108,8 +108,8 @@ gst_child_proxy_default_get_child_by_name (GstChildProxy * parent,
* together with gst_object_get_name(). If the interface is to be used with
* #GObjects, this methods needs to be overridden.
*
- * Returns: (transfer full): the child object or %NULL if not found. Unref
- * after usage.
+ * Returns: (transfer full) (nullable): the child object or %NULL if
+ * not found. Unref after usage.
*
* MT safe.
*/
@@ -129,8 +129,8 @@ gst_child_proxy_get_child_by_name (GstChildProxy * parent, const gchar * name)
*
* Fetches a child by its number.
*
- * Returns: (transfer full): the child object or %NULL if not found (index
- * too high). Unref after usage.
+ * Returns: (transfer full) (nullable): the child object or %NULL if
+ * not found (index too high). Unref after usage.
*
* MT safe.
*/
diff --git a/gst/gstclock.c b/gst/gstclock.c
index 9f5b6fd..d413dff 100644
--- a/gst/gstclock.c
+++ b/gst/gstclock.c
@@ -1204,8 +1204,9 @@ not_supported:
* Get the master clock that @clock is slaved to or %NULL when the clock is
* not slaved to any master clock.
*
- * Returns: (transfer full): a master #GstClock or %NULL when this clock is
- * not slaved to a master clock. Unref after usage.
+ * Returns: (transfer full) (nullable): a master #GstClock or %NULL
+ * when this clock is not slaved to a master clock. Unref after
+ * usage.
*
* MT safe.
*/
diff --git a/gst/gstcontrolbinding.c b/gst/gstcontrolbinding.c
index 4981c89..9e02a47 100644
--- a/gst/gstcontrolbinding.c
+++ b/gst/gstcontrolbinding.c
@@ -259,8 +259,8 @@ gst_control_binding_sync_values (GstControlBinding * binding,
*
* Gets the value for the given controlled property at the requested time.
*
- * Returns: the GValue of the property at the given time, or %NULL if the
- * property isn't controlled.
+ * Returns: (nullable): the GValue of the property at the given time,
+ * or %NULL if the property isn't controlled.
*/
GValue *
gst_control_binding_get_value (GstControlBinding * binding,
diff --git a/gst/gstdatetime.c b/gst/gstdatetime.c
index d21cca4..8c0eda5 100644
--- a/gst/gstdatetime.c
+++ b/gst/gstdatetime.c
@@ -76,7 +76,8 @@ static void gst_date_time_free (GstDateTime * datetime);
*
* Free-function: gst_date_time_unref
*
- * Returns: (transfer full): a newly created #GstDateTime, or %NULL on error
+ * Returns: (transfer full) (nullable): a newly created #GstDateTime,
+ * or %NULL on error
*/
GstDateTime *
gst_date_time_new_from_g_date_time (GDateTime * dt)
@@ -104,7 +105,8 @@ gst_date_time_new_from_g_date_time (GDateTime * dt)
*
* Free-function: g_date_time_unref
*
- * Returns: (transfer full): a newly created #GDateTime, or %NULL on error
+ * Returns: (transfer full) (nullable): a newly created #GDateTime, or
+ * %NULL on error
*/
GDateTime *
gst_date_time_to_g_date_time (GstDateTime * datetime)
@@ -725,9 +727,10 @@ done:
* are (for example): 2012, 2012-06, 2012-06-23, 2012-06-23T23:30Z,
* 2012-06-23T23:30+0100, 2012-06-23T23:30:59Z, 2012-06-23T23:30:59+0100
*
- * Returns: a newly allocated string formatted according to ISO 8601 and
- * only including the datetime fields that are valid, or %NULL in case
- * there was an error. The string should be freed with g_free().
+ * Returns: (nullable): a newly allocated string formatted according
+ * to ISO 8601 and only including the datetime fields that are
+ * valid, or %NULL in case there was an error. The string should
+ * be freed with g_free().
*/
gchar *
gst_date_time_to_iso8601_string (GstDateTime * datetime)
@@ -749,7 +752,8 @@ gst_date_time_to_iso8601_string (GstDateTime * datetime)
*
* Free-function: gst_date_time_unref
*
- * Returns: (transfer full): a newly created #GstDateTime, or %NULL on error
+ * Returns: (transfer full) (nullable): a newly created #GstDateTime,
+ * or %NULL on error
*/
GstDateTime *
gst_date_time_new_from_iso8601_string (const gchar * string)
diff --git a/gst/gstdevice.c b/gst/gstdevice.c
index 9119ba9..08404bb 100644
--- a/gst/gstdevice.c
+++ b/gst/gstdevice.c
@@ -22,13 +22,13 @@
/**
* SECTION:gstdevice
* @short_description: Object representing a device
- * @see_also: #GstDeviceMonitor
+ * @see_also: #GstDeviceProvider
*
* #GstDevice are objects representing a device, they contain
* relevant metadata about the device, such as its class and the #GstCaps
* representing the media types it can produce or handle.
*
- * #GstDevice are created by #GstDeviceMonitor objects which can be
+ * #GstDevice are created by #GstDeviceProvider objects which can be
* aggregated by #GstGlobalDeviceMonitor objects.
*
* Since: 1.4
@@ -190,6 +190,8 @@ gst_device_create_element (GstDevice * device, const gchar * name)
{
GstDeviceClass *klass = GST_DEVICE_GET_CLASS (device);
+ g_return_val_if_fail (GST_IS_DEVICE (device), NULL);
+
if (klass->create_element)
return klass->create_element (device, name);
else
@@ -210,6 +212,8 @@ gst_device_create_element (GstDevice * device, const gchar * name)
GstCaps *
gst_device_get_caps (GstDevice * device)
{
+ g_return_val_if_fail (GST_IS_DEVICE (device), NULL);
+
if (device->priv->caps)
return gst_caps_ref (device->priv->caps);
else
@@ -229,6 +233,8 @@ gst_device_get_caps (GstDevice * device)
gchar *
gst_device_get_display_name (GstDevice * device)
{
+ g_return_val_if_fail (GST_IS_DEVICE (device), NULL);
+
return
g_strdup (device->priv->display_name ? device->priv->display_name : "");
}
@@ -239,7 +245,7 @@ gst_device_get_display_name (GstDevice * device)
*
* Gets the "class" of a device. This is a "/" separated list of
* classes that represent this device. They are a subset of the
- * classes of the #GstDeviceMonitor that produced this device.
+ * classes of the #GstDeviceProvider that produced this device.
*
* Returns: The device class. Free with g_free() after use.
*
@@ -248,6 +254,8 @@ gst_device_get_display_name (GstDevice * device)
gchar *
gst_device_get_device_class (GstDevice * device)
{
+ g_return_val_if_fail (GST_IS_DEVICE (device), NULL);
+
if (device->priv->device_class != NULL)
return g_strdup (device->priv->device_class);
else
@@ -276,6 +284,8 @@ gst_device_reconfigure_element (GstDevice * device, GstElement * element)
{
GstDeviceClass *klass = GST_DEVICE_GET_CLASS (device);
+ g_return_val_if_fail (GST_IS_DEVICE (device), FALSE);
+
if (klass->reconfigure_element)
return klass->reconfigure_element (device, element);
else
@@ -299,6 +309,8 @@ gst_device_has_classesv (GstDevice * device, gchar ** classes)
{
g_return_val_if_fail (GST_IS_DEVICE (device), FALSE);
+ if (!classes)
+ return TRUE;
for (; classes[0]; classes++) {
const gchar *found;
@@ -340,6 +352,11 @@ gst_device_has_classes (GstDevice * device, const gchar * classes)
gchar **classesv;
gboolean res;
+ g_return_val_if_fail (GST_IS_DEVICE (device), FALSE);
+
+ if (!classes)
+ return TRUE;
+
classesv = g_strsplit (classes, "/", 0);
res = gst_device_has_classesv (device, classesv);
diff --git a/gst/gstdevicemonitor.c b/gst/gstdevicemonitor.c
index 6fabe11..e193661 100644
--- a/gst/gstdevicemonitor.c
+++ b/gst/gstdevicemonitor.c
@@ -1,7 +1,7 @@
/* GStreamer
- * Copyright (C) 2012 Olivier Crete <olivier.crete@collabora.com>
+ * Copyright (C) 2013 Olivier Crete <olivier.crete@collabora.com>
*
- * gstdevicemonitor.c: Device probing and monitoring
+ * gstdevicemonitor.c: device monitor
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -22,321 +22,228 @@
/**
* SECTION:gstdevicemonitor
* @short_description: A device monitor and prober
- * @see_also: #GstDevice, #GstGlobalDeviceMonitor
- *
- * A #GstDeviceMonitor subclass is provided by a plugin that handles devices
- * if there is a way to programatically list connected devices. It can also
- * optionally provide updates to the list of connected devices.
- *
- * Each #GstDeviceMonitor subclass is a singleton, a plugin should
- * normally provide a single subclass for all devices.
- *
- * Applications would normally use a #GstGlobalDeviceMonitor to monitor devices
- * from all revelant monitors.
+ * @see_also: #GstDevice, #GstDeviceProvider
+ *
+ * Applications should create a #GstDeviceMonitor when they want
+ * to probe, list and monitor devices of a specific type. The
+ * #GstDeviceMonitor will create the appropriate
+ * #GstDeviceProvider objects and manage them. It will then post
+ * messages on its #GstBus for devices that have been added and
+ * removed.
+ *
+ * The device monitor will monitor all devices matching the filters that
+ * the application has set.
+ *
+ *
+ * The basic use pattern of a device monitor is as follows:
+ * |[
+ * static gboolean
+ * my_bus_func (GstBus * bus, GstMessage * message, gpointer user_data)
+ * {
+ * GstDevice *device;
+ * gchar name;
+ *
+ * switch (GST_MESSAGE_TYPE (message)) {
+ * case GST_MESSAGE_DEVICE_ADDED:
+ * gst_message_parse_device_added (message, &device);
+ * name = gst_device_get_display_name (device);
+ * g_print("Device added: %s\n", name);
+ * g_free (name);
+ * break;
+ * case GST_MESSAGE_DEVICE_REMOVED:
+ * gst_message_parse_device_removed (message, &device);
+ * name = gst_device_get_display_name (device);
+ * g_print("Device removed: %s\n", name);
+ * g_free (name);
+ * break;
+ * default:
+ * break;
+ * }
+ *
+ * return G_SOURCE_CONTINUE;
+ * }
+ *
+ * GstDeviceMonitor *
+ * setup_raw_video_source_device_monitor (void) {
+ * GstDeviceMonitor *monitor;
+ * GstBus *bus;
+ * GstCaps *caps;
+ *
+ * monitor = gst_device_monitor_new ();
+ *
+ * bus = gst_device_monitor_get_bus (monitor);
+ * gst_bus_add_watch (bus, my_bus_func, NULL);
+ * gst_object_unref (bus);
+ *
+ * caps = gst_caps_new_simple_empty ("video/x-raw");
+ * gst_device_monitor_add_filter (monitor, "Video/Source", caps);
+ * gst_caps_unref (caps);
+ *
+ * gst_device_monitor_start (monitor);
+ *
+ * return monitor;
+ * }
+ * ]|
*
* Since: 1.4
*/
+
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "gst_private.h"
-
#include "gstdevicemonitor.h"
-#include "gstelementmetadata.h"
-#include "gstquark.h"
-
struct _GstDeviceMonitorPrivate
{
+ gboolean started;
+
GstBus *bus;
- GMutex start_lock;
+ GPtrArray *providers;
+ guint cookie;
- gboolean started_count;
-};
+ GPtrArray *filters;
-/* this is used in gstelementfactory.c:gst_element_register() */
-GQuark __gst_devicemonitorclass_factory = 0;
+ guint last_id;
+};
-static void gst_device_monitor_class_init (GstDeviceMonitorClass * klass);
-static void gst_device_monitor_init (GstDeviceMonitor * element);
-static void gst_device_monitor_base_class_init (gpointer g_class);
-static void gst_device_monitor_base_class_finalize (gpointer g_class);
-static void gst_device_monitor_dispose (GObject * object);
-static void gst_device_monitor_finalize (GObject * object);
-static gpointer gst_device_monitor_parent_class = NULL;
+G_DEFINE_TYPE (GstDeviceMonitor, gst_device_monitor, GST_TYPE_OBJECT);
-GType
-gst_device_monitor_get_type (void)
-{
- static volatile gsize gst_device_monitor_type = 0;
-
- if (g_once_init_enter (&gst_device_monitor_type)) {
- GType _type;
- static const GTypeInfo element_info = {
- sizeof (GstDeviceMonitorClass),
- gst_device_monitor_base_class_init,
- gst_device_monitor_base_class_finalize,
- (GClassInitFunc) gst_device_monitor_class_init,
- NULL,
- NULL,
- sizeof (GstDeviceMonitor),
- 0,
- (GInstanceInitFunc) gst_device_monitor_init,
- NULL
- };
-
- _type = g_type_register_static (GST_TYPE_OBJECT, "GstDeviceMonitor",
- &element_info, G_TYPE_FLAG_ABSTRACT);
-
- __gst_devicemonitorclass_factory =
- g_quark_from_static_string ("GST_DEVICEMONITORCLASS_FACTORY");
- g_once_init_leave (&gst_device_monitor_type, _type);
- }
- return gst_device_monitor_type;
-}
+static void gst_device_monitor_dispose (GObject * object);
-static void
-gst_device_monitor_base_class_init (gpointer g_class)
+struct DeviceFilter
{
- GstDeviceMonitorClass *klass = GST_DEVICE_MONITOR_CLASS (g_class);
+ guint id;
- /* Copy the element details here so elements can inherit the
- * details from their base class and classes only need to set
- * the details in class_init instead of base_init */
- klass->metadata =
- klass->metadata ? gst_structure_copy (klass->metadata) :
- gst_structure_new_empty ("metadata");
-
- klass->factory = g_type_get_qdata (G_TYPE_FROM_CLASS (klass),
- __gst_devicemonitorclass_factory);
-}
+ gchar **classesv;
+ GstCaps *caps;
+};
static void
-gst_device_monitor_base_class_finalize (gpointer g_class)
+device_filter_free (struct DeviceFilter *filter)
{
- GstDeviceMonitorClass *klass = GST_DEVICE_MONITOR_CLASS (g_class);
+ g_strfreev (filter->classesv);
+ gst_caps_unref (filter->caps);
- gst_structure_free (klass->metadata);
+ g_slice_free (struct DeviceFilter, filter);
}
static void
gst_device_monitor_class_init (GstDeviceMonitorClass * klass)
{
- GObjectClass *gobject_class = (GObjectClass *) klass;
-
- gst_device_monitor_parent_class = g_type_class_peek_parent (klass);
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
g_type_class_add_private (klass, sizeof (GstDeviceMonitorPrivate));
- gobject_class->dispose = gst_device_monitor_dispose;
- gobject_class->finalize = gst_device_monitor_finalize;
+ object_class->dispose = gst_device_monitor_dispose;
}
static void
-gst_device_monitor_init (GstDeviceMonitor * monitor)
+bus_sync_message (GstBus * bus, GstMessage * message,
+ GstDeviceMonitor * monitor)
{
- monitor->priv = G_TYPE_INSTANCE_GET_PRIVATE (monitor,
- GST_TYPE_DEVICE_MONITOR, GstDeviceMonitorPrivate);
-
- g_mutex_init (&monitor->priv->start_lock);
+ GstMessageType type = GST_MESSAGE_TYPE (message);
- monitor->priv->bus = gst_bus_new ();
- gst_bus_set_flushing (monitor->priv->bus, TRUE);
-}
+ if (type == GST_MESSAGE_DEVICE_ADDED || type == GST_MESSAGE_DEVICE_REMOVED) {
+ gboolean matches;
+ GstDevice *device;
+ if (type == GST_MESSAGE_DEVICE_ADDED)
+ gst_message_parse_device_added (message, &device);
+ else
+ gst_message_parse_device_removed (message, &device);
-static void
-gst_device_monitor_dispose (GObject * object)
-{
- GstDeviceMonitor *monitor = GST_DEVICE_MONITOR (object);
-
- gst_object_replace ((GstObject **) & monitor->priv->bus, NULL);
+ GST_OBJECT_LOCK (monitor);
+ if (monitor->priv->filters->len) {
+ guint i;
+
+ for (i = 0; i < monitor->priv->filters->len; i++) {
+ struct DeviceFilter *filter =
+ g_ptr_array_index (monitor->priv->filters, i);
+ GstCaps *caps;
+
+ caps = gst_device_get_caps (device);
+ matches = gst_caps_can_intersect (filter->caps, caps) &&
+ gst_device_has_classesv (device, filter->classesv);
+ gst_caps_unref (caps);
+ if (matches)
+ break;
+ }
+ } else {
+ matches = TRUE;
+ }
+ GST_OBJECT_UNLOCK (monitor);
- GST_OBJECT_LOCK (monitor);
- g_list_free_full (monitor->devices, (GDestroyNotify) gst_object_unparent);
- monitor->devices = NULL;
- GST_OBJECT_UNLOCK (monitor);
+ gst_object_unref (device);
- G_OBJECT_CLASS (gst_device_monitor_parent_class)->dispose (object);
+ if (matches)
+ gst_bus_post (monitor->priv->bus, gst_message_ref (message));
+ }
}
+
static void
-gst_device_monitor_finalize (GObject * object)
+gst_device_monitor_init (GstDeviceMonitor * self)
{
- GstDeviceMonitor *monitor = GST_DEVICE_MONITOR (object);
-
- g_mutex_clear (&monitor->priv->start_lock);
+ self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
+ GST_TYPE_DEVICE_MONITOR, GstDeviceMonitorPrivate);
- G_OBJECT_CLASS (gst_device_monitor_parent_class)->finalize (object);
-}
+ self->priv->bus = gst_bus_new ();
+ gst_bus_set_flushing (self->priv->bus, TRUE);
-/**
- * gst_device_monitor_class_add_metadata:
- * @klass: class to set metadata for
- * @key: the key to set
- * @value: the value to set
- *
- * Set @key with @value as metadata in @klass.
- */
-void
-gst_device_monitor_class_add_metadata (GstDeviceMonitorClass * klass,
- const gchar * key, const gchar * value)
-{
- g_return_if_fail (GST_IS_DEVICE_MONITOR_CLASS (klass));
- g_return_if_fail (key != NULL);
- g_return_if_fail (value != NULL);
+ self->priv->providers = g_ptr_array_new ();
+ self->priv->filters = g_ptr_array_new_with_free_func (
+ (GDestroyNotify) device_filter_free);
- gst_structure_set ((GstStructure *) klass->metadata,
- key, G_TYPE_STRING, value, NULL);
+ self->priv->last_id = 1;
}
-/**
- * gst_device_monitor_class_add_static_metadata:
- * @klass: class to set metadata for
- * @key: the key to set
- * @value: the value to set
- *
- * Set @key with @value as metadata in @klass.
- *
- * Same as gst_device_monitor_class_add_metadata(), but @value must be a static string
- * or an inlined string, as it will not be copied. (GStreamer plugins will
- * be made resident once loaded, so this function can be used even from
- * dynamically loaded plugins.)
- *
- * Since: 1.4
- */
-void
-gst_device_monitor_class_add_static_metadata (GstDeviceMonitorClass * klass,
- const gchar * key, const gchar * value)
+
+static void
+gst_device_monitor_remove (GstDeviceMonitor * self, guint i)
{
- GValue val = G_VALUE_INIT;
+ GstDeviceProvider *provider = g_ptr_array_index (self->priv->providers, i);
+ GstBus *bus;
- g_return_if_fail (GST_IS_DEVICE_MONITOR_CLASS (klass));
- g_return_if_fail (key != NULL);
- g_return_if_fail (value != NULL);
+ g_ptr_array_remove_index_fast (self->priv->providers, i);
- g_value_init (&val, G_TYPE_STRING);
- g_value_set_static_string (&val, value);
- gst_structure_take_value ((GstStructure *) klass->metadata, key, &val);
-}
+ bus = gst_device_provider_get_bus (provider);
+ g_signal_handlers_disconnect_by_func (bus, bus_sync_message, self);
+ gst_object_unref (bus);
-/**
- * gst_device_monitor_class_set_metadata:
- * @klass: class to set metadata for
- * @longname: The long English name of the device monitor. E.g. "File Sink"
- * @classification: String describing the type of device monitor, as an unordered list
- * separated with slashes ('/'). See draft-klass.txt of the design docs
- * for more details and common types. E.g: "Sink/File"
- * @description: Sentence describing the purpose of the device monitor.
- * E.g: "Write stream to a file"
- * @author: Name and contact details of the author(s). Use \n to separate
- * multiple author metadata. E.g: "Joe Bloggs &lt;joe.blogs at foo.com&gt;"
- *
- * Sets the detailed information for a #GstDeviceMonitorClass.
- * <note>This function is for use in _class_init functions only.</note>
- *
- * Since: 1.4
- */
-void
-gst_device_monitor_class_set_metadata (GstDeviceMonitorClass * klass,
- const gchar * longname, const gchar * classification,
- const gchar * description, const gchar * author)
-{
- g_return_if_fail (GST_IS_DEVICE_MONITOR_CLASS (klass));
- g_return_if_fail (longname != NULL && *longname != '\0');
- g_return_if_fail (classification != NULL && *classification != '\0');
- g_return_if_fail (description != NULL && *description != '\0');
- g_return_if_fail (author != NULL && *author != '\0');
-
- gst_structure_id_set ((GstStructure *) klass->metadata,
- GST_QUARK (ELEMENT_METADATA_LONGNAME), G_TYPE_STRING, longname,
- GST_QUARK (ELEMENT_METADATA_KLASS), G_TYPE_STRING, classification,
- GST_QUARK (ELEMENT_METADATA_DESCRIPTION), G_TYPE_STRING, description,
- GST_QUARK (ELEMENT_METADATA_AUTHOR), G_TYPE_STRING, author, NULL);
+ gst_object_unref (provider);
}
-/**
- * gst_device_monitor_class_set_static_metadata:
- * @klass: class to set metadata for
- * @longname: The long English name of the element. E.g. "File Sink"
- * @classification: String describing the type of element, as an unordered list
- * separated with slashes ('/'). See draft-klass.txt of the design docs
- * for more details and common types. E.g: "Sink/File"
- * @description: Sentence describing the purpose of the element.
- * E.g: "Write stream to a file"
- * @author: Name and contact details of the author(s). Use \n to separate
- * multiple author metadata. E.g: "Joe Bloggs &lt;joe.blogs at foo.com&gt;"
- *
- * Sets the detailed information for a #GstDeviceMonitorClass.
- * <note>This function is for use in _class_init functions only.</note>
- *
- * Same as gst_device_monitor_class_set_metadata(), but @longname, @classification,
- * @description, and @author must be static strings or inlined strings, as
- * they will not be copied. (GStreamer plugins will be made resident once
- * loaded, so this function can be used even from dynamically loaded plugins.)
- *
- * Since: 1.4
- */
-void
-gst_device_monitor_class_set_static_metadata (GstDeviceMonitorClass * klass,
- const gchar * longname, const gchar * classification,
- const gchar * description, const gchar * author)
+static void
+gst_device_monitor_dispose (GObject * object)
{
- GstStructure *s = (GstStructure *) klass->metadata;
- GValue val = G_VALUE_INIT;
+ GstDeviceMonitor *self = GST_DEVICE_MONITOR (object);
- g_return_if_fail (GST_IS_DEVICE_MONITOR_CLASS (klass));
- g_return_if_fail (longname != NULL && *longname != '\0');
- g_return_if_fail (classification != NULL && *classification != '\0');
- g_return_if_fail (description != NULL && *description != '\0');
- g_return_if_fail (author != NULL && *author != '\0');
+ g_return_if_fail (self->priv->started == FALSE);
- g_value_init (&val, G_TYPE_STRING);
-
- g_value_set_static_string (&val, longname);
- gst_structure_id_set_value (s, GST_QUARK (ELEMENT_METADATA_LONGNAME), &val);
-
- g_value_set_static_string (&val, classification);
- gst_structure_id_set_value (s, GST_QUARK (ELEMENT_METADATA_KLASS), &val);
-
- g_value_set_static_string (&val, description);
- gst_structure_id_set_value (s, GST_QUARK (ELEMENT_METADATA_DESCRIPTION),
- &val);
+ if (self->priv->providers) {
+ while (self->priv->providers->len)
+ gst_device_monitor_remove (self, self->priv->providers->len - 1);
+ g_ptr_array_unref (self->priv->providers);
+ self->priv->providers = NULL;
+ }
- g_value_set_static_string (&val, author);
- gst_structure_id_take_value (s, GST_QUARK (ELEMENT_METADATA_AUTHOR), &val);
-}
+ g_clear_pointer (&self->priv->filters, (GDestroyNotify) g_ptr_array_unref);
-/**
- * gst_device_monitor_class_get_metadata:
- * @klass: class to get metadata for
- * @key: the key to get
- *
- * Get metadata with @key in @klass.
- *
- * Returns: the metadata for @key.
- *
- * Since: 1.4
- */
-const gchar *
-gst_device_monitor_class_get_metadata (GstDeviceMonitorClass * klass,
- const gchar * key)
-{
- g_return_val_if_fail (GST_IS_DEVICE_MONITOR_CLASS (klass), NULL);
- g_return_val_if_fail (key != NULL, NULL);
+ gst_object_replace ((GstObject **) & self->priv->bus, NULL);
- return gst_structure_get_string ((GstStructure *) klass->metadata, key);
+ G_OBJECT_CLASS (gst_device_monitor_parent_class)->dispose (object);
}
/**
* gst_device_monitor_get_devices:
- * @monitor: A #GstDeviceMonitor
+ * @monitor: A #GstDeviceProvider
*
- * Gets a list of devices that this monitor understands. This may actually
+ * Gets a list of devices from all of the relevant monitors. This may actually
* probe the hardware if the monitor is not currently started.
*
* Returns: (transfer full) (element-type GstDevice): a #GList of
@@ -348,26 +255,71 @@ gst_device_monitor_class_get_metadata (GstDeviceMonitorClass * klass,
GList *
gst_device_monitor_get_devices (GstDeviceMonitor * monitor)
{
- GstDeviceMonitorClass *klass;
GList *devices = NULL;
- gboolean started;
- GList *item;
+ guint i;
+ guint cookie;
g_return_val_if_fail (GST_IS_DEVICE_MONITOR (monitor), NULL);
- klass = GST_DEVICE_MONITOR_GET_CLASS (monitor);
- g_mutex_lock (&monitor->priv->start_lock);
- started = (monitor->priv->started_count > 0);
+ GST_OBJECT_LOCK (monitor);
+
+ if (monitor->priv->filters->len == 0) {
+ GST_OBJECT_UNLOCK (monitor);
+ GST_WARNING_OBJECT (monitor, "No filters have been set");
+ return FALSE;
+ }
+
+ if (monitor->priv->providers->len == 0) {
+ GST_OBJECT_UNLOCK (monitor);
+ GST_WARNING_OBJECT (monitor, "No providers match the current filters");
+ return FALSE;
+ }
+
+again:
+
+ g_list_free_full (devices, gst_object_unref);
+ devices = NULL;
+
+ cookie = monitor->priv->cookie;
+
+ for (i = 0; i < monitor->priv->providers->len; i++) {
+ GList *tmpdev;
+ GstDeviceProvider *provider =
+ gst_object_ref (g_ptr_array_index (monitor->priv->providers, i));
+ GList *item;
- if (started) {
- GST_OBJECT_LOCK (monitor);
- for (item = monitor->devices; item; item = item->next)
- devices = g_list_prepend (devices, gst_object_ref (item->data));
GST_OBJECT_UNLOCK (monitor);
- } else if (klass->probe)
- devices = klass->probe (monitor);
- g_mutex_unlock (&monitor->priv->start_lock);
+ tmpdev = gst_device_provider_get_devices (provider);
+
+ GST_OBJECT_LOCK (monitor);
+
+ for (item = tmpdev; item; item = item->next) {
+ GstDevice *dev = GST_DEVICE (item->data);
+ GstCaps *caps = gst_device_get_caps (dev);
+ guint j;
+
+ for (j = 0; j < monitor->priv->filters->len; j++) {
+ struct DeviceFilter *filter =
+ g_ptr_array_index (monitor->priv->filters, j);
+ if (gst_caps_can_intersect (filter->caps, caps) &&
+ gst_device_has_classesv (dev, filter->classesv)) {
+ devices = g_list_prepend (devices, gst_object_ref (dev));
+ break;
+ }
+ }
+ gst_caps_unref (caps);
+ }
+
+ g_list_free_full (tmpdev, gst_object_unref);
+ gst_object_unref (provider);
+
+
+ if (monitor->priv->cookie != cookie)
+ goto again;
+ }
+
+ GST_OBJECT_UNLOCK (monitor);
return devices;
}
@@ -376,14 +328,9 @@ gst_device_monitor_get_devices (GstDeviceMonitor * monitor)
* gst_device_monitor_start:
* @monitor: A #GstDeviceMonitor
*
- * Starts monitoring the devices. This will cause #GST_MESSAGE_DEVICE messages
- * to be posted on the monitor's bus when devices are added or removed from
- * the system.
- *
- * Since the #GstDeviceMonitor is a singleton,
- * gst_device_monitor_start() may already have been called by another
- * user of the object, gst_device_monitor_stop() needs to be called the same
- * number of times.
+ * Starts monitoring the devices, one this has succeeded, the
+ * %GST_MESSAGE_DEVICE_ADDED and %GST_MESSAGE_DEVICE_REMOVED messages
+ * will be emitted on the bus when the list of devices changes.
*
* Returns: %TRUE if the device monitoring could be started
*
@@ -393,195 +340,273 @@ gst_device_monitor_get_devices (GstDeviceMonitor * monitor)
gboolean
gst_device_monitor_start (GstDeviceMonitor * monitor)
{
- GstDeviceMonitorClass *klass;
- gboolean ret = FALSE;
+ guint i;
g_return_val_if_fail (GST_IS_DEVICE_MONITOR (monitor), FALSE);
- klass = GST_DEVICE_MONITOR_GET_CLASS (monitor);
- g_mutex_lock (&monitor->priv->start_lock);
+ GST_OBJECT_LOCK (monitor);
- if (monitor->priv->started_count > 0) {
- ret = TRUE;
- goto started;
+ if (monitor->priv->filters->len == 0) {
+ GST_OBJECT_UNLOCK (monitor);
+ GST_WARNING_OBJECT (monitor, "No filters have been set, will expose all "
+ "devices found");
+ gst_device_monitor_add_filter (monitor, NULL, NULL);
+ GST_OBJECT_LOCK (monitor);
}
- if (klass->start)
- ret = klass->start (monitor);
-
- if (ret) {
- monitor->priv->started_count++;
- gst_bus_set_flushing (monitor->priv->bus, FALSE);
+ if (monitor->priv->providers->len == 0) {
+ GST_OBJECT_UNLOCK (monitor);
+ GST_WARNING_OBJECT (monitor, "No providers match the current filters");
+ return FALSE;
}
-started:
+ gst_bus_set_flushing (monitor->priv->bus, FALSE);
- g_mutex_unlock (&monitor->priv->start_lock);
+ for (i = 0; i < monitor->priv->providers->len; i++) {
+ GstDeviceProvider *provider =
+ g_ptr_array_index (monitor->priv->providers, i);
- return ret;
+ if (gst_device_provider_can_monitor (provider)) {
+ if (!gst_device_provider_start (provider)) {
+ gst_bus_set_flushing (monitor->priv->bus, TRUE);
+
+ for (; i != 0; i--)
+ gst_device_provider_stop (g_ptr_array_index (monitor->priv->providers,
+ i - 1));
+
+ GST_OBJECT_UNLOCK (monitor);
+ return FALSE;
+ }
+ }
+ }
+
+ monitor->priv->started = TRUE;
+ GST_OBJECT_UNLOCK (monitor);
+
+ return TRUE;
}
/**
* gst_device_monitor_stop:
- * @monitor: A #GstDeviceMonitor
+ * @monitor: A #GstDeviceProvider
*
- * Decreases the use-count by one. If the use count reaches zero, this
- * #GstDeviceMonitor will stop monitoring the devices. This needs to be
- * called the same number of times that gst_device_monitor_start() was called.
+ * Stops monitoring the devices.
*
* Since: 1.4
*/
-
void
gst_device_monitor_stop (GstDeviceMonitor * monitor)
{
- GstDeviceMonitorClass *klass;
+ guint i;
g_return_if_fail (GST_IS_DEVICE_MONITOR (monitor));
- klass = GST_DEVICE_MONITOR_GET_CLASS (monitor);
- g_mutex_lock (&monitor->priv->start_lock);
+ gst_bus_set_flushing (monitor->priv->bus, TRUE);
- if (monitor->priv->started_count == 1) {
- gst_bus_set_flushing (monitor->priv->bus, TRUE);
- if (klass->stop)
- klass->stop (monitor);
- GST_OBJECT_LOCK (monitor);
- g_list_free_full (monitor->devices, (GDestroyNotify) gst_object_unparent);
- monitor->devices = NULL;
- GST_OBJECT_UNLOCK (monitor);
- } else if (monitor->priv->started_count < 1) {
- g_critical ("Trying to stop a GstDeviceMonitor %s which is already stopped",
- GST_OBJECT_NAME (monitor));
+ GST_OBJECT_LOCK (monitor);
+ for (i = 0; i < monitor->priv->providers->len; i++) {
+ GstDeviceProvider *provider =
+ g_ptr_array_index (monitor->priv->providers, i);
+
+ if (gst_device_provider_can_monitor (provider))
+ gst_device_provider_stop (provider);
}
+ monitor->priv->started = FALSE;
+ GST_OBJECT_UNLOCK (monitor);
- monitor->priv->started_count--;
- g_mutex_unlock (&monitor->priv->start_lock);
}
-
/**
- * gst_device_monitor_get_factory:
- * @monitor: a #GstDeviceMonitor to request the device monitor factory of.
+ * gst_device_monitor_add_filter:
+ * @monitor: a device monitor
+ * @classes: device classes to use as filter or %NULL for any class
+ * @caps: (allow-none): the #GstCaps to filter or %NULL for ANY
*
- * Retrieves the factory that was used to create this device monitor.
+ * Adds a filter for which #GstDevice will be monitored, any device that matches
+ * all classes and the #GstCaps will be returned.
*
- * Returns: (transfer none): the #GstDeviceMonitorFactory used for creating this
- * device monitor. no refcounting is needed.
+ * Filters must be added before the #GstDeviceMonitor is started.
+ *
+ * Returns: The id of the new filter or %0 if no provider matched the filter's
+ * classes.
*
* Since: 1.4
*/
-GstDeviceMonitorFactory *
-gst_device_monitor_get_factory (GstDeviceMonitor * monitor)
+guint
+gst_device_monitor_add_filter (GstDeviceMonitor * monitor,
+ const gchar * classes, GstCaps * caps)
{
- g_return_val_if_fail (GST_IS_DEVICE_MONITOR (monitor), NULL);
-
- return GST_DEVICE_MONITOR_GET_CLASS (monitor)->factory;
-}
+ GList *factories = NULL;
+ struct DeviceFilter *filter;
+ guint id = 0;
+ gboolean matched = FALSE;
-/**
- * gst_device_monitor_can_monitor:
- * @monitor: a #GstDeviceMonitor
- *
- * If this function returns %TRUE, then the device monitor can monitor if
- * devices are added or removed. Otherwise, it can only do static probing.
- *
- * Returns: %TRUE if the #GstDeviceMonitor support monitoring, %FALSE otherwise
- */
-gboolean
-gst_device_monitor_can_monitor (GstDeviceMonitor * monitor)
-{
- GstDeviceMonitorClass *klass;
+ g_return_val_if_fail (GST_IS_DEVICE_MONITOR (monitor), 0);
+ g_return_val_if_fail (!monitor->priv->started, 0);
- g_return_val_if_fail (GST_IS_DEVICE_MONITOR (monitor), FALSE);
- klass = GST_DEVICE_MONITOR_GET_CLASS (monitor);
+ GST_OBJECT_LOCK (monitor);
- if (klass->start)
- return TRUE;
+ filter = g_slice_new0 (struct DeviceFilter);
+ filter->id = monitor->priv->last_id++;
+ if (caps)
+ filter->caps = gst_caps_ref (caps);
else
- return FALSE;
+ filter->caps = gst_caps_new_any ();
+ if (classes)
+ filter->classesv = g_strsplit (classes, "/", 0);
+
+ factories = gst_device_provider_factory_list_get_device_providers (1);
+
+ while (factories) {
+ GstDeviceProviderFactory *factory = factories->data;
+
+
+ if (gst_device_provider_factory_has_classesv (factory, filter->classesv)) {
+ GstDeviceProvider *provider;
+
+ provider = gst_device_provider_factory_get (factory);
+
+ if (provider) {
+ guint i;
+
+ for (i = 0; i < monitor->priv->providers->len; i++) {
+ if (g_ptr_array_index (monitor->priv->providers, i) == provider) {
+ gst_object_unref (provider);
+ provider = NULL;
+ matched = TRUE;
+ break;
+ }
+ }
+ }
+
+ if (provider) {
+ GstBus *bus = gst_device_provider_get_bus (provider);
+
+ matched = TRUE;
+ gst_bus_enable_sync_message_emission (bus);
+ g_signal_connect (bus, "sync-message",
+ G_CALLBACK (bus_sync_message), monitor);
+ gst_object_unref (bus);
+ g_ptr_array_add (monitor->priv->providers, provider);
+ monitor->priv->cookie++;
+ }
+ }
+
+ factories = g_list_remove (factories, factory);
+ gst_object_unref (factory);
+ }
+
+ /* Ensure there is no leak here */
+ g_assert (factories == NULL);
+
+ if (matched) {
+ id = filter->id;
+ g_ptr_array_add (monitor->priv->filters, filter);
+ } else {
+ device_filter_free (filter);
+ }
+
+ GST_OBJECT_UNLOCK (monitor);
+
+ return id;
}
/**
- * gst_device_monitor_get_bus:
- * @monitor: a #GstDeviceMonitor
+ * gst_device_monitor_remove_filter:
+ * @monitor: a device monitor
+ * @filter_id: the id of the filter
*
- * Gets the #GstBus of this #GstDeviceMonitor
+ * Removes a filter from the #GstDeviceMonitor using the id that was returned
+ * by gst_device_monitor_add_filter().
*
- * Returns: (transfer full): a #GstBus
+ * Returns: %TRUE of the filter id was valid, %FALSE otherwise
*
* Since: 1.4
*/
-GstBus *
-gst_device_monitor_get_bus (GstDeviceMonitor * monitor)
+gboolean
+gst_device_monitor_remove_filter (GstDeviceMonitor * monitor, guint filter_id)
{
- g_return_val_if_fail (GST_IS_DEVICE_MONITOR (monitor), NULL);
+ guint i, j;
+ gboolean removed = FALSE;
- return gst_object_ref (monitor->priv->bus);
+ g_return_val_if_fail (GST_IS_DEVICE_MONITOR (monitor), FALSE);
+ g_return_val_if_fail (!monitor->priv->started, FALSE);
+ g_return_val_if_fail (filter_id > 0, FALSE);
+
+ GST_OBJECT_LOCK (monitor);
+ for (i = 0; i < monitor->priv->filters->len; i++) {
+ struct DeviceFilter *filter = g_ptr_array_index (monitor->priv->filters, i);
+
+ if (filter->id == filter_id) {
+ g_ptr_array_remove_index (monitor->priv->filters, i);
+ removed = TRUE;
+ break;
+ }
+ }
+
+ if (removed) {
+ for (i = 0; i < monitor->priv->providers->len; i++) {
+ GstDeviceProvider *provider =
+ g_ptr_array_index (monitor->priv->providers, i);
+ GstDeviceProviderFactory *factory =
+ gst_device_provider_get_factory (provider);
+ gboolean valid = FALSE;
+
+ for (j = 0; j < monitor->priv->filters->len; j++) {
+ struct DeviceFilter *filter =
+ g_ptr_array_index (monitor->priv->filters, j);
+
+ if (gst_device_provider_factory_has_classesv (factory,
+ filter->classesv)) {
+ valid = TRUE;
+ break;
+ }
+ }
+
+ if (!valid) {
+ monitor->priv->cookie++;
+ gst_device_monitor_remove (monitor, i);
+ i--;
+ }
+ }
+ }
+
+ GST_OBJECT_UNLOCK (monitor);
+
+ return removed;
}
+
+
/**
- * gst_device_monitor_device_add:
- * @monitor: a #GstDeviceMonitor
- * @device: (transfer full): a #GstDevice that has been added
+ * gst_device_monitor_new:
*
- * Posts a message on the monitor's #GstBus to inform applications that
- * a new device has been added.
+ * Create a new #GstDeviceMonitor
*
- * This is for use by subclasses.
+ * Returns: (transfer full): a new device monitor.
*
* Since: 1.4
*/
-void
-gst_device_monitor_device_add (GstDeviceMonitor * monitor, GstDevice * device)
+GstDeviceMonitor *
+gst_device_monitor_new (void)
{
- GstMessage *message;
-
- if (!gst_object_set_parent (GST_OBJECT (device), GST_OBJECT (monitor))) {
- GST_WARNING_OBJECT (monitor, "Could not parent device %p to monitor,"
- " it already has a parent", device);
- return;
- }
-
- GST_OBJECT_LOCK (monitor);
- monitor->devices = g_list_prepend (monitor->devices, gst_object_ref (device));
- GST_OBJECT_UNLOCK (monitor);
-
- message = gst_message_new_device_added (GST_OBJECT (monitor), device);
- gst_bus_post (monitor->priv->bus, message);
- gst_object_unref (device);
+ return g_object_new (GST_TYPE_DEVICE_MONITOR, NULL);
}
-
/**
- * gst_device_monitor_device_remove:
- * @monitor: a #GstDeviceMonitor
- * @device: a #GstDevice that has been removed
+ * gst_device_monitor_get_bus:
+ * @monitor: a #GstDeviceProvider
*
- * Posts a message on the monitor's #GstBus to inform applications that
- * a device has been removed.
+ * Gets the #GstBus of this #GstDeviceMonitor
*
- * This is for use by subclasses.
+ * Returns: (transfer full): a #GstBus
*
* Since: 1.4
*/
-void
-gst_device_monitor_device_remove (GstDeviceMonitor * monitor,
- GstDevice * device)
+GstBus *
+gst_device_monitor_get_bus (GstDeviceMonitor * monitor)
{
- GstMessage *message;
- GList *item;
-
- GST_OBJECT_LOCK (monitor);
- item = g_list_find (monitor->devices, device);
- if (item) {
- monitor->devices = g_list_delete_link (monitor->devices, item);
- }
- GST_OBJECT_UNLOCK (monitor);
+ g_return_val_if_fail (GST_IS_DEVICE_MONITOR (monitor), NULL);
- message = gst_message_new_device_removed (GST_OBJECT (monitor), device);
- g_signal_emit_by_name (device, "removed");
- gst_bus_post (monitor->priv->bus, message);
- if (item)
- gst_object_unparent (GST_OBJECT (device));
+ return gst_object_ref (monitor->priv->bus);
}
diff --git a/gst/gstdevicemonitor.h b/gst/gstdevicemonitor.h
index f5c3307..2df07e4 100644
--- a/gst/gstdevicemonitor.h
+++ b/gst/gstdevicemonitor.h
@@ -1,7 +1,7 @@
/* GStreamer
- * Copyright (C) 2012 Olivier Crete <olivier.crete@collabora.com>
+ * Copyright (C) 2013 Olivier Crete <olivier.crete@collabora.com>
*
- * gstdevicemonitor.h: Device probing and monitoring
+ * gstdevicemonitor.c: Device monitor
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -19,19 +19,20 @@
* Boston, MA 02111-1307, USA.
*/
-#include <gst/gstdevicemonitorfactory.h>
-
#ifndef __GST_DEVICE_MONITOR_H__
#define __GST_DEVICE_MONITOR_H__
-#include <gst/gstelement.h>
+#include <gst/gstobject.h>
+#include <gst/gstdevice.h>
+#include <gst/gstdeviceprovider.h>
+#include <gst/gstdeviceproviderfactory.h>
G_BEGIN_DECLS
typedef struct _GstDeviceMonitor GstDeviceMonitor;
-typedef struct _GstDeviceMonitorClass GstDeviceMonitorClass;
typedef struct _GstDeviceMonitorPrivate GstDeviceMonitorPrivate;
+typedef struct _GstDeviceMonitorClass GstDeviceMonitorClass;
#define GST_TYPE_DEVICE_MONITOR (gst_device_monitor_get_type())
#define GST_IS_DEVICE_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_DEVICE_MONITOR))
@@ -41,21 +42,16 @@ typedef struct _GstDeviceMonitorPrivate GstDeviceMonitorPrivate;
#define GST_DEVICE_MONITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_DEVICE_MONITOR, GstDeviceMonitorClass))
#define GST_DEVICE_MONITOR_CAST(obj) ((GstDeviceMonitor *)(obj))
-
/**
* GstDeviceMonitor:
- * @parent: The parent #GstObject
- * @devices: a #GList of the #GstDevice objects
+ * @parent: the parent #GstObject structure
*
- * The structure of the base #GstDeviceMonitor
+ * Opaque device monitor object structure.
*
* Since: 1.4
*/
struct _GstDeviceMonitor {
- GstObject parent;
-
- /* Protected by the Object lock */
- GList *devices;
+ GstObject parent;
/*< private >*/
@@ -67,75 +63,37 @@ struct _GstDeviceMonitor {
/**
* GstDeviceMonitorClass:
* @parent_class: the parent #GstObjectClass structure
- * @factory: a pointer to the #GstDeviceMonitorFactory that creates this
- * monitor
- * @probe: Returns a list of devices that are currently available.
- * This should never block.
- * @start: Starts monitoring for new devices. Only subclasses that can know
- * that devices have been added or remove need to implement this method.
- * @stop: Stops monitoring for new devices. Only subclasses that implement
- * the start() method need to implement this method.
*
- * The structure of the base #GstDeviceMonitorClass
+ * Opaque device monitor class structure.
*
* Since: 1.4
*/
-
struct _GstDeviceMonitorClass {
- GstObjectClass parent_class;
-
- GstDeviceMonitorFactory *factory;
-
- GList* (*probe) (GstDeviceMonitor * monitor);
-
- gboolean (*start) (GstDeviceMonitor * monitor);
- void (*stop) (GstDeviceMonitor * monitor);
-
- /*< private >*/
- gpointer metadata;
+ GstObjectClass parent_class;
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
-GType gst_device_monitor_get_type (void);
-
+GType gst_device_monitor_get_type (void);
-GList * gst_device_monitor_get_devices (GstDeviceMonitor * monitor);
+GstDeviceMonitor * gst_device_monitor_new (void);
-gboolean gst_device_monitor_start (GstDeviceMonitor * monitor);
-void gst_device_monitor_stop (GstDeviceMonitor * monitor);
+GstBus * gst_device_monitor_get_bus (GstDeviceMonitor * monitor);
-gboolean gst_device_monitor_can_monitor (GstDeviceMonitor * monitor);
+GList * gst_device_monitor_get_devices (GstDeviceMonitor * monitor);
-GstBus * gst_device_monitor_get_bus (GstDeviceMonitor * monitor);
-void gst_device_monitor_device_add (GstDeviceMonitor * monitor,
- GstDevice * device);
-void gst_device_monitor_device_remove (GstDeviceMonitor * monitor,
- GstDevice * device);
+gboolean gst_device_monitor_start (GstDeviceMonitor * monitor);
+void gst_device_monitor_stop (GstDeviceMonitor * monitor);
-/* device monitor class meta data */
-void gst_device_monitor_class_set_metadata (GstDeviceMonitorClass *klass,
- const gchar *longname,
- const gchar *classification,
- const gchar *description,
- const gchar *author);
-void gst_device_monitor_class_set_static_metadata (GstDeviceMonitorClass *klass,
- const gchar *longname,
- const gchar *classification,
- const gchar *description,
- const gchar *author);
-void gst_device_monitor_class_add_metadata (GstDeviceMonitorClass * klass,
- const gchar * key, const gchar * value);
-void gst_device_monitor_class_add_static_metadata (GstDeviceMonitorClass * klass,
- const gchar * key, const gchar * value);
-const gchar * gst_device_monitor_class_get_metadata (GstDeviceMonitorClass * klass,
- const gchar * key);
-/* factory management */
-GstDeviceMonitorFactory * gst_device_monitor_get_factory (GstDeviceMonitor * monitor);
+guint gst_device_monitor_add_filter (GstDeviceMonitor * monitor,
+ const gchar * classes,
+ GstCaps * caps);
+gboolean gst_device_monitor_remove_filter (GstDeviceMonitor * monitor,
+ guint filter_id);
G_END_DECLS
diff --git a/gst/gstdevicemonitorfactory.c b/gst/gstdevicemonitorfactory.c
deleted file mode 100644
index f8c9826..0000000
--- a/gst/gstdevicemonitorfactory.c
+++ /dev/null
@@ -1,594 +0,0 @@
-/* GStreamer
- * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
- * 2000 Wim Taymans <wtay@chello.be>
- * 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
- *
- * gstdevicemonitorfactory.c: GstDeviceMonitorFactory object, support routines
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:gstdevicemonitorfactory
- * @short_description: Create GstDeviceMonitors from a factory
- * @see_also: #GstDeviceMonitor, #GstPlugin, #GstPluginFeature, #GstPadTemplate.
- *
- * #GstDeviceMonitorFactory is used to create instances of device monitors. A
- * GstDeviceMonitorfactory can be added to a #GstPlugin as it is also a
- * #GstPluginFeature.
- *
- * Use the gst_device_monitor_factory_find() and gst_device_monitor_factory_create()
- * functions to create device monitor instances or use gst_device_monitor_factory_make() as a
- * convenient shortcut.
- *
- * Since: 1.4
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gst_private.h"
-
-#include "gstdevicemonitorfactory.h"
-#include "gst.h"
-
-#include "glib-compat-private.h"
-
-GST_DEBUG_CATEGORY_STATIC (device_monitor_factory_debug);
-#define GST_CAT_DEFAULT device_monitor_factory_debug
-
-static void gst_device_monitor_factory_finalize (GObject * object);
-static void gst_device_monitor_factory_cleanup (GstDeviceMonitorFactory *
- factory);
-
-/* static guint gst_device_monitor_factory_signals[LAST_SIGNAL] = { 0 }; */
-
-/* this is defined in gstelement.c */
-extern GQuark __gst_devicemonitorclass_factory;
-
-#define _do_init \
-{ \
- GST_DEBUG_CATEGORY_INIT (device_monitor_factory_debug, "GST_DEVICE_MONITOR_FACTORY", \
- GST_DEBUG_BOLD | GST_DEBUG_FG_WHITE | GST_DEBUG_BG_RED, \
- "device monitor factories keep information about installed device monitors"); \
-}
-
-G_DEFINE_TYPE_WITH_CODE (GstDeviceMonitorFactory, gst_device_monitor_factory,
- GST_TYPE_PLUGIN_FEATURE, _do_init);
-
-static void
-gst_device_monitor_factory_class_init (GstDeviceMonitorFactoryClass * klass)
-{
- GObjectClass *gobject_class = (GObjectClass *) klass;
-
- gobject_class->finalize = gst_device_monitor_factory_finalize;
-}
-
-static void
-gst_device_monitor_factory_init (GstDeviceMonitorFactory * factory)
-{
-}
-
-static void
-gst_device_monitor_factory_finalize (GObject * object)
-{
- GstDeviceMonitorFactory *factory = GST_DEVICE_MONITOR_FACTORY (object);
- GstDeviceMonitor *monitor;
-
- gst_device_monitor_factory_cleanup (factory);
-
- monitor = g_atomic_pointer_get (&factory->monitor);
- if (monitor)
- gst_object_unref (monitor);
-
- G_OBJECT_CLASS (gst_device_monitor_factory_parent_class)->finalize (object);
-}
-
-/**
- * gst_device_monitor_factory_find:
- * @name: name of factory to find
- *
- * Search for an device monitor factory of the given name. Refs the returned
- * device monitor factory; caller is responsible for unreffing.
- *
- * Returns: (transfer full): #GstDeviceMonitorFactory if found, %NULL otherwise
- *
- * Since: 1.4
- */
-GstDeviceMonitorFactory *
-gst_device_monitor_factory_find (const gchar * name)
-{
- GstPluginFeature *feature;
-
- g_return_val_if_fail (name != NULL, NULL);
-
- feature = gst_registry_find_feature (gst_registry_get (), name,
- GST_TYPE_DEVICE_MONITOR_FACTORY);
- if (feature)
- return GST_DEVICE_MONITOR_FACTORY (feature);
-
- /* this isn't an error, for instance when you query if an device monitor factory is
- * present */
- GST_LOG ("no such device monitor factory \"%s\"", name);
-
- return NULL;
-}
-
-static void
-gst_device_monitor_factory_cleanup (GstDeviceMonitorFactory * factory)
-{
- if (factory->metadata) {
- gst_structure_free ((GstStructure *) factory->metadata);
- factory->metadata = NULL;
- }
- if (factory->type) {
- factory->type = G_TYPE_INVALID;
- }
-}
-
-#define CHECK_METADATA_FIELD(klass, name, key) \
- G_STMT_START { \
- const gchar *metafield = gst_device_monitor_class_get_metadata (klass, key); \
- if (G_UNLIKELY (metafield == NULL || *metafield == '\0')) { \
- g_warning ("Device monitor factory metadata for '%s' has no valid %s field", name, key); \
- goto detailserror; \
- } \
- } G_STMT_END;
-
-/**
- * gst_device_monitor_register:
- * @plugin: (allow-none): #GstPlugin to register the device monitor with, or %NULL for
- * a static device monitor.
- * @name: name of device monitors of this type
- * @rank: rank of device monitor (higher rank means more importance when autoplugging)
- * @type: GType of device monitor to register
- *
- * Create a new device monitorfactory capable of instantiating objects of the
- * @type and add the factory to @plugin.
- *
- * Returns: %TRUE, if the registering succeeded, %FALSE on error
- *
- * Since: 1.4
- */
-gboolean
-gst_device_monitor_register (GstPlugin * plugin, const gchar * name, guint rank,
- GType type)
-{
- GstPluginFeature *existing_feature;
- GstRegistry *registry;
- GstDeviceMonitorFactory *factory;
- GstDeviceMonitorClass *klass;
-
- g_return_val_if_fail (name != NULL, FALSE);
- g_return_val_if_fail (g_type_is_a (type, GST_TYPE_DEVICE_MONITOR), FALSE);
-
- registry = gst_registry_get ();
-
- /* check if feature already exists, if it exists there is no need to update it
- * when the registry is getting updated, outdated plugins and all their
- * features are removed and readded.
- */
- existing_feature = gst_registry_lookup_feature (registry, name);
- if (existing_feature) {
- GST_DEBUG_OBJECT (registry, "update existing feature %p (%s)",
- existing_feature, name);
- factory = GST_DEVICE_MONITOR_FACTORY_CAST (existing_feature);
- factory->type = type;
- existing_feature->loaded = TRUE;
- g_type_set_qdata (type, __gst_devicemonitorclass_factory, factory);
- gst_object_unref (existing_feature);
- return TRUE;
- }
-
- factory =
- GST_DEVICE_MONITOR_FACTORY_CAST (g_object_newv
- (GST_TYPE_DEVICE_MONITOR_FACTORY, 0, NULL));
- gst_plugin_feature_set_name (GST_PLUGIN_FEATURE_CAST (factory), name);
- GST_LOG_OBJECT (factory, "Created new device monitorfactory for type %s",
- g_type_name (type));
-
- /* provide info needed during class structure setup */
- g_type_set_qdata (type, __gst_devicemonitorclass_factory, factory);
- klass = GST_DEVICE_MONITOR_CLASS (g_type_class_ref (type));
-
- CHECK_METADATA_FIELD (klass, name, GST_ELEMENT_METADATA_LONGNAME);
- CHECK_METADATA_FIELD (klass, name, GST_ELEMENT_METADATA_KLASS);
- CHECK_METADATA_FIELD (klass, name, GST_ELEMENT_METADATA_DESCRIPTION);
- CHECK_METADATA_FIELD (klass, name, GST_ELEMENT_METADATA_AUTHOR);
-
- factory->type = type;
- factory->metadata = gst_structure_copy ((GstStructure *) klass->metadata);
-
- if (plugin && plugin->desc.name) {
- GST_PLUGIN_FEATURE_CAST (factory)->plugin_name = plugin->desc.name;
- GST_PLUGIN_FEATURE_CAST (factory)->plugin = plugin;
- g_object_add_weak_pointer ((GObject *) plugin,
- (gpointer *) & GST_PLUGIN_FEATURE_CAST (factory)->plugin);
- } else {
- GST_PLUGIN_FEATURE_CAST (factory)->plugin_name = "NULL";
- GST_PLUGIN_FEATURE_CAST (factory)->plugin = NULL;
- }
- gst_plugin_feature_set_rank (GST_PLUGIN_FEATURE_CAST (factory), rank);
- GST_PLUGIN_FEATURE_CAST (factory)->loaded = TRUE;
-
- gst_registry_add_feature (registry, GST_PLUGIN_FEATURE_CAST (factory));
-
- return TRUE;
-
- /* ERRORS */
-detailserror:
- {
- gst_device_monitor_factory_cleanup (factory);
- return FALSE;
- }
-}
-
-/**
- * gst_device_monitor_factory_get:
- * @factory: factory to instantiate
- *
- * Returns the device monitor of the type defined by the given device
- * monitorfactory.
- *
- * Returns: (transfer full): the #GstDeviceMonitor or %NULL if the
- * device monitor couldn't be created
- *
- * Since: 1.4
- */
-GstDeviceMonitor *
-gst_device_monitor_factory_get (GstDeviceMonitorFactory * factory)
-{
- GstDeviceMonitor *device_monitor;
- GstDeviceMonitorClass *oclass;
- GstDeviceMonitorFactory *newfactory;
-
- g_return_val_if_fail (factory != NULL, NULL);
-
- newfactory =
- GST_DEVICE_MONITOR_FACTORY (gst_plugin_feature_load (GST_PLUGIN_FEATURE
- (factory)));
-
- if (newfactory == NULL)
- goto load_failed;
-
- factory = newfactory;
-
- GST_INFO ("getting device monitor \"%s\"", GST_OBJECT_NAME (factory));
-
- if (factory->type == 0)
- goto no_type;
-
- device_monitor = g_atomic_pointer_get (&newfactory->monitor);
- if (device_monitor)
- return gst_object_ref (device_monitor);
-
- /* create an instance of the device monitor, cast so we don't assert on NULL
- * also set name as early as we can
- */
- device_monitor = GST_DEVICE_MONITOR_CAST (g_object_newv (factory->type, 0,
- NULL));
- if (G_UNLIKELY (device_monitor == NULL))
- goto no_device_monitor;
-
- /* fill in the pointer to the factory in the device monitor class. The
- * class will not be unreffed currently.
- * Be thread safe as there might be 2 threads creating the first instance of
- * an device monitor at the same moment
- */
- oclass = GST_DEVICE_MONITOR_GET_CLASS (device_monitor);
- if (!g_atomic_pointer_compare_and_exchange (&oclass->factory, NULL, factory))
- gst_object_unref (factory);
-
- gst_object_ref_sink (device_monitor);
-
- /* We use an atomic to make sure we don't create two in parallel */
- if (!g_atomic_pointer_compare_and_exchange (&newfactory->monitor, NULL,
- device_monitor)) {
- gst_object_unref (device_monitor);
-
- device_monitor = g_atomic_pointer_get (&newfactory->monitor);
- }
-
- GST_DEBUG ("created device monitor \"%s\"", GST_OBJECT_NAME (factory));
-
- return gst_object_ref (device_monitor);
-
- /* ERRORS */
-load_failed:
- {
- GST_WARNING_OBJECT (factory,
- "loading plugin containing feature %s returned NULL!",
- GST_OBJECT_NAME (factory));
- return NULL;
- }
-no_type:
- {
- GST_WARNING_OBJECT (factory, "factory has no type");
- gst_object_unref (factory);
- return NULL;
- }
-no_device_monitor:
- {
- GST_WARNING_OBJECT (factory, "could not create device monitor");
- gst_object_unref (factory);
- return NULL;
- }
-}
-
-/**
- * gst_device_monitor_factory_get_by_name:
- * @factoryname: a named factory to instantiate
- *
- * Returns the device monitor of the type defined by the given device
- * monitor factory.
- *
- * Returns: (transfer full): a #GstDeviceMonitor or %NULL if unable to
- * create device monitor
- *
- * Since: 1.4
- */
-GstDeviceMonitor *
-gst_device_monitor_factory_get_by_name (const gchar * factoryname)
-{
- GstDeviceMonitorFactory *factory;
- GstDeviceMonitor *device_monitor;
-
- g_return_val_if_fail (factoryname != NULL, NULL);
- g_return_val_if_fail (gst_is_initialized (), NULL);
-
- GST_LOG ("gstdevicemonitorfactory: get_by_name \"%s\"", factoryname);
-
- factory = gst_device_monitor_factory_find (factoryname);
- if (factory == NULL)
- goto no_factory;
-
- GST_LOG_OBJECT (factory, "found factory %p", factory);
- device_monitor = gst_device_monitor_factory_get (factory);
- if (device_monitor == NULL)
- goto create_failed;
-
- gst_object_unref (factory);
- return device_monitor;
-
- /* ERRORS */
-no_factory:
- {
- GST_INFO ("no such device monitor factory \"%s\"!", factoryname);
- return NULL;
- }
-create_failed:
- {
- GST_INFO_OBJECT (factory, "couldn't create instance!");
- gst_object_unref (factory);
- return NULL;
- }
-}
-
-/**
- * gst_device_monitor_factory_get_device_monitor_type:
- * @factory: factory to get managed #GType from
- *
- * Get the #GType for device monitors managed by this factory. The type can
- * only be retrieved if the device monitor factory is loaded, which can be
- * assured with gst_plugin_feature_load().
- *
- * Returns: the #GType for device monitors managed by this factory or 0 if
- * the factory is not loaded.
- *
- * Since: 1.4
- */
-GType
-gst_device_monitor_factory_get_device_monitor_type (GstDeviceMonitorFactory *
- factory)
-{
- g_return_val_if_fail (GST_IS_DEVICE_MONITOR_FACTORY (factory), 0);
-
- return factory->type;
-}
-
-/**
- * gst_device_monitor_factory_get_metadata:
- * @factory: a #GstDeviceMonitorFactory
- * @key: a key
- *
- * Get the metadata on @factory with @key.
- *
- * Returns: the metadata with @key on @factory or %NULL when there was no
- * metadata with the given @key.
- *
- * Since: 1.4
- */
-const gchar *
-gst_device_monitor_factory_get_metadata (GstDeviceMonitorFactory * factory,
- const gchar * key)
-{
- return gst_structure_get_string ((GstStructure *) factory->metadata, key);
-}
-
-/**
- * gst_device_monitor_factory_get_metadata_keys:
- * @factory: a #GstDeviceMonitorFactory
- *
- * Get the available keys for the metadata on @factory.
- *
- * Returns: (transfer full) (element-type utf8) (array zero-terminated=1):
- * a %NULL-terminated array of key strings, or %NULL when there is no
- * metadata. Free with g_strfreev() when no longer needed.
- *
- * Since: 1.4
- */
-gchar **
-gst_device_monitor_factory_get_metadata_keys (GstDeviceMonitorFactory * factory)
-{
- GstStructure *metadata;
- gchar **arr;
- gint i, num;
-
- g_return_val_if_fail (GST_IS_DEVICE_MONITOR_FACTORY (factory), NULL);
-
- metadata = (GstStructure *) factory->metadata;
- if (metadata == NULL)
- return NULL;
-
- num = gst_structure_n_fields (metadata);
- if (num == 0)
- return NULL;
-
- arr = g_new (gchar *, num + 1);
- for (i = 0; i < num; ++i) {
- arr[i] = g_strdup (gst_structure_nth_field_name (metadata, i));
- }
- arr[i] = NULL;
- return arr;
-}
-
-/**
- * gst_device_monitor_factory_has_classesv:
- * @factory: a #GstDeviceMonitorFactory
- * @classes: (array zero-terminated=1): a %NULL terminated array of
- * klasses to match, only match if all classes are matched
- *
- * Check if @factory matches all of the given classes
- *
- * Returns: %TRUE if @factory matches.
- *
- * Since: 1.4
- */
-gboolean
-gst_device_monitor_factory_has_classesv (GstDeviceMonitorFactory * factory,
- gchar ** classes)
-{
- const gchar *klass;
-
- g_return_val_if_fail (GST_IS_DEVICE_MONITOR_FACTORY (factory), FALSE);
-
- klass = gst_device_monitor_factory_get_metadata (factory,
- GST_ELEMENT_METADATA_KLASS);
-
- if (klass == NULL) {
- GST_ERROR_OBJECT (factory,
- "device monitor factory is missing klass identifiers");
- return FALSE;
- }
-
- for (; classes[0]; classes++) {
- const gchar *found;
- guint len;
-
- if (classes[0] == '\0')
- continue;
-
- found = strstr (klass, classes[0]);
-
- if (!found)
- return FALSE;
- if (found != klass && *(found - 1) != '/')
- return FALSE;
-
- len = strlen (classes[0]);
- if (found[len] != 0 && found[len] != '/')
- return FALSE;
- }
-
- return TRUE;
-}
-
-/**
- * gst_device_monitor_factory_has_classes:
- * @factory: a #GstDeviceMonitorFactory
- * @classes: a "/" separate list of klasses to match, only match if all classes
- * are matched
- *
- * Check if @factory matches all of the given @classes
- *
- * Returns: %TRUE if @factory matches.
- *
- * Since: 1.4
- */
-gboolean
-gst_device_monitor_factory_has_classes (GstDeviceMonitorFactory * factory,
- const gchar * classes)
-{
- gchar **classesv;
- gboolean res;
-
- classesv = g_strsplit (classes, "/", 0);
-
- res = gst_device_monitor_factory_has_classesv (factory, classesv);
-
- g_strfreev (classesv);
-
- return res;
-}
-
-typedef struct
-{
- const char *classes;
- GstRank minrank;
-} FilterData;
-
-static gboolean
-device_monitor_filter (GstPluginFeature * feature, FilterData * data)
-{
- gboolean res;
-
- /* we only care about device monitor factories */
- if (G_UNLIKELY (!GST_IS_DEVICE_MONITOR_FACTORY (feature)))
- return FALSE;
-
- res = (gst_plugin_feature_get_rank (feature) >= data->minrank) &&
- gst_device_monitor_factory_has_classes (GST_DEVICE_MONITOR_FACTORY_CAST
- (feature), data->classes);
-
- return res;
-}
-
-/**
- * gst_device_monitor_factory_list_get_device_monitors:
- * @classes: a "/" separate list of klasses to match, only match if all classes
- * are matched
- * @minrank: Minimum rank
- *
- * Get a list of factories that match all of the given @classes. Only
- * device monitors with a rank greater or equal to @minrank will be
- * returned. The list of factories is returned by decreasing rank.
- *
- * Returns: (transfer full) (element-type Gst.DeviceMonitorFactory): a #GList of
- * #GstDeviceMonitorFactory device monitors. Use gst_plugin_feature_list_free() after
- * usage.
- *
- * Since: 1.4
- */
-GList *gst_device_monitor_factory_list_get_device_monitors
- (const gchar * classes, GstRank minrank)
-{
- GList *result;
- FilterData data;
-
- /* prepare type */
- data.classes = classes;
- data.minrank = minrank;
-
- /* get the feature list using the filter */
- result = gst_registry_feature_filter (gst_registry_get (),
- (GstPluginFeatureFilter) device_monitor_filter, FALSE, &data);
-
- /* sort on rank and name */
- result = g_list_sort (result, gst_plugin_feature_rank_compare_func);
-
- return result;
-}
diff --git a/gst/gstdevicemonitorfactory.h b/gst/gstdevicemonitorfactory.h
deleted file mode 100644
index 02bf04a..0000000
--- a/gst/gstdevicemonitorfactory.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/* GStreamer
- * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
- * 2000,2004 Wim Taymans <wim@fluendo.com>
- * 2012 Olivier Crete <olivier.crete@collabora.com>
- *
- * gstdevicemonitorfactory.h: Header for GstDeviceMonitorFactory
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-
-
-#ifndef __GST_DEVICE_MONITOR_FACTORY_H__
-#define __GST_DEVICE_MONITOR_FACTORY_H__
-
-/**
- * GstDeviceMonitorFactory:
- *
- * The opaque #GstDeviceMonitorFactory data structure.
- *
- * Since: 1.4
- */
-
-/**
- * GstDeviceMonitorFactoryClass:
- *
- * The opaque #GstDeviceMonitorFactoryClass data structure.
- *
- * Since: 1.4
- */
-typedef struct _GstDeviceMonitorFactory GstDeviceMonitorFactory;
-typedef struct _GstDeviceMonitorFactoryClass GstDeviceMonitorFactoryClass;
-
-#include <gst/gstconfig.h>
-#include <gst/gstplugin.h>
-#include <gst/gstpluginfeature.h>
-#include <gst/gstdevicemonitor.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_DEVICE_MONITOR_FACTORY (gst_device_monitor_factory_get_type())
-#define GST_DEVICE_MONITOR_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DEVICE_MONITOR_FACTORY,\
- GstDeviceMonitorFactory))
-#define GST_DEVICE_MONITOR_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DEVICE_MONITOR_FACTORY,\
- GstDeviceMonitorFactoryClass))
-#define GST_IS_DEVICE_MONITOR_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DEVICE_MONITOR_FACTORY))
-#define GST_IS_DEVICE_MONITOR_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DEVICE_MONITOR_FACTORY))
-#define GST_DEVICE_MONITOR_FACTORY_CAST(obj) ((GstDeviceMonitorFactory *)(obj))
-
-GType gst_device_monitor_factory_get_type (void);
-
-GstDeviceMonitorFactory * gst_device_monitor_factory_find (const gchar *name);
-
-GType gst_device_monitor_factory_get_device_monitor_type (GstDeviceMonitorFactory *factory);
-
-const gchar * gst_device_monitor_factory_get_metadata (GstDeviceMonitorFactory *factory, const gchar *key);
-gchar ** gst_device_monitor_factory_get_metadata_keys (GstDeviceMonitorFactory *factory);
-
-GstDeviceMonitor* gst_device_monitor_factory_get (GstDeviceMonitorFactory *factory) G_GNUC_MALLOC;
-GstDeviceMonitor* gst_device_monitor_factory_get_by_name (const gchar *factoryname) G_GNUC_MALLOC;
-
-gboolean gst_device_monitor_register (GstPlugin *plugin, const gchar *name,
- guint rank,
- GType type);
-
-gboolean gst_device_monitor_factory_has_classesv (GstDeviceMonitorFactory * factory,
- gchar ** classes);
-
-gboolean gst_device_monitor_factory_has_classes (GstDeviceMonitorFactory *factory,
- const gchar * classes);
-
-GList * gst_device_monitor_factory_list_get_device_monitors (const gchar *classes,
- GstRank minrank) G_GNUC_MALLOC;
-
-G_END_DECLS
-
-#endif /* __GST_DEVICE_MONITOR_FACTORY_H__ */
diff --git a/gst/gstdeviceprovider.c b/gst/gstdeviceprovider.c
new file mode 100644
index 0000000..ea91200
--- /dev/null
+++ b/gst/gstdeviceprovider.c
@@ -0,0 +1,591 @@
+/* GStreamer
+ * Copyright (C) 2012 Olivier Crete <olivier.crete@collabora.com>
+ *
+ * gstdeviceprovider.c: Device probing and monitoring
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/**
+ * SECTION:gstdeviceprovider
+ * @short_description: A device provider
+ * @see_also: #GstDevice, #GstDeviceMonitor
+ *
+ * A #GstDeviceProvider subclass is provided by a plugin that handles devices
+ * if there is a way to programatically list connected devices. It can also
+ * optionally provide updates to the list of connected devices.
+ *
+ * Each #GstDeviceProvider subclass is a singleton, a plugin should
+ * normally provide a single subclass for all devices.
+ *
+ * Applications would normally use a #GstDeviceMonitor to monitor devices
+ * from all relevant providers.
+ *
+ * Since: 1.4
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "gst_private.h"
+
+#include "gstdeviceprovider.h"
+
+#include "gstelementmetadata.h"
+#include "gstquark.h"
+
+struct _GstDeviceProviderPrivate
+{
+ GstBus *bus;
+
+ GMutex start_lock;
+
+ gboolean started_count;
+};
+
+/* this is used in gstelementfactory.c:gst_element_register() */
+GQuark __gst_deviceproviderclass_factory = 0;
+
+static void gst_device_provider_class_init (GstDeviceProviderClass * klass);
+static void gst_device_provider_init (GstDeviceProvider * element);
+static void gst_device_provider_base_class_init (gpointer g_class);
+static void gst_device_provider_base_class_finalize (gpointer g_class);
+static void gst_device_provider_dispose (GObject * object);
+static void gst_device_provider_finalize (GObject * object);
+
+static gpointer gst_device_provider_parent_class = NULL;
+
+GType
+gst_device_provider_get_type (void)
+{
+ static volatile gsize gst_device_provider_type = 0;
+
+ if (g_once_init_enter (&gst_device_provider_type)) {
+ GType _type;
+ static const GTypeInfo element_info = {
+ sizeof (GstDeviceProviderClass),
+ gst_device_provider_base_class_init,
+ gst_device_provider_base_class_finalize,
+ (GClassInitFunc) gst_device_provider_class_init,
+ NULL,
+ NULL,
+ sizeof (GstDeviceProvider),
+ 0,
+ (GInstanceInitFunc) gst_device_provider_init,
+ NULL
+ };
+
+ _type = g_type_register_static (GST_TYPE_OBJECT, "GstDeviceProvider",
+ &element_info, G_TYPE_FLAG_ABSTRACT);
+
+ __gst_deviceproviderclass_factory =
+ g_quark_from_static_string ("GST_DEVICEPROVIDERCLASS_FACTORY");
+ g_once_init_leave (&gst_device_provider_type, _type);
+ }
+ return gst_device_provider_type;
+}
+
+static void
+gst_device_provider_base_class_init (gpointer g_class)
+{
+ GstDeviceProviderClass *klass = GST_DEVICE_PROVIDER_CLASS (g_class);
+
+ /* Copy the element details here so elements can inherit the
+ * details from their base class and classes only need to set
+ * the details in class_init instead of base_init */
+ klass->metadata =
+ klass->metadata ? gst_structure_copy (klass->metadata) :
+ gst_structure_new_empty ("metadata");
+
+ klass->factory = g_type_get_qdata (G_TYPE_FROM_CLASS (klass),
+ __gst_deviceproviderclass_factory);
+}
+
+static void
+gst_device_provider_base_class_finalize (gpointer g_class)
+{
+ GstDeviceProviderClass *klass = GST_DEVICE_PROVIDER_CLASS (g_class);
+
+ gst_structure_free (klass->metadata);
+}
+
+static void
+gst_device_provider_class_init (GstDeviceProviderClass * klass)
+{
+ GObjectClass *gobject_class = (GObjectClass *) klass;
+
+ gst_device_provider_parent_class = g_type_class_peek_parent (klass);
+
+ g_type_class_add_private (klass, sizeof (GstDeviceProviderPrivate));
+
+ gobject_class->dispose = gst_device_provider_dispose;
+ gobject_class->finalize = gst_device_provider_finalize;
+}
+
+static void
+gst_device_provider_init (GstDeviceProvider * provider)
+{
+ provider->priv = G_TYPE_INSTANCE_GET_PRIVATE (provider,
+ GST_TYPE_DEVICE_PROVIDER, GstDeviceProviderPrivate);
+
+ g_mutex_init (&provider->priv->start_lock);
+
+ provider->priv->bus = gst_bus_new ();
+ gst_bus_set_flushing (provider->priv->bus, TRUE);
+}
+
+
+static void
+gst_device_provider_dispose (GObject * object)
+{
+ GstDeviceProvider *provider = GST_DEVICE_PROVIDER (object);
+
+ gst_object_replace ((GstObject **) & provider->priv->bus, NULL);
+
+ GST_OBJECT_LOCK (provider);
+ g_list_free_full (provider->devices, (GDestroyNotify) gst_object_unparent);
+ provider->devices = NULL;
+ GST_OBJECT_UNLOCK (provider);
+
+ G_OBJECT_CLASS (gst_device_provider_parent_class)->dispose (object);
+}
+
+static void
+gst_device_provider_finalize (GObject * object)
+{
+ GstDeviceProvider *provider = GST_DEVICE_PROVIDER (object);
+
+ g_mutex_clear (&provider->priv->start_lock);
+
+ G_OBJECT_CLASS (gst_device_provider_parent_class)->finalize (object);
+}
+
+/**
+ * gst_device_provider_class_add_metadata:
+ * @klass: class to set metadata for
+ * @key: the key to set
+ * @value: the value to set
+ *
+ * Set @key with @value as metadata in @klass.
+ */
+void
+gst_device_provider_class_add_metadata (GstDeviceProviderClass * klass,
+ const gchar * key, const gchar * value)
+{
+ g_return_if_fail (GST_IS_DEVICE_PROVIDER_CLASS (klass));
+ g_return_if_fail (key != NULL);
+ g_return_if_fail (value != NULL);
+
+ gst_structure_set ((GstStructure *) klass->metadata,
+ key, G_TYPE_STRING, value, NULL);
+}
+
+/**
+ * gst_device_provider_class_add_static_metadata:
+ * @klass: class to set metadata for
+ * @key: the key to set
+ * @value: the value to set
+ *
+ * Set @key with @value as metadata in @klass.
+ *
+ * Same as gst_device_provider_class_add_metadata(), but @value must be a static string
+ * or an inlined string, as it will not be copied. (GStreamer plugins will
+ * be made resident once loaded, so this function can be used even from
+ * dynamically loaded plugins.)
+ *
+ * Since: 1.4
+ */
+void
+gst_device_provider_class_add_static_metadata (GstDeviceProviderClass * klass,
+ const gchar * key, const gchar * value)
+{
+ GValue val = G_VALUE_INIT;
+
+ g_return_if_fail (GST_IS_DEVICE_PROVIDER_CLASS (klass));
+ g_return_if_fail (key != NULL);
+ g_return_if_fail (value != NULL);
+
+ g_value_init (&val, G_TYPE_STRING);
+ g_value_set_static_string (&val, value);
+ gst_structure_take_value ((GstStructure *) klass->metadata, key, &val);
+}
+
+/**
+ * gst_device_provider_class_set_metadata:
+ * @klass: class to set metadata for
+ * @longname: The long English name of the device provider. E.g. "File Sink"
+ * @classification: String describing the type of device provider, as an
+ * unordered list separated with slashes ('/'). See draft-klass.txt of the
+ * design docs
+ * for more details and common types. E.g: "Sink/File"
+ * @description: Sentence describing the purpose of the device provider.
+ * E.g: "Write stream to a file"
+ * @author: Name and contact details of the author(s). Use \n to separate
+ * multiple author metadata. E.g: "Joe Bloggs &lt;joe.blogs at foo.com&gt;"
+ *
+ * Sets the detailed information for a #GstDeviceProviderClass.
+ * <note>This function is for use in _class_init functions only.</note>
+ *
+ * Since: 1.4
+ */
+void
+gst_device_provider_class_set_metadata (GstDeviceProviderClass * klass,
+ const gchar * longname, const gchar * classification,
+ const gchar * description, const gchar * author)
+{
+ g_return_if_fail (GST_IS_DEVICE_PROVIDER_CLASS (klass));
+ g_return_if_fail (longname != NULL && *longname != '\0');
+ g_return_if_fail (classification != NULL && *classification != '\0');
+ g_return_if_fail (description != NULL && *description != '\0');
+ g_return_if_fail (author != NULL && *author != '\0');
+
+ gst_structure_id_set ((GstStructure *) klass->metadata,
+ GST_QUARK (ELEMENT_METADATA_LONGNAME), G_TYPE_STRING, longname,
+ GST_QUARK (ELEMENT_METADATA_KLASS), G_TYPE_STRING, classification,
+ GST_QUARK (ELEMENT_METADATA_DESCRIPTION), G_TYPE_STRING, description,
+ GST_QUARK (ELEMENT_METADATA_AUTHOR), G_TYPE_STRING, author, NULL);
+}
+
+/**
+ * gst_device_provider_class_set_static_metadata:
+ * @klass: class to set metadata for
+ * @longname: The long English name of the element. E.g. "File Sink"
+ * @classification: String describing the type of element, as an unordered list
+ * separated with slashes ('/'). See draft-klass.txt of the design docs
+ * for more details and common types. E.g: "Sink/File"
+ * @description: Sentence describing the purpose of the element.
+ * E.g: "Write stream to a file"
+ * @author: Name and contact details of the author(s). Use \n to separate
+ * multiple author metadata. E.g: "Joe Bloggs &lt;joe.blogs at foo.com&gt;"
+ *
+ * Sets the detailed information for a #GstDeviceProviderClass.
+ * <note>This function is for use in _class_init functions only.</note>
+ *
+ * Same as gst_device_provider_class_set_metadata(), but @longname, @classification,
+ * @description, and @author must be static strings or inlined strings, as
+ * they will not be copied. (GStreamer plugins will be made resident once
+ * loaded, so this function can be used even from dynamically loaded plugins.)
+ *
+ * Since: 1.4
+ */
+void
+gst_device_provider_class_set_static_metadata (GstDeviceProviderClass * klass,
+ const gchar * longname, const gchar * classification,
+ const gchar * description, const gchar * author)
+{
+ GstStructure *s = (GstStructure *) klass->metadata;
+ GValue val = G_VALUE_INIT;
+
+ g_return_if_fail (GST_IS_DEVICE_PROVIDER_CLASS (klass));
+ g_return_if_fail (longname != NULL && *longname != '\0');
+ g_return_if_fail (classification != NULL && *classification != '\0');
+ g_return_if_fail (description != NULL && *description != '\0');
+ g_return_if_fail (author != NULL && *author != '\0');
+
+ g_value_init (&val, G_TYPE_STRING);
+
+ g_value_set_static_string (&val, longname);
+ gst_structure_id_set_value (s, GST_QUARK (ELEMENT_METADATA_LONGNAME), &val);
+
+ g_value_set_static_string (&val, classification);
+ gst_structure_id_set_value (s, GST_QUARK (ELEMENT_METADATA_KLASS), &val);
+
+ g_value_set_static_string (&val, description);
+ gst_structure_id_set_value (s, GST_QUARK (ELEMENT_METADATA_DESCRIPTION),
+ &val);
+
+ g_value_set_static_string (&val, author);
+ gst_structure_id_take_value (s, GST_QUARK (ELEMENT_METADATA_AUTHOR), &val);
+}
+
+/**
+ * gst_device_provider_class_get_metadata:
+ * @klass: class to get metadata for
+ * @key: the key to get
+ *
+ * Get metadata with @key in @klass.
+ *
+ * Returns: the metadata for @key.
+ *
+ * Since: 1.4
+ */
+const gchar *
+gst_device_provider_class_get_metadata (GstDeviceProviderClass * klass,
+ const gchar * key)
+{
+ g_return_val_if_fail (GST_IS_DEVICE_PROVIDER_CLASS (klass), NULL);
+ g_return_val_if_fail (key != NULL, NULL);
+
+ return gst_structure_get_string ((GstStructure *) klass->metadata, key);
+}
+
+/**
+ * gst_device_provider_get_devices:
+ * @provider: A #GstDeviceProvider
+ *
+ * Gets a list of devices that this provider understands. This may actually
+ * probe the hardware if the provider is not currently started.
+ *
+ * Returns: (transfer full) (element-type GstDevice): a #GList of
+ * #GstDevice
+ *
+ * Since: 1.4
+ */
+
+GList *
+gst_device_provider_get_devices (GstDeviceProvider * provider)
+{
+ GstDeviceProviderClass *klass;
+ GList *devices = NULL;
+ gboolean started;
+ GList *item;
+
+ g_return_val_if_fail (GST_IS_DEVICE_PROVIDER (provider), NULL);
+ klass = GST_DEVICE_PROVIDER_GET_CLASS (provider);
+
+ g_mutex_lock (&provider->priv->start_lock);
+ started = (provider->priv->started_count > 0);
+
+ if (started) {
+ GST_OBJECT_LOCK (provider);
+ for (item = provider->devices; item; item = item->next)
+ devices = g_list_prepend (devices, gst_object_ref (item->data));
+ GST_OBJECT_UNLOCK (provider);
+ } else if (klass->probe)
+ devices = klass->probe (provider);
+
+ g_mutex_unlock (&provider->priv->start_lock);
+
+ return devices;
+}
+
+/**
+ * gst_device_provider_start:
+ * @provider: A #GstDeviceProvider
+ *
+ * Starts providering the devices. This will cause #GST_MESSAGE_DEVICE messages
+ * to be posted on the provider's bus when devices are added or removed from
+ * the system.
+ *
+ * Since the #GstDeviceProvider is a singleton,
+ * gst_device_provider_start() may already have been called by another
+ * user of the object, gst_device_provider_stop() needs to be called the same
+ * number of times.
+ *
+ * Returns: %TRUE if the device providering could be started
+ *
+ * Since: 1.4
+ */
+
+gboolean
+gst_device_provider_start (GstDeviceProvider * provider)
+{
+ GstDeviceProviderClass *klass;
+ gboolean ret = FALSE;
+
+ g_return_val_if_fail (GST_IS_DEVICE_PROVIDER (provider), FALSE);
+ klass = GST_DEVICE_PROVIDER_GET_CLASS (provider);
+
+ g_mutex_lock (&provider->priv->start_lock);
+
+ if (provider->priv->started_count > 0) {
+ ret = TRUE;
+ goto started;
+ }
+
+ if (klass->start)
+ ret = klass->start (provider);
+
+ if (ret) {
+ provider->priv->started_count++;
+ gst_bus_set_flushing (provider->priv->bus, FALSE);
+ }
+
+started:
+
+ g_mutex_unlock (&provider->priv->start_lock);
+
+ return ret;
+}
+
+/**
+ * gst_device_provider_stop:
+ * @provider: A #GstDeviceProvider
+ *
+ * Decreases the use-count by one. If the use count reaches zero, this
+ * #GstDeviceProvider will stop providering the devices. This needs to be
+ * called the same number of times that gst_device_provider_start() was called.
+ *
+ * Since: 1.4
+ */
+
+void
+gst_device_provider_stop (GstDeviceProvider * provider)
+{
+ GstDeviceProviderClass *klass;
+
+ g_return_if_fail (GST_IS_DEVICE_PROVIDER (provider));
+ klass = GST_DEVICE_PROVIDER_GET_CLASS (provider);
+
+ g_mutex_lock (&provider->priv->start_lock);
+
+ if (provider->priv->started_count == 1) {
+ gst_bus_set_flushing (provider->priv->bus, TRUE);
+ if (klass->stop)
+ klass->stop (provider);
+ GST_OBJECT_LOCK (provider);
+ g_list_free_full (provider->devices, (GDestroyNotify) gst_object_unparent);
+ provider->devices = NULL;
+ GST_OBJECT_UNLOCK (provider);
+ } else if (provider->priv->started_count < 1) {
+ g_critical
+ ("Trying to stop a GstDeviceProvider %s which is already stopped",
+ GST_OBJECT_NAME (provider));
+ }
+
+ provider->priv->started_count--;
+ g_mutex_unlock (&provider->priv->start_lock);
+}
+
+
+/**
+ * gst_device_provider_get_factory:
+ * @provider: a #GstDeviceProvider to request the device provider factory of.
+ *
+ * Retrieves the factory that was used to create this device provider.
+ *
+ * Returns: (transfer none): the #GstDeviceProviderFactory used for
+ * creating this device provider. no refcounting is needed.
+ *
+ * Since: 1.4
+ */
+GstDeviceProviderFactory *
+gst_device_provider_get_factory (GstDeviceProvider * provider)
+{
+ g_return_val_if_fail (GST_IS_DEVICE_PROVIDER (provider), NULL);
+
+ return GST_DEVICE_PROVIDER_GET_CLASS (provider)->factory;
+}
+
+/**
+ * gst_device_provider_can_provider:
+ * @provider: a #GstDeviceProvider
+ *
+ * If this function returns %TRUE, then the device provider can provider if
+ * devices are added or removed. Otherwise, it can only do static probing.
+ *
+ * Returns: %TRUE if the #GstDeviceProvider support providering, %FALSE otherwise
+ */
+gboolean
+gst_device_provider_can_monitor (GstDeviceProvider * provider)
+{
+ GstDeviceProviderClass *klass;
+
+ g_return_val_if_fail (GST_IS_DEVICE_PROVIDER (provider), FALSE);
+ klass = GST_DEVICE_PROVIDER_GET_CLASS (provider);
+
+ if (klass->start)
+ return TRUE;
+ else
+ return FALSE;
+}
+
+/**
+ * gst_device_provider_get_bus:
+ * @provider: a #GstDeviceProvider
+ *
+ * Gets the #GstBus of this #GstDeviceProvider
+ *
+ * Returns: (transfer full): a #GstBus
+ *
+ * Since: 1.4
+ */
+GstBus *
+gst_device_provider_get_bus (GstDeviceProvider * provider)
+{
+ g_return_val_if_fail (GST_IS_DEVICE_PROVIDER (provider), NULL);
+
+ return gst_object_ref (provider->priv->bus);
+}
+
+/**
+ * gst_device_provider_device_add:
+ * @provider: a #GstDeviceProvider
+ * @device: (transfer full): a #GstDevice that has been added
+ *
+ * Posts a message on the provider's #GstBus to inform applications that
+ * a new device has been added.
+ *
+ * This is for use by subclasses.
+ *
+ * Since: 1.4
+ */
+void
+gst_device_provider_device_add (GstDeviceProvider * provider,
+ GstDevice * device)
+{
+ GstMessage *message;
+
+ if (!gst_object_set_parent (GST_OBJECT (device), GST_OBJECT (provider))) {
+ GST_WARNING_OBJECT (provider, "Could not parent device %p to provider,"
+ " it already has a parent", device);
+ return;
+ }
+
+ GST_OBJECT_LOCK (provider);
+ provider->devices = g_list_prepend (provider->devices,
+ gst_object_ref (device));
+ GST_OBJECT_UNLOCK (provider);
+
+ message = gst_message_new_device_added (GST_OBJECT (provider), device);
+ gst_bus_post (provider->priv->bus, message);
+ gst_object_unref (device);
+}
+
+
+/**
+ * gst_device_provider_device_remove:
+ * @provider: a #GstDeviceProvider
+ * @device: a #GstDevice that has been removed
+ *
+ * Posts a message on the provider's #GstBus to inform applications that
+ * a device has been removed.
+ *
+ * This is for use by subclasses.
+ *
+ * Since: 1.4
+ */
+void
+gst_device_provider_device_remove (GstDeviceProvider * provider,
+ GstDevice * device)
+{
+ GstMessage *message;
+ GList *item;
+
+ GST_OBJECT_LOCK (provider);
+ item = g_list_find (provider->devices, device);
+ if (item) {
+ provider->devices = g_list_delete_link (provider->devices, item);
+ }
+ GST_OBJECT_UNLOCK (provider);
+
+ message = gst_message_new_device_removed (GST_OBJECT (provider), device);
+ g_signal_emit_by_name (device, "removed");
+ gst_bus_post (provider->priv->bus, message);
+ if (item)
+ gst_object_unparent (GST_OBJECT (device));
+}
diff --git a/gst/gstdeviceprovider.h b/gst/gstdeviceprovider.h
new file mode 100644
index 0000000..6370afc
--- /dev/null
+++ b/gst/gstdeviceprovider.h
@@ -0,0 +1,142 @@
+/* GStreamer
+ * Copyright (C) 2012 Olivier Crete <olivier.crete@collabora.com>
+ *
+ * gstdeviceprovider.h: Device probing and monitoring
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <gst/gstdeviceproviderfactory.h>
+
+
+#ifndef __GST_DEVICE_PROVIDER_H__
+#define __GST_DEVICE_PROVIDER_H__
+
+#include <gst/gstelement.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GstDeviceProvider GstDeviceProvider;
+typedef struct _GstDeviceProviderClass GstDeviceProviderClass;
+typedef struct _GstDeviceProviderPrivate GstDeviceProviderPrivate;
+
+#define GST_TYPE_DEVICE_PROVIDER (gst_device_provider_get_type())
+#define GST_IS_DEVICE_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_DEVICE_PROVIDER))
+#define GST_IS_DEVICE_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_DEVICE_PROVIDER))
+#define GST_DEVICE_PROVIDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_DEVICE_PROVIDER, GstDeviceProviderClass))
+#define GST_DEVICE_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_DEVICE_PROVIDER, GstDeviceProvider))
+#define GST_DEVICE_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_DEVICE_PROVIDER, GstDeviceProviderClass))
+#define GST_DEVICE_PROVIDER_CAST(obj) ((GstDeviceProvider *)(obj))
+
+
+/**
+ * GstDeviceProvider:
+ * @parent: The parent #GstObject
+ * @devices: a #GList of the #GstDevice objects
+ *
+ * The structure of the base #GstDeviceProvider
+ *
+ * Since: 1.4
+ */
+struct _GstDeviceProvider {
+ GstObject parent;
+
+ /* Protected by the Object lock */
+ GList *devices;
+
+ /*< private >*/
+
+ GstDeviceProviderPrivate *priv;
+
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+/**
+ * GstDeviceProviderClass:
+ * @parent_class: the parent #GstObjectClass structure
+ * @factory: a pointer to the #GstDeviceProviderFactory that creates this
+ * provider
+ * @probe: Returns a list of devices that are currently available.
+ * This should never block.
+ * @start: Starts monitoring for new devices. Only subclasses that can know
+ * that devices have been added or remove need to implement this method.
+ * @stop: Stops monitoring for new devices. Only subclasses that implement
+ * the start() method need to implement this method.
+ *
+ * The structure of the base #GstDeviceProviderClass
+ *
+ * Since: 1.4
+ */
+
+struct _GstDeviceProviderClass {
+ GstObjectClass parent_class;
+
+ GstDeviceProviderFactory *factory;
+
+ GList* (*probe) (GstDeviceProvider * provider);
+
+ gboolean (*start) (GstDeviceProvider * provider);
+ void (*stop) (GstDeviceProvider * provider);
+
+ /*< private >*/
+ gpointer metadata;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+GType gst_device_provider_get_type (void);
+
+
+GList * gst_device_provider_get_devices (GstDeviceProvider * provider);
+
+gboolean gst_device_provider_start (GstDeviceProvider * provider);
+void gst_device_provider_stop (GstDeviceProvider * provider);
+
+gboolean gst_device_provider_can_monitor (GstDeviceProvider * provider);
+
+GstBus * gst_device_provider_get_bus (GstDeviceProvider * provider);
+
+void gst_device_provider_device_add (GstDeviceProvider * provider,
+ GstDevice * device);
+void gst_device_provider_device_remove (GstDeviceProvider * provider,
+ GstDevice * device);
+
+
+/* device provider class meta data */
+void gst_device_provider_class_set_metadata (GstDeviceProviderClass *klass,
+ const gchar *longname,
+ const gchar *classification,
+ const gchar *description,
+ const gchar *author);
+void gst_device_provider_class_set_static_metadata (GstDeviceProviderClass *klass,
+ const gchar *longname,
+ const gchar *classification,
+ const gchar *description,
+ const gchar *author);
+void gst_device_provider_class_add_metadata (GstDeviceProviderClass * klass,
+ const gchar * key, const gchar * value);
+void gst_device_provider_class_add_static_metadata (GstDeviceProviderClass * klass,
+ const gchar * key, const gchar * value);
+const gchar * gst_device_provider_class_get_metadata (GstDeviceProviderClass * klass,
+ const gchar * key);
+
+/* factory management */
+GstDeviceProviderFactory * gst_device_provider_get_factory (GstDeviceProvider * provider);
+
+G_END_DECLS
+
+#endif /* __GST_DEVICE_PROVIDER_H__ */
diff --git a/gst/gstdeviceproviderfactory.c b/gst/gstdeviceproviderfactory.c
new file mode 100644
index 0000000..3ea0703
--- /dev/null
+++ b/gst/gstdeviceproviderfactory.c
@@ -0,0 +1,580 @@
+/* GStreamer
+ * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
+ * 2000 Wim Taymans <wtay@chello.be>
+ * 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
+ *
+ * gstdeviceproviderfactory.c: GstDeviceProviderFactory object, support routines
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/**
+ * SECTION:gstdeviceproviderfactory
+ * @short_description: Create GstDeviceProviders from a factory
+ * @see_also: #GstDeviceProvider, #GstPlugin, #GstPluginFeature, #GstPadTemplate.
+ *
+ * #GstDeviceProviderFactory is used to create instances of device providers. A
+ * GstDeviceProviderfactory can be added to a #GstPlugin as it is also a
+ * #GstPluginFeature.
+ *
+ * Use the gst_device_provider_factory_find() and
+ * gst_device_provider_factory_create() functions to create device
+ * provider instances or use gst_device_provider_factory_make() as a
+ * convenient shortcut.
+ *
+ * Since: 1.4
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "gst_private.h"
+
+#include "gstdeviceproviderfactory.h"
+#include "gst.h"
+
+#include "glib-compat-private.h"
+
+GST_DEBUG_CATEGORY_STATIC (device_provider_factory_debug);
+#define GST_CAT_DEFAULT device_provider_factory_debug
+
+static void gst_device_provider_factory_finalize (GObject * object);
+static void gst_device_provider_factory_cleanup (GstDeviceProviderFactory *
+ factory);
+
+/* static guint gst_device_provider_factory_signals[LAST_SIGNAL] = { 0 }; */
+
+/* this is defined in gstelement.c */
+extern GQuark __gst_deviceproviderclass_factory;
+
+#define _do_init \
+{ \
+ GST_DEBUG_CATEGORY_INIT (device_provider_factory_debug, "GST_DEVICE_PROVIDER_FACTORY", \
+ GST_DEBUG_BOLD | GST_DEBUG_FG_WHITE | GST_DEBUG_BG_RED, \
+ "device provider factories keep information about installed device providers"); \
+}
+
+G_DEFINE_TYPE_WITH_CODE (GstDeviceProviderFactory, gst_device_provider_factory,
+ GST_TYPE_PLUGIN_FEATURE, _do_init);
+
+static void
+gst_device_provider_factory_class_init (GstDeviceProviderFactoryClass * klass)
+{
+ GObjectClass *gobject_class = (GObjectClass *) klass;
+
+ gobject_class->finalize = gst_device_provider_factory_finalize;
+}
+
+static void
+gst_device_provider_factory_init (GstDeviceProviderFactory * factory)
+{
+}
+
+static void
+gst_device_provider_factory_finalize (GObject * object)
+{
+ GstDeviceProviderFactory *factory = GST_DEVICE_PROVIDER_FACTORY (object);
+ GstDeviceProvider *provider;
+
+ gst_device_provider_factory_cleanup (factory);
+
+ provider = g_atomic_pointer_get (&factory->provider);
+ if (provider)
+ gst_object_unref (provider);
+
+ G_OBJECT_CLASS (gst_device_provider_factory_parent_class)->finalize (object);
+}
+
+/**
+ * gst_device_provider_factory_find:
+ * @name: name of factory to find
+ *
+ * Search for an device provider factory of the given name. Refs the returned
+ * device provider factory; caller is responsible for unreffing.
+ *
+ * Returns: (transfer full) (nullable): #GstDeviceProviderFactory if
+ * found, %NULL otherwise
+ *
+ * Since: 1.4
+ */
+GstDeviceProviderFactory *
+gst_device_provider_factory_find (const gchar * name)
+{
+ GstPluginFeature *feature;
+
+ g_return_val_if_fail (name != NULL, NULL);
+
+ feature = gst_registry_find_feature (gst_registry_get (), name,
+ GST_TYPE_DEVICE_PROVIDER_FACTORY);
+ if (feature)
+ return GST_DEVICE_PROVIDER_FACTORY (feature);
+
+ /* this isn't an error, for instance when you query if an device provider factory is
+ * present */
+ GST_LOG ("no such device provider factory \"%s\"", name);
+
+ return NULL;
+}
+
+static void
+gst_device_provider_factory_cleanup (GstDeviceProviderFactory * factory)
+{
+ if (factory->metadata) {
+ gst_structure_free ((GstStructure *) factory->metadata);
+ factory->metadata = NULL;
+ }
+ if (factory->type) {
+ factory->type = G_TYPE_INVALID;
+ }
+}
+
+#define CHECK_METADATA_FIELD(klass, name, key) \
+ G_STMT_START { \
+ const gchar *metafield = gst_device_provider_class_get_metadata (klass, key); \
+ if (G_UNLIKELY (metafield == NULL || *metafield == '\0')) { \
+ g_warning ("Device provider factory metadata for '%s' has no valid %s field", name, key); \
+ goto detailserror; \
+ } \
+ } G_STMT_END;
+
+/**
+ * gst_device_provider_register:
+ * @plugin: (allow-none): #GstPlugin to register the device provider with, or %NULL for
+ * a static device provider.
+ * @name: name of device providers of this type
+ * @rank: rank of device provider (higher rank means more importance when autoplugging)
+ * @type: GType of device provider to register
+ *
+ * Create a new device providerfactory capable of instantiating objects of the
+ * @type and add the factory to @plugin.
+ *
+ * Returns: %TRUE, if the registering succeeded, %FALSE on error
+ *
+ * Since: 1.4
+ */
+gboolean
+gst_device_provider_register (GstPlugin * plugin, const gchar * name,
+ guint rank, GType type)
+{
+ GstPluginFeature *existing_feature;
+ GstRegistry *registry;
+ GstDeviceProviderFactory *factory;
+ GstDeviceProviderClass *klass;
+
+ g_return_val_if_fail (name != NULL, FALSE);
+ g_return_val_if_fail (g_type_is_a (type, GST_TYPE_DEVICE_PROVIDER), FALSE);
+
+ registry = gst_registry_get ();
+
+ /* check if feature already exists, if it exists there is no need to update it
+ * when the registry is getting updated, outdated plugins and all their
+ * features are removed and readded.
+ */
+ existing_feature = gst_registry_lookup_feature (registry, name);
+ if (existing_feature) {
+ GST_DEBUG_OBJECT (registry, "update existing feature %p (%s)",
+ existing_feature, name);
+ factory = GST_DEVICE_PROVIDER_FACTORY_CAST (existing_feature);
+ factory->type = type;
+ existing_feature->loaded = TRUE;
+ g_type_set_qdata (type, __gst_deviceproviderclass_factory, factory);
+ gst_object_unref (existing_feature);
+ return TRUE;
+ }
+
+ factory =
+ GST_DEVICE_PROVIDER_FACTORY_CAST (g_object_newv
+ (GST_TYPE_DEVICE_PROVIDER_FACTORY, 0, NULL));
+ gst_plugin_feature_set_name (GST_PLUGIN_FEATURE_CAST (factory), name);
+ GST_LOG_OBJECT (factory, "Created new device providerfactory for type %s",
+ g_type_name (type));
+
+ /* provide info needed during class structure setup */
+ g_type_set_qdata (type, __gst_deviceproviderclass_factory, factory);
+ klass = GST_DEVICE_PROVIDER_CLASS (g_type_class_ref (type));
+
+ CHECK_METADATA_FIELD (klass, name, GST_ELEMENT_METADATA_LONGNAME);
+ CHECK_METADATA_FIELD (klass, name, GST_ELEMENT_METADATA_KLASS);
+ CHECK_METADATA_FIELD (klass, name, GST_ELEMENT_METADATA_DESCRIPTION);
+ CHECK_METADATA_FIELD (klass, name, GST_ELEMENT_METADATA_AUTHOR);
+
+ factory->type = type;
+ factory->metadata = gst_structure_copy ((GstStructure *) klass->metadata);
+
+ if (plugin && plugin->desc.name) {
+ GST_PLUGIN_FEATURE_CAST (factory)->plugin_name = plugin->desc.name;
+ GST_PLUGIN_FEATURE_CAST (factory)->plugin = plugin;
+ g_object_add_weak_pointer ((GObject *) plugin,
+ (gpointer *) & GST_PLUGIN_FEATURE_CAST (factory)->plugin);
+ } else {
+ GST_PLUGIN_FEATURE_CAST (factory)->plugin_name = "NULL";
+ GST_PLUGIN_FEATURE_CAST (factory)->plugin = NULL;
+ }
+ gst_plugin_feature_set_rank (GST_PLUGIN_FEATURE_CAST (factory), rank);
+ GST_PLUGIN_FEATURE_CAST (factory)->loaded = TRUE;
+
+ gst_registry_add_feature (registry, GST_PLUGIN_FEATURE_CAST (factory));
+
+ return TRUE;
+
+ /* ERRORS */
+detailserror:
+ {
+ gst_device_provider_factory_cleanup (factory);
+ return FALSE;
+ }
+}
+
+/**
+ * gst_device_provider_factory_get:
+ * @factory: factory to instantiate
+ *
+ * Returns the device provider of the type defined by the given device
+ * providerfactory.
+ *
+ * Returns: (transfer full) (nullable): the #GstDeviceProvider or %NULL
+ * if the device provider couldn't be created
+ *
+ * Since: 1.4
+ */
+GstDeviceProvider *
+gst_device_provider_factory_get (GstDeviceProviderFactory * factory)
+{
+ GstDeviceProvider *device_provider;
+ GstDeviceProviderClass *oclass;
+ GstDeviceProviderFactory *newfactory;
+
+ g_return_val_if_fail (factory != NULL, NULL);
+
+ newfactory =
+ GST_DEVICE_PROVIDER_FACTORY (gst_plugin_feature_load (GST_PLUGIN_FEATURE
+ (factory)));
+
+ if (newfactory == NULL)
+ goto load_failed;
+
+ factory = newfactory;
+
+ GST_INFO ("getting device provider \"%s\"", GST_OBJECT_NAME (factory));
+
+ if (factory->type == 0)
+ goto no_type;
+
+ device_provider = g_atomic_pointer_get (&newfactory->provider);
+ if (device_provider)
+ return gst_object_ref (device_provider);
+
+ /* create an instance of the device provider, cast so we don't assert on NULL
+ * also set name as early as we can
+ */
+ device_provider = GST_DEVICE_PROVIDER_CAST (g_object_newv (factory->type, 0,
+ NULL));
+ if (G_UNLIKELY (device_provider == NULL))
+ goto no_device_provider;
+
+ /* fill in the pointer to the factory in the device provider class. The
+ * class will not be unreffed currently.
+ * Be thread safe as there might be 2 threads creating the first instance of
+ * an device provider at the same moment
+ */
+ oclass = GST_DEVICE_PROVIDER_GET_CLASS (device_provider);
+ if (!g_atomic_pointer_compare_and_exchange (&oclass->factory, NULL, factory))
+ gst_object_unref (factory);
+
+ gst_object_ref_sink (device_provider);
+
+ /* We use an atomic to make sure we don't create two in parallel */
+ if (!g_atomic_pointer_compare_and_exchange (&newfactory->provider, NULL,
+ device_provider)) {
+ gst_object_unref (device_provider);
+
+ device_provider = g_atomic_pointer_get (&newfactory->provider);
+ }
+
+ GST_DEBUG ("created device provider \"%s\"", GST_OBJECT_NAME (factory));
+
+ return gst_object_ref (device_provider);
+
+ /* ERRORS */
+load_failed:
+ {
+ GST_WARNING_OBJECT (factory,
+ "loading plugin containing feature %s returned NULL!",
+ GST_OBJECT_NAME (factory));
+ return NULL;
+ }
+no_type:
+ {
+ GST_WARNING_OBJECT (factory, "factory has no type");
+ gst_object_unref (factory);
+ return NULL;
+ }
+no_device_provider:
+ {
+ GST_WARNING_OBJECT (factory, "could not create device provider");
+ gst_object_unref (factory);
+ return NULL;
+ }
+}
+
+/**
+ * gst_device_provider_factory_get_by_name:
+ * @factoryname: a named factory to instantiate
+ *
+ * Returns the device provider of the type defined by the given device
+ * provider factory.
+ *
+ * Returns: (transfer full) (nullable): a #GstDeviceProvider or %NULL
+ * if unable to create device provider
+ *
+ * Since: 1.4
+ */
+GstDeviceProvider *
+gst_device_provider_factory_get_by_name (const gchar * factoryname)
+{
+ GstDeviceProviderFactory *factory;
+ GstDeviceProvider *device_provider;
+
+ g_return_val_if_fail (factoryname != NULL, NULL);
+ g_return_val_if_fail (gst_is_initialized (), NULL);
+
+ GST_LOG ("gstdeviceproviderfactory: get_by_name \"%s\"", factoryname);
+
+ factory = gst_device_provider_factory_find (factoryname);
+ if (factory == NULL)
+ goto no_factory;
+
+ GST_LOG_OBJECT (factory, "found factory %p", factory);
+ device_provider = gst_device_provider_factory_get (factory);
+ if (device_provider == NULL)
+ goto create_failed;
+
+ gst_object_unref (factory);
+ return device_provider;
+
+ /* ERRORS */
+no_factory:
+ {
+ GST_INFO ("no such device provider factory \"%s\"!", factoryname);
+ return NULL;
+ }
+create_failed:
+ {
+ GST_INFO_OBJECT (factory, "couldn't create instance!");
+ gst_object_unref (factory);
+ return NULL;
+ }
+}
+
+/**
+ * gst_device_provider_factory_get_device_provider_type:
+ * @factory: factory to get managed #GType from
+ *
+ * Get the #GType for device providers managed by this factory. The type can
+ * only be retrieved if the device provider factory is loaded, which can be
+ * assured with gst_plugin_feature_load().
+ *
+ * Returns: the #GType for device providers managed by this factory or 0 if
+ * the factory is not loaded.
+ *
+ * Since: 1.4
+ */
+GType
+gst_device_provider_factory_get_device_provider_type (GstDeviceProviderFactory *
+ factory)
+{
+ g_return_val_if_fail (GST_IS_DEVICE_PROVIDER_FACTORY (factory), 0);
+
+ return factory->type;
+}
+
+/**
+ * gst_device_provider_factory_get_metadata:
+ * @factory: a #GstDeviceProviderFactory
+ * @key: a key
+ *
+ * Get the metadata on @factory with @key.
+ *
+ * Returns: (nullable): the metadata with @key on @factory or %NULL
+ * when there was no metadata with the given @key.
+ *
+ * Since: 1.4
+ */
+const gchar *
+gst_device_provider_factory_get_metadata (GstDeviceProviderFactory * factory,
+ const gchar * key)
+{
+ return gst_structure_get_string ((GstStructure *) factory->metadata, key);
+}
+
+/**
+ * gst_device_provider_factory_get_metadata_keys:
+ * @factory: a #GstDeviceProviderFactory
+ *
+ * Get the available keys for the metadata on @factory.
+ *
+ * Returns: (transfer full) (element-type utf8) (array zero-terminated=1) (nullable):
+ * a %NULL-terminated array of key strings, or %NULL when there is no
+ * metadata. Free with g_strfreev() when no longer needed.
+ *
+ * Since: 1.4
+ */
+gchar **
+gst_device_provider_factory_get_metadata_keys (GstDeviceProviderFactory *
+ factory)
+{
+ GstStructure *metadata;
+ gchar **arr;
+ gint i, num;
+
+ g_return_val_if_fail (GST_IS_DEVICE_PROVIDER_FACTORY (factory), NULL);
+
+ metadata = (GstStructure *) factory->metadata;
+ if (metadata == NULL)
+ return NULL;
+
+ num = gst_structure_n_fields (metadata);
+ if (num == 0)
+ return NULL;
+
+ arr = g_new (gchar *, num + 1);
+ for (i = 0; i < num; ++i) {
+ arr[i] = g_strdup (gst_structure_nth_field_name (metadata, i));
+ }
+ arr[i] = NULL;
+ return arr;
+}
+
+/**
+ * gst_device_provider_factory_has_classesv:
+ * @factory: a #GstDeviceProviderFactory
+ * @classes: (array zero-terminated=1) (allow-none): a %NULL terminated array
+ * of klasses to match, only match if all classes are matched
+ *
+ * Check if @factory matches all of the given classes
+ *
+ * Returns: %TRUE if @factory matches.
+ *
+ * Since: 1.4
+ */
+gboolean
+gst_device_provider_factory_has_classesv (GstDeviceProviderFactory * factory,
+ gchar ** classes)
+{
+ const gchar *klass;
+
+ g_return_val_if_fail (GST_IS_DEVICE_PROVIDER_FACTORY (factory), FALSE);
+
+ klass = gst_device_provider_factory_get_metadata (factory,
+ GST_ELEMENT_METADATA_KLASS);
+
+ if (klass == NULL) {
+ GST_ERROR_OBJECT (factory,
+ "device provider factory is missing klass identifiers");
+ return FALSE;
+ }
+
+ for (; classes != NULL && classes[0] != NULL; classes++) {
+ const gchar *found;
+ guint len;
+
+ if (classes[0] == '\0')
+ continue;
+
+ found = strstr (klass, classes[0]);
+
+ if (!found)
+ return FALSE;
+ if (found != klass && *(found - 1) != '/')
+ return FALSE;
+
+ len = strlen (classes[0]);
+ if (found[len] != 0 && found[len] != '/')
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+/**
+ * gst_device_provider_factory_has_classes:
+ * @factory: a #GstDeviceProviderFactory
+ * @classes: (allow-none): a "/" separate list of klasses to match, only match
+ * if all classes are matched
+ *
+ * Check if @factory matches all of the given @classes
+ *
+ * Returns: %TRUE if @factory matches or if @classes is %NULL.
+ *
+ * Since: 1.4
+ */
+gboolean
+gst_device_provider_factory_has_classes (GstDeviceProviderFactory * factory,
+ const gchar * classes)
+{
+ gchar **classesv;
+ gboolean res;
+
+ if (classes == NULL)
+ return TRUE;
+
+ classesv = g_strsplit (classes, "/", 0);
+
+ res = gst_device_provider_factory_has_classesv (factory, classesv);
+
+ g_strfreev (classesv);
+
+ return res;
+}
+
+static gboolean
+device_provider_filter (GstPluginFeature * feature, GstRank * minrank)
+{
+ /* we only care about device provider factories */
+ if (G_UNLIKELY (!GST_IS_DEVICE_PROVIDER_FACTORY (feature)))
+ return FALSE;
+
+ return (gst_plugin_feature_get_rank (feature) >= *minrank);
+}
+
+/**
+ * gst_device_provider_factory_list_get_device_providers:
+ * @minrank: Minimum rank
+ *
+ * Get a list of factories with a rank greater or equal to @minrank.
+ * The list of factories is returned by decreasing rank.
+ *
+ * Returns: (transfer full) (element-type Gst.DeviceProviderFactory):
+ * a #GList of #GstDeviceProviderFactory device providers. Use
+ * gst_plugin_feature_list_free() after usage.
+ *
+ * Since: 1.4
+ */
+GList *
+gst_device_provider_factory_list_get_device_providers (GstRank minrank)
+{
+ GList *result;
+
+ /* get the feature list using the filter */
+ result = gst_registry_feature_filter (gst_registry_get (),
+ (GstPluginFeatureFilter) device_provider_filter, FALSE, &minrank);
+
+ /* sort on rank and name */
+ result = g_list_sort (result, gst_plugin_feature_rank_compare_func);
+
+ return result;
+}
diff --git a/gst/gstdeviceproviderfactory.h b/gst/gstdeviceproviderfactory.h
new file mode 100644
index 0000000..edda736
--- /dev/null
+++ b/gst/gstdeviceproviderfactory.h
@@ -0,0 +1,90 @@
+/* GStreamer
+ * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
+ * 2000,2004 Wim Taymans <wim@fluendo.com>
+ * 2012 Olivier Crete <olivier.crete@collabora.com>
+ *
+ * gstdeviceproviderfactory.h: Header for GstDeviceProviderFactory
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+
+
+#ifndef __GST_DEVICE_PROVIDER_FACTORY_H__
+#define __GST_DEVICE_PROVIDER_FACTORY_H__
+
+/**
+ * GstDeviceProviderFactory:
+ *
+ * The opaque #GstDeviceProviderFactory data structure.
+ *
+ * Since: 1.4
+ */
+
+/**
+ * GstDeviceProviderFactoryClass:
+ *
+ * The opaque #GstDeviceProviderFactoryClass data structure.
+ *
+ * Since: 1.4
+ */
+typedef struct _GstDeviceProviderFactory GstDeviceProviderFactory;
+typedef struct _GstDeviceProviderFactoryClass GstDeviceProviderFactoryClass;
+
+#include <gst/gstconfig.h>
+#include <gst/gstplugin.h>
+#include <gst/gstpluginfeature.h>
+#include <gst/gstdeviceprovider.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_DEVICE_PROVIDER_FACTORY (gst_device_provider_factory_get_type())
+#define GST_DEVICE_PROVIDER_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DEVICE_PROVIDER_FACTORY,\
+ GstDeviceProviderFactory))
+#define GST_DEVICE_PROVIDER_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DEVICE_PROVIDER_FACTORY,\
+ GstDeviceProviderFactoryClass))
+#define GST_IS_DEVICE_PROVIDER_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DEVICE_PROVIDER_FACTORY))
+#define GST_IS_DEVICE_PROVIDER_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DEVICE_PROVIDER_FACTORY))
+#define GST_DEVICE_PROVIDER_FACTORY_CAST(obj) ((GstDeviceProviderFactory *)(obj))
+
+GType gst_device_provider_factory_get_type (void);
+
+GstDeviceProviderFactory * gst_device_provider_factory_find (const gchar *name);
+
+GType gst_device_provider_factory_get_device_provider_type (GstDeviceProviderFactory *factory);
+
+const gchar * gst_device_provider_factory_get_metadata (GstDeviceProviderFactory *factory, const gchar *key);
+gchar ** gst_device_provider_factory_get_metadata_keys (GstDeviceProviderFactory *factory);
+
+GstDeviceProvider* gst_device_provider_factory_get (GstDeviceProviderFactory *factory) G_GNUC_MALLOC;
+GstDeviceProvider* gst_device_provider_factory_get_by_name (const gchar *factoryname) G_GNUC_MALLOC;
+
+gboolean gst_device_provider_register (GstPlugin *plugin, const gchar *name,
+ guint rank,
+ GType type);
+
+gboolean gst_device_provider_factory_has_classesv (GstDeviceProviderFactory * factory,
+ gchar ** classes);
+
+gboolean gst_device_provider_factory_has_classes (GstDeviceProviderFactory *factory,
+ const gchar * classes);
+
+GList * gst_device_provider_factory_list_get_device_providers (
+ GstRank minrank) G_GNUC_MALLOC;
+
+G_END_DECLS
+
+#endif /* __GST_DEVICE_PROVIDER_FACTORY_H__ */
diff --git a/gst/gstelement.c b/gst/gstelement.c
index 25870f5..3fbe7fe 100644
--- a/gst/gstelement.c
+++ b/gst/gstelement.c
@@ -342,8 +342,8 @@ gst_element_release_request_pad (GstElement * element, GstPad * pad)
* <note>An element is only required to provide a clock in the PAUSED
* state. Some elements can provide a clock in other states.</note>
*
- * Returns: (transfer full): the GstClock provided by the element or %NULL
- * if no clock could be provided. Unref after usage.
+ * Returns: (transfer full) (nullable): the GstClock provided by the
+ * element or %NULL if no clock could be provided. Unref after usage.
*
* MT safe.
*/
@@ -583,8 +583,8 @@ gst_element_set_index (GstElement * element, GstIndex * index)
*
* Gets the index from the element.
*
- * Returns: (transfer full): a #GstIndex or %NULL when no index was set on the
- * element. unref after usage.
+ * Returns: (transfer full) (nullable): a #GstIndex or %NULL when no
+ * index was set on the element. unref after usage.
*
* MT safe.
*/
@@ -865,8 +865,8 @@ pad_compare_name (GstPad * pad1, const gchar * name)
* Retrieves a pad from @element by name. This version only retrieves
* already-existing (i.e. 'static') pads.
*
- * Returns: (transfer full): the requested #GstPad if found, otherwise %NULL.
- * unref after usage.
+ * Returns: (transfer full) (nullable): the requested #GstPad if
+ * found, otherwise %NULL. unref after usage.
*
* MT safe.
*/
@@ -978,8 +978,8 @@ _gst_element_request_pad (GstElement * element, GstPadTemplate * templ,
* This method is slow and will be deprecated in the future. New code should
* use gst_element_request_pad() with the requested template.
*
- * Returns: (transfer full): requested #GstPad if found, otherwise %NULL.
- * Release after usage.
+ * Returns: (transfer full) (nullable): requested #GstPad if found,
+ * otherwise %NULL. Release after usage.
*/
GstPad *
gst_element_get_request_pad (GstElement * element, const gchar * name)
@@ -1083,8 +1083,8 @@ gst_element_get_request_pad (GstElement * element, const gchar * name)
*
* The pad should be released with gst_element_release_request_pad().
*
- * Returns: (transfer full): requested #GstPad if found, otherwise %NULL.
- * Release after usage.
+ * Returns: (transfer full) (nullable): requested #GstPad if found,
+ * otherwise %NULL. Release after usage.
*/
GstPad *
gst_element_request_pad (GstElement * element,
@@ -1396,8 +1396,9 @@ gst_element_class_get_pad_template_list (GstElementClass * element_class)
* that has subclasses, make sure to pass the g_class parameter of the
* #GInstanceInitFunc here.</note>
*
- * Returns: (transfer none): the #GstPadTemplate with the given name, or %NULL
- * if none was found. No unreferencing is necessary.
+ * Returns: (transfer none) (nullable): the #GstPadTemplate with the
+ * given name, or %NULL if none was found. No unreferencing is
+ * necessary.
*/
GstPadTemplate *
gst_element_class_get_pad_template (GstElementClass *
@@ -1730,12 +1731,12 @@ gst_element_post_message (GstElement * element, GstMessage * message)
/**
* _gst_element_error_printf:
- * @format: the printf-like format to use, or %NULL
+ * @format: (allow-none): the printf-like format to use, or %NULL
*
* This function is only used internally by the gst_element_error() macro.
*
- * Returns: (transfer full): a newly allocated string, or %NULL if the format
- * was %NULL or ""
+ * Returns: (transfer full) (nullable): a newly allocated string, or
+ * %NULL if the format was %NULL or ""
*
* MT safe.
*/
diff --git a/gst/gstelement.h b/gst/gstelement.h
index 408d10c..bdd7215 100644
--- a/gst/gstelement.h
+++ b/gst/gstelement.h
@@ -694,7 +694,8 @@ GType gst_element_get_type (void);
* For a nameless element, this returns %NULL, which you can safely g_free()
* as well.
*
- * Returns: (transfer full): the name of @elem. g_free() after usage. MT safe.
+ * Returns: (transfer full) (nullable): the name of @elem. g_free()
+ * after usage. MT safe.
*
*/
#define gst_element_get_name(elem) gst_object_get_name(GST_OBJECT_CAST(elem))
diff --git a/gst/gstelementfactory.c b/gst/gstelementfactory.c
index aa0c5af..b1f737b 100644
--- a/gst/gstelementfactory.c
+++ b/gst/gstelementfactory.c
@@ -123,7 +123,8 @@ gst_element_factory_finalize (GObject * object)
* Search for an element factory of the given name. Refs the returned
* element factory; caller is responsible for unreffing.
*
- * Returns: (transfer full): #GstElementFactory if found, %NULL otherwise
+ * Returns: (transfer full) (nullable): #GstElementFactory if found,
+ * %NULL otherwise
*/
GstElementFactory *
gst_element_factory_find (const gchar * name)
@@ -335,8 +336,8 @@ detailserror:
* It will be given the name supplied, since all elements require a name as
* their first argument.
*
- * Returns: (transfer floating): new #GstElement or %NULL if the element couldn't
- * be created
+ * Returns: (transfer floating) (nullable): new #GstElement or %NULL
+ * if the element couldn't be created
*/
GstElement *
gst_element_factory_create (GstElementFactory * factory, const gchar * name)
@@ -422,7 +423,8 @@ no_element:
* consisting of the element factory name and a number.
* If name is given, it will be given the name supplied.
*
- * Returns: (transfer floating): new #GstElement or %NULL if unable to create element
+ * Returns: (transfer floating) (nullable): new #GstElement or %NULL
+ * if unable to create element
*/
GstElement *
gst_element_factory_make (const gchar * factoryname, const gchar * name)
@@ -500,8 +502,8 @@ gst_element_factory_get_element_type (GstElementFactory * factory)
*
* Get the metadata on @factory with @key.
*
- * Returns: the metadata with @key on @factory or %NULL when there was no
- * metadata with the given @key.
+ * Returns: (nullable): the metadata with @key on @factory or %NULL
+ * when there was no metadata with the given @key.
*/
const gchar *
gst_element_factory_get_metadata (GstElementFactory * factory,
@@ -516,7 +518,7 @@ gst_element_factory_get_metadata (GstElementFactory * factory,
*
* Get the available keys for the metadata on @factory.
*
- * Returns: (transfer full) (element-type utf8) (array zero-terminated=1):
+ * Returns: (transfer full) (element-type utf8) (array zero-terminated=1) (nullable):
* a %NULL-terminated array of key strings, or %NULL when there is no
* metadata. Free with g_strfreev() when no longer needed.
*/
diff --git a/gst/gstevent.h b/gst/gstevent.h
index 2ee38eb..db3cb51 100644
--- a/gst/gstevent.h
+++ b/gst/gstevent.h
@@ -275,8 +275,8 @@ GST_EXPORT GType _gst_event_type;
#define gst_event_make_writable(ev) GST_EVENT_CAST (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST (ev)))
/**
* gst_event_replace:
- * @old_event: (inout) (transfer full): pointer to a pointer to a #GstEvent
- * to be replaced.
+ * @old_event: (inout) (transfer full) (nullable): pointer to a
+ * pointer to a #GstEvent to be replaced.
* @new_event: (allow-none) (transfer none): pointer to a #GstEvent that will
* replace the event pointed to by @old_event.
*
@@ -301,8 +301,8 @@ gst_event_replace (GstEvent **old_event, GstEvent *new_event)
/**
* gst_event_steal:
- * @old_event: (inout) (transfer full): pointer to a pointer to a #GstEvent
- * to be stolen.
+ * @old_event: (inout) (transfer full) (nullable): pointer to a
+ * pointer to a #GstEvent to be stolen.
*
* Atomically replace the #GstEvent pointed to by @old_event with %NULL and
* return the original event.
@@ -321,8 +321,8 @@ gst_event_steal (GstEvent **old_event)
/**
* gst_event_take:
- * @old_event: (inout) (transfer full): pointer to a pointer to a #GstEvent
- * to be stolen.
+ * @old_event: (inout) (transfer full) (nullable): pointer to a
+ * pointer to a #GstEvent to be stolen.
* @new_event: (allow-none) (transfer full): pointer to a #GstEvent that will
* replace the event pointed to by @old_event.
*
diff --git a/gst/gstformat.c b/gst/gstformat.c
index 69600cd..aeae6c6 100644
--- a/gst/gstformat.c
+++ b/gst/gstformat.c
@@ -85,8 +85,8 @@ _priv_gst_format_initialize (void)
*
* Get a printable name for the given format. Do not modify or free.
*
- * Returns: a reference to the static name of the format or %NULL if
- * the format is unknown.
+ * Returns: (nullable): a reference to the static name of the format
+ * or %NULL if the format is unknown.
*/
const gchar *
gst_format_get_name (GstFormat format)
@@ -225,7 +225,8 @@ gst_formats_contains (const GstFormat * formats, GstFormat format)
*
* Get details about the given format.
*
- * Returns: The #GstFormatDefinition for @format or %NULL on failure.
+ * Returns: (nullable): The #GstFormatDefinition for @format or %NULL
+ * on failure.
*
* MT safe.
*/
diff --git a/gst/gstghostpad.c b/gst/gstghostpad.c
index cac0d51..082aa15 100644
--- a/gst/gstghostpad.c
+++ b/gst/gstghostpad.c
@@ -79,8 +79,8 @@ static GstPad *gst_proxy_pad_get_target (GstPad * pad);
*
* Invoke the default iterate internal links function of the proxy pad.
*
- * Returns: a #GstIterator of #GstPad, or %NULL if @pad has no parent. Unref each
- * returned pad with gst_object_unref().
+ * Returns: (nullable): a #GstIterator of #GstPad, or %NULL if @pad
+ * has no parent. Unref each returned pad with gst_object_unref().
*/
GstIterator *
gst_proxy_pad_iterate_internal_links_default (GstPad * pad, GstObject * parent)
@@ -208,8 +208,8 @@ gst_proxy_pad_get_target (GstPad * pad)
* The internal pad of a #GstGhostPad is the internally used
* pad of opposite direction, which is used to link to the target.
*
- * Returns: (transfer full): the target #GstProxyPad, can be %NULL.
- * Unref target pad after usage.
+ * Returns: (transfer full) (nullable): the target #GstProxyPad, can
+ * be %NULL. Unref target pad after usage.
*/
GstProxyPad *
gst_proxy_pad_get_internal (GstProxyPad * pad)
@@ -653,7 +653,8 @@ construct_failed:
*
* The created ghostpad will not have a padtemplate.
*
- * Returns: (transfer full): a new #GstPad, or %NULL in case of an error.
+ * Returns: (transfer full) (nullable): a new #GstPad, or %NULL in
+ * case of an error.
*/
GstPad *
gst_ghost_pad_new_no_target (const gchar * name, GstPadDirection dir)
@@ -679,7 +680,8 @@ gst_ghost_pad_new_no_target (const gchar * name, GstPadDirection dir)
*
* Will ref the target.
*
- * Returns: (transfer floating): a new #GstPad, or %NULL in case of an error.
+ * Returns: (transfer floating) (nullable): a new #GstPad, or %NULL in
+ * case of an error.
*/
GstPad *
gst_ghost_pad_new (const gchar * name, GstPad * target)
@@ -719,7 +721,8 @@ set_target_failed:
*
* Will ref the target.
*
- * Returns: (transfer full): a new #GstPad, or %NULL in case of an error.
+ * Returns: (transfer full) (nullable): a new #GstPad, or %NULL in
+ * case of an error.
*/
GstPad *
@@ -761,7 +764,8 @@ set_target_failed:
* Create a new ghostpad based on @templ, without setting a target. The
* direction will be taken from the @templ.
*
- * Returns: (transfer full): a new #GstPad, or %NULL in case of an error.
+ * Returns: (transfer full) (nullable): a new #GstPad, or %NULL in
+ * case of an error.
*/
GstPad *
gst_ghost_pad_new_no_target_from_template (const gchar * name,
@@ -783,8 +787,9 @@ gst_ghost_pad_new_no_target_from_template (const gchar * name,
*
* Get the target pad of @gpad. Unref target pad after usage.
*
- * Returns: (transfer full): the target #GstPad, can be %NULL if the ghostpad
- * has no target set. Unref target pad after usage.
+ * Returns: (transfer full) (nullable): the target #GstPad, can be
+ * %NULL if the ghostpad has no target set. Unref target pad after
+ * usage.
*/
GstPad *
gst_ghost_pad_get_target (GstGhostPad * gpad)
diff --git a/gst/gstglobaldevicemonitor.c b/gst/gstglobaldevicemonitor.c
deleted file mode 100644
index 68900ef..0000000
--- a/gst/gstglobaldevicemonitor.c
+++ /dev/null
@@ -1,501 +0,0 @@
-/* GStreamer
- * Copyright (C) 2013 Olivier Crete <olivier.crete@collabora.com>
- *
- * gstglobaldevicemonitor.c: Global device monitor
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:gstglobaldevicemonitor
- * @short_description: A global device monitor and prober
- * @see_also: #GstDevice, #GstDeviceMonitor
- *
- * Applications should create a #GstGlobalDeviceMonitor when they want
- * to probe, list and monitor devices of a specific type. The
- * #GstGlobalDeviceMonitor will create the appropriate
- * #GstDeviceMonitor objects and manage them. It will then post
- * messages on its #GstBus for devices that have been added and
- * removed.
- *
- * Since: 1.4
- */
-
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gst_private.h"
-#include "gstglobaldevicemonitor.h"
-
-struct _GstGlobalDeviceMonitorPrivate
-{
- gboolean started;
-
- GstBus *bus;
-
- GPtrArray *monitors;
- guint cookie;
-
- GstCaps *caps;
- gchar *classes;
-};
-
-
-G_DEFINE_TYPE (GstGlobalDeviceMonitor, gst_global_device_monitor,
- GST_TYPE_OBJECT);
-
-static void gst_global_device_monitor_dispose (GObject * object);
-
-static void
-gst_global_device_monitor_class_init (GstGlobalDeviceMonitorClass * klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- g_type_class_add_private (klass, sizeof (GstGlobalDeviceMonitorPrivate));
-
- object_class->dispose = gst_global_device_monitor_dispose;
-}
-
-static void
-bus_sync_message (GstBus * bus, GstMessage * message,
- GstGlobalDeviceMonitor * monitor)
-{
- GstMessageType type = GST_MESSAGE_TYPE (message);
-
- if (type == GST_MESSAGE_DEVICE_ADDED || type == GST_MESSAGE_DEVICE_REMOVED) {
- gboolean matches;
- GstCaps *caps;
- GstDevice *device;
-
- if (type == GST_MESSAGE_DEVICE_ADDED)
- gst_message_parse_device_added (message, &device);
- else
- gst_message_parse_device_removed (message, &device);
-
- GST_OBJECT_LOCK (monitor);
- caps = gst_device_get_caps (device);
- matches = gst_caps_can_intersect (monitor->priv->caps, caps) &&
- gst_device_has_classes (device, monitor->priv->classes);
- gst_caps_unref (caps);
- GST_OBJECT_UNLOCK (monitor);
-
- if (matches)
- gst_bus_post (monitor->priv->bus, gst_message_ref (message));
- }
-}
-
-
-static void
-gst_global_device_monitor_init (GstGlobalDeviceMonitor * self)
-{
- GList *factories;
-
- self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
- GST_TYPE_GLOBAL_DEVICE_MONITOR, GstGlobalDeviceMonitorPrivate);
-
- self->priv->bus = gst_bus_new ();
- gst_bus_set_flushing (self->priv->bus, TRUE);
-
- self->priv->monitors = g_ptr_array_new ();
- self->priv->caps = gst_caps_new_any ();
- self->priv->classes = g_strdup ("");
-
- factories =
- gst_device_monitor_factory_list_get_device_monitors (self->priv->classes,
- 1);
-
- while (factories) {
- GstDeviceMonitorFactory *factory = factories->data;
- GstDeviceMonitor *monitor;
-
- factories = g_list_remove (factories, factory);
-
- monitor = gst_device_monitor_factory_get (factory);
- if (monitor) {
- GstBus *bus = gst_device_monitor_get_bus (monitor);
-
- gst_bus_enable_sync_message_emission (bus);
- g_signal_connect (bus, "sync-message",
- G_CALLBACK (bus_sync_message), self);
- g_ptr_array_add (self->priv->monitors, monitor);
- }
-
- gst_object_unref (factory);
- }
-}
-
-
-static void
-gst_global_device_monitor_remove (GstGlobalDeviceMonitor * self, guint i)
-{
- GstDeviceMonitor *monitor = g_ptr_array_index (self->priv->monitors, i);
- GstBus *bus;
-
- g_ptr_array_remove_index_fast (self->priv->monitors, i);
-
- bus = gst_device_monitor_get_bus (monitor);
- g_signal_handlers_disconnect_by_func (bus, bus_sync_message, self);
- gst_object_unref (bus);
-
- gst_object_unref (monitor);
-}
-
-static void
-gst_global_device_monitor_dispose (GObject * object)
-{
- GstGlobalDeviceMonitor *self = GST_GLOBAL_DEVICE_MONITOR (object);
-
- g_return_if_fail (self->priv->started == FALSE);
-
- if (self->priv->monitors) {
- while (self->priv->monitors->len)
- gst_global_device_monitor_remove (self, self->priv->monitors->len - 1);
- g_ptr_array_unref (self->priv->monitors);
- self->priv->monitors = NULL;
- }
-
- gst_caps_replace (&self->priv->caps, NULL);
- g_free (self->priv->classes);
- gst_object_replace ((GstObject **) & self->priv->bus, NULL);
-
- G_OBJECT_CLASS (gst_global_device_monitor_parent_class)->dispose (object);
-}
-
-/**
- * gst_global_device_monitor_get_devices:
- * @monitor: A #GstDeviceMonitor
- *
- * Gets a list of devices from all of the relevant monitors. This may actually
- * probe the hardware if the global monitor is not currently started.
- *
- * Returns: (transfer full) (element-type GstDevice): a #GList of
- * #GstDevice
- *
- * Since: 1.4
- */
-
-GList *
-gst_global_device_monitor_get_devices (GstGlobalDeviceMonitor * monitor)
-{
- GList *devices = NULL;
- guint i;
- guint cookie;
-
- g_return_val_if_fail (GST_IS_GLOBAL_DEVICE_MONITOR (monitor), NULL);
-
- GST_OBJECT_LOCK (monitor);
-
-again:
-
- g_list_free_full (devices, gst_object_unref);
- devices = NULL;
-
- cookie = monitor->priv->cookie;
-
- for (i = 0; i < monitor->priv->monitors->len; i++) {
- GList *tmpdev;
- GstDeviceMonitor *device_monitor =
- gst_object_ref (g_ptr_array_index (monitor->priv->monitors, i));
- GList *item;
-
- GST_OBJECT_UNLOCK (monitor);
-
- tmpdev = gst_device_monitor_get_devices (device_monitor);
-
- for (item = tmpdev; item; item = item->next) {
- GstDevice *dev = GST_DEVICE (item->data);
- GstCaps *caps = gst_device_get_caps (dev);
-
- if (gst_caps_can_intersect (monitor->priv->caps, caps) &&
- gst_device_has_classes (dev, monitor->priv->classes))
- devices = g_list_prepend (devices, gst_object_ref (dev));
- gst_caps_unref (caps);
- }
-
- g_list_free_full (tmpdev, gst_object_unref);
- gst_object_unref (device_monitor);
-
- GST_OBJECT_LOCK (monitor);
-
- if (monitor->priv->cookie != cookie)
- goto again;
- }
-
- GST_OBJECT_UNLOCK (monitor);
-
- return devices;
-}
-
-/**
- * gst_global_device_monitor_start:
- * @monitor: A #GstGlobalDeviceMonitor
- *
- * Starts monitoring the devices, one this has succeeded, the
- * %GST_MESSAGE_DEVICE_ADDED and %GST_MESSAGE_DEVICE_REMOVED messages
- * will be emitted on the bus when the list of devices changes.
- *
- * Returns: %TRUE if the device monitoring could be started
- *
- * Since: 1.4
- */
-
-gboolean
-gst_global_device_monitor_start (GstGlobalDeviceMonitor * monitor)
-{
- guint i;
-
- g_return_val_if_fail (GST_IS_GLOBAL_DEVICE_MONITOR (monitor), FALSE);
-
- GST_OBJECT_LOCK (monitor);
-
- if (monitor->priv->monitors->len == 0) {
- GST_OBJECT_UNLOCK (monitor);
- return FALSE;
- }
-
- gst_bus_set_flushing (monitor->priv->bus, FALSE);
-
- for (i = 0; i < monitor->priv->monitors->len; i++) {
- if (!gst_device_monitor_start (g_ptr_array_index (monitor->priv->monitors,
- i))) {
- gst_bus_set_flushing (monitor->priv->bus, TRUE);
-
- for (; i != 0; i--)
- gst_device_monitor_stop (g_ptr_array_index (monitor->priv->monitors,
- i - 1));
-
- GST_OBJECT_UNLOCK (monitor);
- return FALSE;
- }
- }
-
- monitor->priv->started = TRUE;
- GST_OBJECT_UNLOCK (monitor);
-
- return TRUE;
-}
-
-/**
- * gst_global_device_monitor_stop:
- * @monitor: A #GstDeviceMonitor
- *
- * Stops monitoring the devices.
- *
- * Since: 1.4
- */
-void
-gst_global_device_monitor_stop (GstGlobalDeviceMonitor * monitor)
-{
- guint i;
-
- g_return_if_fail (GST_IS_GLOBAL_DEVICE_MONITOR (monitor));
-
- gst_bus_set_flushing (monitor->priv->bus, TRUE);
-
- GST_OBJECT_LOCK (monitor);
- for (i = 0; i < monitor->priv->monitors->len; i++)
- gst_device_monitor_stop (g_ptr_array_index (monitor->priv->monitors, i));
- monitor->priv->started = FALSE;
- GST_OBJECT_UNLOCK (monitor);
-
-}
-
-/**
- * gst_global_device_monitor_set_classes_filter:
- * @monitor: the global device monitor
- * @classes: device classes to use as filter
- *
- * Filter devices monitored by device class, e.g. in case you are only
- * interested in a certain type of device like audio devices or
- * video sources.
- *
- * Since: 1.4
- */
-void
-gst_global_device_monitor_set_classes_filter (GstGlobalDeviceMonitor * monitor,
- const gchar * classes)
-{
- GList *factories = NULL;
- guint i;
-
- g_return_if_fail (GST_IS_GLOBAL_DEVICE_MONITOR (monitor));
- g_return_if_fail (!monitor->priv->started);
-
- GST_OBJECT_LOCK (monitor);
- if (!strcmp (monitor->priv->classes, classes)) {
- GST_OBJECT_UNLOCK (monitor);
- return;
- }
-
- g_free (monitor->priv->classes);
- monitor->priv->classes = g_strdup (classes);
-
- factories = gst_device_monitor_factory_list_get_device_monitors (classes, 1);
-
- for (i = 0; i < monitor->priv->monitors->len; i++) {
- GstDeviceMonitor *dev_monitor;
- GstDeviceMonitorFactory *f;
- GList *item;
-
- dev_monitor = g_ptr_array_index (monitor->priv->monitors, i);
- f = gst_device_monitor_get_factory (dev_monitor);
-
- item = g_list_find (factories, f);
-
- if (item) {
- /* If the item is in our list, then remove it from the list of factories,
- * we don't have it to re-create it later
- */
- factories = g_list_remove_link (factories, item);
- gst_object_unref (f);
- } else {
- /* If it's not in our list, them remove it from the list of monitors.
- */
-
- monitor->priv->cookie++;
- gst_global_device_monitor_remove (monitor, i);
- i--;
- }
- }
-
- while (factories) {
- GstDeviceMonitorFactory *factory = factories->data;
- GstDeviceMonitor *device_monitor;
-
- factories = g_list_remove (factories, factory);
-
- device_monitor = gst_device_monitor_factory_get (factory);
- if (device_monitor) {
- GstBus *bus = gst_device_monitor_get_bus (device_monitor);
-
- gst_bus_enable_sync_message_emission (bus);
- g_signal_connect (bus, "sync-message",
- G_CALLBACK (bus_sync_message), monitor);
- gst_object_unref (bus);
- g_ptr_array_add (monitor->priv->monitors, device_monitor);
- monitor->priv->cookie++;
- }
-
- gst_object_unref (factory);
- }
-
- GST_OBJECT_UNLOCK (monitor);
-}
-
-/**
- * gst_global_device_monitor_get_classes_filter:
- * @monitor: the global device monitor
- *
- * Return the type (device classes) filter active for device filtering.
- *
- * Returns: string of device classes that are being filtered.
- *
- * Since: 1.4
- */
-gchar *
-gst_global_device_monitor_get_classes_filter (GstGlobalDeviceMonitor * monitor)
-{
- gchar *res;
-
- g_return_val_if_fail (GST_IS_GLOBAL_DEVICE_MONITOR (monitor), 0);
-
- GST_OBJECT_LOCK (monitor);
- res = g_strdup (monitor->priv->classes);
- GST_OBJECT_UNLOCK (monitor);
-
- return res;
-}
-
-/**
- * gst_global_device_monitor_set_caps_filter:
- * @monitor: the global device monitor
- * @caps: caps to filter
- *
- * Set caps to use as filter for devices. By default ANY caps are used,
- * meaning no caps filter is active.
- *
- * Since: 1.4
- */
-void
-gst_global_device_monitor_set_caps_filter (GstGlobalDeviceMonitor * monitor,
- GstCaps * caps)
-{
- g_return_if_fail (GST_IS_GLOBAL_DEVICE_MONITOR (monitor));
- g_return_if_fail (GST_IS_CAPS (caps));
-
- GST_OBJECT_LOCK (monitor);
- gst_caps_replace (&monitor->priv->caps, caps);
- GST_OBJECT_UNLOCK (monitor);
-}
-
-/**
- * gst_global_device_monitor_get_caps_filter:
- * @monitor: a global device monitor
- *
- * Get the #GstCaps filter set by gst_global_device_monitor_set_caps_filter().
- *
- * Returns: (transfer full): the filter caps that are active (or ANY caps)
- *
- * Since: 1.4
- */
-GstCaps *
-gst_global_device_monitor_get_caps_filter (GstGlobalDeviceMonitor * monitor)
-{
- GstCaps *res;
-
- g_return_val_if_fail (GST_IS_GLOBAL_DEVICE_MONITOR (monitor), NULL);
-
- GST_OBJECT_LOCK (monitor);
- res = gst_caps_ref (monitor->priv->caps);
- GST_OBJECT_UNLOCK (monitor);
-
- return res;
-}
-
-/**
- * gst_global_device_monitor_new:
- *
- * Create a new #GstGlobalDeviceMonitor
- *
- * Returns: (transfer full): a new global device monitor.
- *
- * Since: 1.4
- */
-GstGlobalDeviceMonitor *
-gst_global_device_monitor_new (void)
-{
- return g_object_new (GST_TYPE_GLOBAL_DEVICE_MONITOR, NULL);
-}
-
-/**
- * gst_global_device_monitor_get_bus:
- * @monitor: a #GstDeviceMonitor
- *
- * Gets the #GstBus of this #GstGlobalDeviceMonitor
- *
- * Returns: (transfer full): a #GstBus
- *
- * Since: 1.4
- */
-GstBus *
-gst_global_device_monitor_get_bus (GstGlobalDeviceMonitor * monitor)
-{
- g_return_val_if_fail (GST_IS_GLOBAL_DEVICE_MONITOR (monitor), NULL);
-
- return gst_object_ref (monitor->priv->bus);
-}
diff --git a/gst/gstglobaldevicemonitor.h b/gst/gstglobaldevicemonitor.h
deleted file mode 100644
index b92fd40..0000000
--- a/gst/gstglobaldevicemonitor.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/* GStreamer
- * Copyright (C) 2013 Olivier Crete <olivier.crete@collabora.com>
- *
- * gstglobaldevicemonitor.c: Global device monitor
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-
-#ifndef __GST_GLOBAL_DEVICE_MONITOR_H__
-#define __GST_GLOBAL_DEVICE_MONITOR_H__
-
-#include <gst/gstobject.h>
-#include <gst/gstdevice.h>
-#include <gst/gstdevicemonitor.h>
-#include <gst/gstdevicemonitorfactory.h>
-
-G_BEGIN_DECLS
-
-typedef struct _GstGlobalDeviceMonitor GstGlobalDeviceMonitor;
-typedef struct _GstGlobalDeviceMonitorPrivate GstGlobalDeviceMonitorPrivate;
-typedef struct _GstGlobalDeviceMonitorClass GstGlobalDeviceMonitorClass;
-
-#define GST_TYPE_GLOBAL_DEVICE_MONITOR (gst_global_device_monitor_get_type())
-#define GST_IS_GLOBAL_DEVICE_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_GLOBAL_DEVICE_MONITOR))
-#define GST_IS_GLOBAL_DEVICE_MONITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_GLOBAL_DEVICE_MONITOR))
-#define GST_GLOBAL_DEVICE_MONITOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_GLOBAL_DEVICE_MONITOR, GstGlobalDeviceMonitorClass))
-#define GST_GLOBAL_DEVICE_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_GLOBAL_DEVICE_MONITOR, GstGlobalDeviceMonitor))
-#define GST_GLOBAL_DEVICE_MONITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_GLOBAL_DEVICE_MONITOR, GstGlobalDeviceMonitorClass))
-#define GST_GLOBAL_DEVICE_MONITOR_CAST(obj) ((GstGlobalDeviceMonitor *)(obj))
-
-/**
- * GstGlobalDeviceMonitor:
- * @parent: the parent #GstObject structure
- *
- * Opaque global device monitor object structure.
- *
- * Since: 1.4
- */
-struct _GstGlobalDeviceMonitor {
- GstObject parent;
-
- /*< private >*/
-
- GstGlobalDeviceMonitorPrivate *priv;
-
- gpointer _gst_reserved[GST_PADDING];
-};
-
-/**
- * GstGlobalDeviceMonitorClass:
- * @parent_class: the parent #GstObjectClass structure
- *
- * Opaque global device monitor class structure.
- *
- * Since: 1.4
- */
-struct _GstGlobalDeviceMonitorClass {
- GstObjectClass parent_class;
-
- /*< private >*/
- gpointer _gst_reserved[GST_PADDING];
-};
-
-GType gst_global_device_monitor_get_type (void);
-
-GstGlobalDeviceMonitor * gst_global_device_monitor_new (void);
-
-GstBus * gst_global_device_monitor_get_bus (GstGlobalDeviceMonitor * monitor);
-
-GList * gst_global_device_monitor_get_devices (GstGlobalDeviceMonitor * monitor);
-
-
-gboolean gst_global_device_monitor_start (GstGlobalDeviceMonitor * monitor);
-
-void gst_global_device_monitor_stop (GstGlobalDeviceMonitor * monitor);
-
-
-void gst_global_device_monitor_set_classes_filter (GstGlobalDeviceMonitor * monitor,
- const gchar * classes);
-
-gchar * gst_global_device_monitor_get_classes_filter (GstGlobalDeviceMonitor * monitor);
-
-
-void gst_global_device_monitor_set_caps_filter (GstGlobalDeviceMonitor * monitor,
- GstCaps * caps);
-
-GstCaps * gst_global_device_monitor_get_caps_filter (GstGlobalDeviceMonitor * monitor);
-
-G_END_DECLS
-
-#endif /* __GST_GLOBAL_DEVICE_MONITOR_H__ */
diff --git a/gst/gstinfo.h b/gst/gstinfo.h
index 319e841..5c802bd 100644
--- a/gst/gstinfo.h
+++ b/gst/gstinfo.h
@@ -197,7 +197,7 @@ struct _GstDebugCategory {
/**
* GST_STR_NULL:
- * @str: The string to check.
+ * @str: (allow-none): The string to check.
*
* Macro to use when a string must not be %NULL, but may be %NULL. If the string
* is %NULL, "(NULL)" is printed instead.
diff --git a/gst/gstmemory.c b/gst/gstmemory.c
index c29fccd..9e97d1e 100644
--- a/gst/gstmemory.c
+++ b/gst/gstmemory.c
@@ -225,8 +225,8 @@ gst_memory_resize (GstMemory * mem, gssize offset, gsize size)
* This function takes ownership of old @mem and returns a reference to a new
* #GstMemory.
*
- * Returns: (transfer full): a #GstMemory object mapped with @flags or %NULL when
- * a mapping is not possible.
+ * Returns: (transfer full) (nullable): a #GstMemory object mapped
+ * with @flags or %NULL when a mapping is not possible.
*/
GstMemory *
gst_memory_make_mapped (GstMemory * mem, GstMapInfo * info, GstMapFlags flags)
diff --git a/gst/gstmessage.c b/gst/gstmessage.c
index 5014016..f4b3ded 100644
--- a/gst/gstmessage.c
+++ b/gst/gstmessage.c
@@ -256,8 +256,8 @@ gst_message_init (GstMessageImpl * message, GstMessageType type,
* gst_message_new_custom:
* @type: The #GstMessageType to distinguish messages
* @src: The object originating the message.
- * @structure: (transfer full): the structure for the message. The message
- * will take ownership of the structure.
+ * @structure: (transfer full) (allow-none): the structure for the
+ * message. The message will take ownership of the structure.
*
* Create a new custom-typed message. This can be used for anything not
* handled by other message-specific functions to pass a message to the
@@ -779,14 +779,16 @@ gst_message_new_segment_done (GstObject * src, GstFormat format,
GstMessage *
gst_message_new_application (GstObject * src, GstStructure * structure)
{
+ g_return_val_if_fail (structure != NULL, NULL);
+
return gst_message_new_custom (GST_MESSAGE_APPLICATION, src, structure);
}
/**
* gst_message_new_element:
* @src: (transfer none): The object originating the message.
- * @structure: (transfer full): The structure for the message. The message
- * will take ownership of the structure.
+ * @structure: (transfer full): The structure for the
+ * message. The message will take ownership of the structure.
*
* Create a new element-specific message. This is meant as a generic way of
* allowing one-way communication from an element to an application, for example
@@ -800,6 +802,8 @@ gst_message_new_application (GstObject * src, GstStructure * structure)
GstMessage *
gst_message_new_element (GstObject * src, GstStructure * structure)
{
+ g_return_val_if_fail (structure != NULL, NULL);
+
return gst_message_new_custom (GST_MESSAGE_ELEMENT, src, structure);
}
@@ -2336,7 +2340,7 @@ gst_message_parse_have_context (GstMessage * message, GstContext ** context)
* @device: (transfer none): The new #GstDevice
*
* Creates a new device-added message. The device-added message is produced by
- * #GstDeviceMonitor or a #GstGlobalDeviceMonitor. They announce the appearance
+ * #GstDeviceProvider or a #GstlDeviceMonitor. They announce the appearance
* of monitored devices.
*
* Returns: a newly allocated #GstMessage
@@ -2366,7 +2370,7 @@ gst_message_new_device_added (GstObject * src, GstDevice * device)
* pointer to the new #GstDevice, or %NULL
*
* Parses a device-added message. The device-added message is produced by
- * #GstDeviceMonitor or a #GstGlobalDeviceMonitor. It announces the appearance
+ * #GstDeviceProvider or a #GstDeviceMonitor. It announces the appearance
* of monitored devices.
*
* Since: 1.4
@@ -2388,7 +2392,7 @@ gst_message_parse_device_added (GstMessage * message, GstDevice ** device)
* @device: (transfer none): The removed #GstDevice
*
* Creates a new device-removed message. The device-removed message is produced
- * by #GstDeviceMonitor or a #GstGlobalDeviceMonitor. They announce the
+ * by #GstDeviceProvider or a #GstDeviceMonitor. They announce the
* disappearance of monitored devices.
*
* Returns: a newly allocated #GstMessage
@@ -2418,7 +2422,7 @@ gst_message_new_device_removed (GstObject * src, GstDevice * device)
* pointer to the removed #GstDevice, or %NULL
*
* Parses a device-removed message. The device-removed message is produced by
- * #GstDeviceMonitor or a #GstGlobalDeviceMonitor. It announces the
+ * #GstDeviceProvider or a #GstDeviceMonitor. It announces the
* disappearance of monitored devices.
*
* Since: 1.4
diff --git a/gst/gstmessage.h b/gst/gstmessage.h
index 7433edc..7d4282e 100644
--- a/gst/gstmessage.h
+++ b/gst/gstmessage.h
@@ -105,9 +105,9 @@ typedef struct _GstMessage GstMessage;
* filter for GST_MESSAGE_EXTENDED and then check the result for the
* specific type. (Since 1.4)
* @GST_MESSAGE_DEVICE_ADDED: Message indicating a #GstDevice was added to
- * a #GstDeviceMonitor (Since 1.4)
+ * a #GstDeviceProvider (Since 1.4)
* @GST_MESSAGE_DEVICE_REMOVED: Message indicating a #GstDevice was removed
- * from a #GstDeviceMonitor (Since 1.4)
+ * from a #GstDeviceProvider (Since 1.4)
* @GST_MESSAGE_ANY: mask for all of the above messages.
*
* The different message types that are available.
@@ -404,8 +404,8 @@ gst_message_copy (const GstMessage * msg)
#define gst_message_make_writable(msg) GST_MESSAGE_CAST (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST (msg)))
/**
* gst_message_replace:
- * @old_message: (inout) (transfer full): pointer to a pointer to a #GstMessage
- * to be replaced.
+ * @old_message: (inout) (transfer full) (nullable): pointer to a
+ * pointer to a #GstMessage to be replaced.
* @new_message: (allow-none) (transfer none): pointer to a #GstMessage that will
* replace the message pointed to by @old_message.
*
diff --git a/gst/gstmeta.c b/gst/gstmeta.c
index 0e0aca1..1269c56 100644
--- a/gst/gstmeta.c
+++ b/gst/gstmeta.c
@@ -205,8 +205,8 @@ gst_meta_register (GType api, const gchar * impl, gsize size,
* Lookup a previously registered meta info structure by its implementation name
* @impl.
*
- * Returns: (transfer none): a #GstMetaInfo with @impl, or %NULL when no such
- * metainfo exists.
+ * Returns: (transfer none) (nullable): a #GstMetaInfo with @impl, or
+ * %NULL when no such metainfo exists.
*/
const GstMetaInfo *
gst_meta_get_info (const gchar * impl)
diff --git a/gst/gstminiobject.c b/gst/gstminiobject.c
index bece06a..d65bd02 100644
--- a/gst/gstminiobject.c
+++ b/gst/gstminiobject.c
@@ -469,9 +469,9 @@ gst_mini_object_unref (GstMiniObject * mini_object)
/**
* gst_mini_object_replace:
- * @olddata: (inout) (transfer full): pointer to a pointer to a mini-object to
- * be replaced
- * @newdata: pointer to new mini-object
+ * @olddata: (inout) (transfer full) (nullable): pointer to a pointer to a
+ * mini-object to be replaced
+ * @newdata: (allow-none): pointer to new mini-object
*
* Atomically modifies a pointer to point to a new mini-object.
* The reference count of @olddata is decreased and the reference count of
@@ -691,7 +691,8 @@ gst_mini_object_set_qdata (GstMiniObject * object, GQuark quark,
* This function gets back user data pointers stored via
* gst_mini_object_set_qdata().
*
- * Returns: (transfer none): The user data pointer set, or %NULL
+ * Returns: (transfer none) (nullable): The user data pointer set, or
+ * %NULL
*/
gpointer
gst_mini_object_get_qdata (GstMiniObject * object, GQuark quark)
@@ -721,7 +722,8 @@ gst_mini_object_get_qdata (GstMiniObject * object, GQuark quark)
* and removes the data from @object without invoking its destroy() function (if
* any was set).
*
- * Returns: (transfer full): The user data pointer set, or %NULL
+ * Returns: (transfer full) (nullable): The user data pointer set, or
+ * %NULL
*/
gpointer
gst_mini_object_steal_qdata (GstMiniObject * object, GQuark quark)
diff --git a/gst/gstobject.c b/gst/gstobject.c
index b997db6..5691bec 100644
--- a/gst/gstobject.c
+++ b/gst/gstobject.c
@@ -310,9 +310,9 @@ gst_object_ref_sink (gpointer object)
/**
* gst_object_replace:
- * @oldobj: (inout) (transfer full): pointer to a place of a #GstObject to
- * replace
- * @newobj: (transfer none): a new #GstObject
+ * @oldobj: (inout) (transfer full) (nullable): pointer to a place of
+ * a #GstObject to replace
+ * @newobj: (transfer none) (allow-none): a new #GstObject
*
* Atomically modifies a pointer to point to a new object.
* The reference count of @oldobj is decreased and the reference count of
@@ -588,7 +588,7 @@ had_parent:
/**
* gst_object_set_name:
* @object: a #GstObject
- * @name: new name of object
+ * @name: (allow-none): new name of object
*
* Sets the name of @object, or gives @object a guaranteed unique
* name (if @name is %NULL).
@@ -649,7 +649,8 @@ had_parent:
*
* Free-function: g_free
*
- * Returns: (transfer full): the name of @object. g_free() after usage.
+ * Returns: (transfer full) (nullable): the name of @object. g_free()
+ * after usage.
*
* MT safe. This function grabs and releases @object's LOCK.
*/
@@ -724,8 +725,8 @@ had_parent:
* Returns the parent of @object. This function increases the refcount
* of the parent object so you should gst_object_unref() it after usage.
*
- * Returns: (transfer full): parent of @object, this can be %NULL if @object
- * has no parent. unref after usage.
+ * Returns: (transfer full) (nullable): parent of @object, this can be
+ * %NULL if @object has no parent. unref after usage.
*
* MT safe. Grabs and releases @object's LOCK.
*/
@@ -992,8 +993,8 @@ gst_object_get_path_string (GstObject * object)
*
* Searches the list of properties under control.
*
- * Returns: a #GstControlBinding or %NULL if the property is not being
- * controlled.
+ * Returns: (nullable): a #GstControlBinding or %NULL if the property
+ * is not being controlled.
*/
static GstControlBinding *
gst_object_find_control_binding (GstObject * self, const gchar * name)
@@ -1210,8 +1211,8 @@ gst_object_add_control_binding (GstObject * object, GstControlBinding * binding)
* Gets the corresponding #GstControlBinding for the property. This should be
* unreferenced again after use.
*
- * Returns: (transfer full): the #GstControlBinding for @property_name or %NULL if
- * the property is not controlled.
+ * Returns: (transfer full) (nullable): the #GstControlBinding for
+ * @property_name or %NULL if the property is not controlled.
*/
GstControlBinding *
gst_object_get_control_binding (GstObject * object, const gchar * property_name)
@@ -1271,8 +1272,8 @@ gst_object_remove_control_binding (GstObject * object,
*
* Gets the value for the given controlled property at the requested time.
*
- * Returns: the GValue of the property at the given time, or %NULL if the
- * property isn't controlled.
+ * Returns: (nullable): the GValue of the property at the given time,
+ * or %NULL if the property isn't controlled.
*/
GValue *
gst_object_get_value (GstObject * object, const gchar * property_name,
diff --git a/gst/gstpad.c b/gst/gstpad.c
index 09ce750..28170ac 100644
--- a/gst/gstpad.c
+++ b/gst/gstpad.c
@@ -766,7 +766,7 @@ gst_pad_get_property (GObject * object, guint prop_id,
/**
* gst_pad_new:
- * @name: the name of the new pad.
+ * @name: (allow-none): the name of the new pad.
* @direction: the #GstPadDirection of the pad.
*
* Creates a new pad with the given name in the given direction.
@@ -774,7 +774,8 @@ gst_pad_get_property (GObject * object, guint prop_id,
* will be assigned.
* This function makes a copy of the name so you can safely free the name.
*
- * Returns: (transfer floating): a new #GstPad, or %NULL in case of an error.
+ * Returns: (transfer floating) (nullable): a new #GstPad, or %NULL in
+ * case of an error.
*
* MT safe.
*/
@@ -788,14 +789,15 @@ gst_pad_new (const gchar * name, GstPadDirection direction)
/**
* gst_pad_new_from_template:
* @templ: the pad template to use
- * @name: the name of the element
+ * @name: (allow-none): the name of the element
*
* Creates a new pad with the given name from the given template.
* If name is %NULL, a guaranteed unique name (across all pads)
* will be assigned.
* This function makes a copy of the name so you can safely free the name.
*
- * Returns: (transfer floating): a new #GstPad, or %NULL in case of an error.
+ * Returns: (transfer floating) (nullable): a new #GstPad, or %NULL in
+ * case of an error.
*/
GstPad *
gst_pad_new_from_template (GstPadTemplate * templ, const gchar * name)
@@ -816,7 +818,8 @@ gst_pad_new_from_template (GstPadTemplate * templ, const gchar * name)
* will be assigned.
* This function makes a copy of the name so you can safely free the name.
*
- * Returns: (transfer floating): a new #GstPad, or %NULL in case of an error.
+ * Returns: (transfer floating) (nullable): a new #GstPad, or %NULL in
+ * case of an error.
*/
GstPad *
gst_pad_new_from_static_template (GstStaticPadTemplate * templ,
@@ -2458,9 +2461,9 @@ gst_pad_set_pad_template (GstPad * pad, GstPadTemplate * templ)
*
* Gets the template for @pad.
*
- * Returns: (transfer full): the #GstPadTemplate from which this pad was
- * instantiated, or %NULL if this pad has no template. Unref after
- * usage.
+ * Returns: (transfer full) (nullable): the #GstPadTemplate from which
+ * this pad was instantiated, or %NULL if this pad has no
+ * template. Unref after usage.
*/
GstPadTemplate *
gst_pad_get_pad_template (GstPad * pad)
@@ -2584,9 +2587,9 @@ gst_pad_get_peer (GstPad * pad)
* calling gst_pad_query_caps() on @pad and its peer. The caller owns a reference
* on the resulting caps.
*
- * Returns: (transfer full): the allowed #GstCaps of the pad link. Unref the
- * caps when you no longer need it. This function returns %NULL when @pad
- * has no peer.
+ * Returns: (transfer full) (nullable): the allowed #GstCaps of the
+ * pad link. Unref the caps when you no longer need it. This
+ * function returns %NULL when @pad has no peer.
*
* MT safe.
*/
@@ -2641,8 +2644,8 @@ no_peer:
*
* The caller must free this iterator after use with gst_iterator_free().
*
- * Returns: a #GstIterator of #GstPad, or %NULL if @pad has no parent. Unref each
- * returned pad with gst_object_unref().
+ * Returns: (nullable): a #GstIterator of #GstPad, or %NULL if @pad
+ * has no parent. Unref each returned pad with gst_object_unref().
*/
GstIterator *
gst_pad_iterate_internal_links_default (GstPad * pad, GstObject * parent)
@@ -2707,9 +2710,9 @@ no_parent:
*
* Free-function: gst_iterator_free
*
- * Returns: (transfer full): a new #GstIterator of #GstPad or %NULL when the
- * pad does not have an iterator function configured. Use
- * gst_iterator_free() after usage.
+ * Returns: (transfer full) (nullable): a new #GstIterator of #GstPad
+ * or %NULL when the pad does not have an iterator function
+ * configured. Use gst_iterator_free() after usage.
*/
GstIterator *
gst_pad_iterate_internal_links (GstPad * pad)
@@ -5348,8 +5351,9 @@ gst_pad_get_element_private (GstPad * pad)
* Returns a new reference of the sticky event of type @event_type
* from the event.
*
- * Returns: (transfer full): a #GstEvent of type @event_type or %NULL when no
- * event of @event_type was on @pad. Unref after usage.
+ * Returns: (transfer full) (nullable): a #GstEvent of type
+ * @event_type or %NULL when no event of @event_type was on
+ * @pad. Unref after usage.
*/
GstEvent *
gst_pad_get_sticky_event (GstPad * pad, GstEventType event_type, guint idx)
diff --git a/gst/gstpad.h b/gst/gstpad.h
index bfb8b1a..2ac335c 100644
--- a/gst/gstpad.h
+++ b/gst/gstpad.h
@@ -251,9 +251,9 @@ typedef gboolean (*GstPadActivateModeFunction) (GstPad *pad, GstObject *parent,
/**
* GstPadChainFunction:
* @pad: the sink #GstPad that performed the chain.
- * @parent: the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT flag is set,
- * @parent is guaranteed to be not-%NULL and remain valid during the
- * execution of this function.
+ * @parent: (allow-none): the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT
+ * flag is set, @parent is guaranteed to be not-%NULL and remain valid
+ * during the execution of this function.
* @buffer: the #GstBuffer that is chained, not %NULL.
*
* A function that will be called on sinkpads when chaining buffers.
@@ -274,9 +274,9 @@ typedef GstFlowReturn (*GstPadChainFunction) (GstPad *pad, GstObject *parent,
/**
* GstPadChainListFunction:
* @pad: the sink #GstPad that performed the chain.
- * @parent: the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT flag is set,
- * @parent is guaranteed to be not-%NULL and remain valid during the
- * execution of this function.
+ * @parent: (allow-none): the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT
+ * flag is set, @parent is guaranteed to be not-%NULL and remain valid
+ * during the execution of this function.
* @list: the #GstBufferList that is chained, not %NULL.
*
* A function that will be called on sinkpads when chaining buffer lists.
@@ -297,9 +297,9 @@ typedef GstFlowReturn (*GstPadChainListFunction) (GstPad *pad, GstObject *paren
/**
* GstPadGetRangeFunction:
* @pad: the src #GstPad to perform the getrange on.
- * @parent: the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT flag is set,
- * @parent is guaranteed to be not-%NULL and remain valid during the
- * execution of this function.
+ * @parent: (allow-none): the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT
+ * flag is set, @parent is guaranteed to be not-%NULL and remain valid
+ * during the execution of this function.
* @offset: the offset of the range
* @length: the length of the range
* @buffer: a memory location to hold the result buffer, cannot be %NULL.
@@ -348,9 +348,9 @@ typedef GstFlowReturn (*GstPadGetRangeFunction) (GstPad *pad, GstObject *parent
/**
* GstPadEventFunction:
* @pad: the #GstPad to handle the event.
- * @parent: the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT flag is set,
- * @parent is guaranteed to be not-%NULL and remain valid during the
- * execution of this function.
+ * @parent: (allow-none): the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT
+ * flag is set, @parent is guaranteed to be not-%NULL and remain valid
+ * during the execution of this function.
* @event: the #GstEvent to handle.
*
* Function signature to handle an event for the pad.
@@ -365,9 +365,9 @@ typedef gboolean (*GstPadEventFunction) (GstPad *pad, GstObject *parent,
/**
* GstPadIterIntLinkFunction:
* @pad: The #GstPad to query.
- * @parent: the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT flag is set,
- * @parent is guaranteed to be not-%NULL and remain valid during the
- * execution of this function.
+ * @parent: (allow-none): the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT
+ * flag is set, @parent is guaranteed to be not-%NULL and remain valid
+ * during the execution of this function.
*
* The signature of the internal pad link iterator function.
*
@@ -382,9 +382,9 @@ typedef GstIterator* (*GstPadIterIntLinkFunction) (GstPad *pad, Gst
/**
* GstPadQueryFunction:
* @pad: the #GstPad to query.
- * @parent: the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT flag is set,
- * @parent is guaranteed to be not-%NULL and remain valid during the
- * execution of this function.
+ * @parent: (allow-none): the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT
+ * flag is set, @parent is guaranteed to be not-%NULL and remain valid
+ * during the execution of this function.
* @query: the #GstQuery object to execute
*
* The signature of the query function.
@@ -399,9 +399,9 @@ typedef gboolean (*GstPadQueryFunction) (GstPad *pad, GstObject *parent,
/**
* GstPadLinkFunction:
* @pad: the #GstPad that is linked.
- * @parent: the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT flag is set,
- * @parent is guaranteed to be not-%NULL and remain valid during the
- * execution of this function.
+ * @parent: (allow-none): the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT
+ * flag is set, @parent is guaranteed to be not-%NULL and remain valid
+ * during the execution of this function.
* @peer: the peer #GstPad of the link
*
* Function signature to handle a new link on the pad.
@@ -412,9 +412,9 @@ typedef GstPadLinkReturn (*GstPadLinkFunction) (GstPad *pad, GstObject *parent,
/**
* GstPadUnlinkFunction:
* @pad: the #GstPad that is linked.
- * @parent: the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT flag is set,
- * @parent is guaranteed to be not-%NULL and remain valid during the
- * execution of this function.
+ * @parent: (allow-none): the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT
+ * flag is set, @parent is guaranteed to be not-%NULL and remain valid
+ * during the execution of this function.
*
* Function signature to handle a unlinking the pad prom its peer.
*/
@@ -524,8 +524,8 @@ typedef enum
* GstPadProbeInfo:
* @type: the current probe type
* @id: the id of the probe
- * @data: type specific data, check the @type field to know the datatype.
- * This field can be %NULL.
+ * @data: (allow-none): type specific data, check the @type field to know the
+ * datatype. This field can be %NULL.
* @offset: offset of pull probe, this field is valid when @type contains
* #GST_PAD_PROBE_TYPE_PULL
* @size: size of pull probe, this field is valid when @type contains
@@ -581,7 +581,7 @@ typedef GstPadProbeReturn (*GstPadProbeCallback) (GstPad *pad, GstPadProbeIn
/**
* GstPadStickyEventsForeachFunction:
* @pad: the #GstPad.
- * @event: a sticky #GstEvent.
+ * @event: (allow-none): a sticky #GstEvent.
* @user_data: the #gpointer to optional user data.
*
* Callback used by gst_pad_sticky_events_foreach().
@@ -1186,6 +1186,8 @@ GstPad* gst_pad_new_from_static_template (GstStaticPadTemplate *templ, const g
* Can return %NULL if the pad did not have a parent.
*
* MT safe.
+ *
+ * Returns: (nullable): the parent
*/
#define gst_pad_get_parent(pad) gst_object_get_parent (GST_OBJECT_CAST (pad))
diff --git a/gst/gstplugin.c b/gst/gstplugin.c
index 9bfacc1..c9c286a 100644
--- a/gst/gstplugin.c
+++ b/gst/gstplugin.c
@@ -1006,7 +1006,8 @@ gst_plugin_get_origin (GstPlugin * plugin)
*
* There may be plugins that do not have a valid release date set on them.
*
- * Returns: the date string of the plugin, or %NULL if not available.
+ * Returns: (nullable): the date string of the plugin, or %NULL if not
+ * available.
*/
const gchar *
gst_plugin_get_release_date_string (GstPlugin * plugin)
@@ -1039,7 +1040,8 @@ gst_plugin_is_loaded (GstPlugin * plugin)
* Gets the plugin specific data cache. If it is %NULL there is no cached data
* stored. This is the case when the registry is getting rebuilt.
*
- * Returns: (transfer none): The cached data as a #GstStructure or %NULL.
+ * Returns: (transfer none) (nullable): The cached data as a
+ * #GstStructure or %NULL.
*/
const GstStructure *
gst_plugin_get_cache_data (GstPlugin * plugin)
diff --git a/gst/gstplugin.h b/gst/gstplugin.h
index 500be30..6e49332 100644
--- a/gst/gstplugin.h
+++ b/gst/gstplugin.h
@@ -145,11 +145,12 @@ typedef gboolean (*GstPluginInitFullFunc) (GstPlugin *plugin, gpointer user_data
* @source: source module plugin belongs to
* @package: shipped package plugin belongs to
* @origin: URL to provider of plugin
- * @release_datetime: date time string in ISO 8601 format (or rather, a
- * subset thereof), or %NULL. Allowed are the following formats:
- * "YYYY-MM-DD" and "YYY-MM-DDTHH:MMZ" (with 'T' a separator and 'Z'
- * indicating UTC/Zulu time). This field should be set via the
- * GST_PACKAGE_RELEASE_DATETIME preprocessor macro.
+ * @release_datetime: (allow-none): date time string in ISO 8601
+ * format (or rather, a subset thereof), or %NULL. Allowed are the
+ * following formats: "YYYY-MM-DD" and "YYY-MM-DDTHH:MMZ" (with
+ * 'T' a separator and 'Z' indicating UTC/Zulu time). This field
+ * should be set via the %GST_PACKAGE_RELEASE_DATETIME
+ * preprocessor macro.
*
* A plugin should export a variable of this type called plugin_desc. The plugin
* loader will use the data provided there to initialize the plugin.
diff --git a/gst/gstpluginfeature.c b/gst/gstpluginfeature.c
index 6672f7b..ef24eaf 100644
--- a/gst/gstpluginfeature.c
+++ b/gst/gstpluginfeature.c
@@ -90,7 +90,8 @@ gst_plugin_feature_finalize (GObject * object)
* feature = loaded_feature;
* ]|
*
- * Returns: (transfer full): a reference to the loaded feature, or %NULL on error
+ * Returns: (transfer full) (nullable): a reference to the loaded
+ * feature, or %NULL on error
*/
GstPluginFeature *
gst_plugin_feature_load (GstPluginFeature * feature)
@@ -185,8 +186,9 @@ gst_plugin_feature_get_rank (GstPluginFeature * feature)
*
* Get the plugin that provides this feature.
*
- * Returns: (transfer full): the plugin that provides this feature, or %NULL.
- * Unref with gst_object_unref() when no longer needed.
+ * Returns: (transfer full) (nullable): the plugin that provides this
+ * feature, or %NULL. Unref with gst_object_unref() when no
+ * longer needed.
*/
GstPlugin *
gst_plugin_feature_get_plugin (GstPluginFeature * feature)
@@ -205,8 +207,9 @@ gst_plugin_feature_get_plugin (GstPluginFeature * feature)
*
* Get the name of the plugin that provides this feature.
*
- * Returns: the name of the plugin that provides this feature, or %NULL if
- * the feature is not associated with a plugin.
+ * Returns: (nullable): the name of the plugin that provides this
+ * feature, or %NULL if the feature is not associated with a
+ * plugin.
*
* Since: 1.2
*/
diff --git a/gst/gstpluginfeature.h b/gst/gstpluginfeature.h
index bc01969..08abb73 100644
--- a/gst/gstpluginfeature.h
+++ b/gst/gstpluginfeature.h
@@ -75,7 +75,7 @@ typedef enum {
* Returns the name of @feature.
* For a nameless plugin feature, this returns %NULL.
*
- * Returns: (transfer none): the name of @feature. MT safe.
+ * Returns: (transfer none) (nullable): the name of @feature. MT safe.
*
*/
#define gst_plugin_feature_get_name(feature) GST_OBJECT_NAME(feature)
diff --git a/gst/gstpoll.c b/gst/gstpoll.c
index 6694a87..34f93f4 100644
--- a/gst/gstpoll.c
+++ b/gst/gstpoll.c
@@ -545,8 +545,8 @@ gst_poll_collect_winsock_events (GstPoll * set)
*
* Free-function: gst_poll_free
*
- * Returns: (transfer full): a new #GstPoll, or %NULL in case of an error.
- * Free with gst_poll_free().
+ * Returns: (transfer full) (nullable): a new #GstPoll, or %NULL in
+ * case of an error. Free with gst_poll_free().
*/
GstPoll *
gst_poll_new (gboolean controllable)
@@ -617,8 +617,8 @@ no_socket_pair:
*
* Free-function: gst_poll_free
*
- * Returns: (transfer full): a new #GstPoll, or %NULL in case of an error.
- * Free with gst_poll_free().
+ * Returns: (transfer full) (nullable): a new #GstPoll, or %NULL in
+ * case of an error. Free with gst_poll_free().
*/
GstPoll *
gst_poll_new_timer (void)
diff --git a/gst/gstpreset.c b/gst/gstpreset.c
index 19f0fbb..27db9ec 100644
--- a/gst/gstpreset.c
+++ b/gst/gstpreset.c
@@ -116,9 +116,9 @@ static gboolean gst_preset_default_save_presets_file (GstPreset * preset);
/*
* preset_get_paths:
* @preset: a #GObject that implements #GstPreset
- * @preset_user_path: location for path or %NULL
- * @preset_app_path: location for path or %NULL
- * @preset_system_path: location for path or %NULL
+ * @preset_user_path: (out) (allow-none): location for path or %NULL
+ * @preset_app_path: (out) (allow-none): location for path or %NULL
+ * @preset_system_path: (out) (allow-none): location for path or %NULL
*
* Fetch the preset_path for user local, application specific and system wide
* settings. Don't free after use.
@@ -1069,7 +1069,7 @@ gst_preset_delete_preset (GstPreset * preset, const gchar * name)
* @preset: a #GObject that implements #GstPreset
* @name: preset name
* @tag: meta data item name
- * @value: new value
+ * @value: (allow-none): new value
*
* Sets a new @value for an existing meta data item or adds a new item. Meta
* data @tag names can be something like e.g. "comment". Supplying %NULL for the
@@ -1141,7 +1141,8 @@ gst_preset_set_app_dir (const gchar * app_dir)
* Gets the directory for application specific presets if set by the
* application.
*
- * Returns: the directory or %NULL, don't free or modify the string
+ * Returns: (nullable): the directory or %NULL, don't free or modify
+ * the string
*/
const gchar *
gst_preset_get_app_dir (void)
diff --git a/gst/gstquery.h b/gst/gstquery.h
index 3750a19..18a075c 100644
--- a/gst/gstquery.h
+++ b/gst/gstquery.h
@@ -276,8 +276,8 @@ gst_query_copy (const GstQuery * q)
#define gst_query_make_writable(q) GST_QUERY_CAST (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST (q)))
/**
* gst_query_replace:
- * @old_query: (inout) (transfer full): pointer to a pointer to a #GstQuery
- * to be replaced.
+ * @old_query: (inout) (transfer full) (nullable): pointer to a pointer to a
+ * #GstQuery to be replaced.
* @new_query: (allow-none) (transfer none): pointer to a #GstQuery that will
* replace the query pointed to by @old_query.
*
diff --git a/gst/gstregistry.c b/gst/gstregistry.c
index 2838737..73fdf0e 100644
--- a/gst/gstregistry.c
+++ b/gst/gstregistry.c
@@ -127,7 +127,7 @@
#include "gstinfo.h"
#include "gsterror.h"
#include "gstregistry.h"
-#include "gstdevicemonitorfactory.h"
+#include "gstdeviceproviderfactory.h"
#include "gstpluginloader.h"
@@ -166,7 +166,7 @@ struct _GstRegistryPrivate
guint32 efl_cookie;
GList *typefind_factory_list;
guint32 tfl_cookie;
- GList *device_monitor_factory_list;
+ GList *device_provider_factory_list;
guint32 dmfl_cookie;
};
@@ -317,10 +317,10 @@ gst_registry_finalize (GObject * object)
gst_plugin_feature_list_free (registry->priv->typefind_factory_list);
}
- if (registry->priv->device_monitor_factory_list) {
+ if (registry->priv->device_provider_factory_list) {
GST_DEBUG_OBJECT (registry,
- "Cleaning up cached device monitor factory list");
- gst_plugin_feature_list_free (registry->priv->device_monitor_factory_list);
+ "Cleaning up cached device provider factory list");
+ gst_plugin_feature_list_free (registry->priv->device_provider_factory_list);
}
G_OBJECT_CLASS (parent_class)->finalize (object);
@@ -789,20 +789,20 @@ gst_registry_get_typefind_factory_list (GstRegistry * registry)
static GList *
-gst_registry_get_device_monitor_factory_list (GstRegistry * registry)
+gst_registry_get_device_provider_factory_list (GstRegistry * registry)
{
GList *list;
GST_OBJECT_LOCK (registry);
gst_registry_get_feature_list_or_create (registry,
- &registry->priv->device_monitor_factory_list,
- &registry->priv->dmfl_cookie, GST_TYPE_DEVICE_MONITOR_FACTORY);
+ &registry->priv->device_provider_factory_list,
+ &registry->priv->dmfl_cookie, GST_TYPE_DEVICE_PROVIDER_FACTORY);
/* Return reffed copy */
list =
gst_plugin_feature_list_copy (registry->
- priv->device_monitor_factory_list);
+ priv->device_provider_factory_list);
GST_OBJECT_UNLOCK (registry);
@@ -868,8 +868,9 @@ gst_registry_plugin_name_filter (GstPlugin * plugin, const gchar * name)
* Find the plugin with the given name in the registry.
* The plugin will be reffed; caller is responsible for unreffing.
*
- * Returns: (transfer full): the plugin with the given name or %NULL if the
- * plugin was not found. gst_object_unref() after usage.
+ * Returns: (transfer full) (nullable): the plugin with the given name
+ * or %NULL if the plugin was not found. gst_object_unref() after
+ * usage.
*
* MT safe.
*/
@@ -902,8 +903,9 @@ gst_registry_find_plugin (GstRegistry * registry, const gchar * name)
*
* Find the pluginfeature with the given name and type in the registry.
*
- * Returns: (transfer full): the pluginfeature with the given name and type
- * or %NULL if the plugin was not found. gst_object_unref() after usage.
+ * Returns: (transfer full) (nullable): the pluginfeature with the
+ * given name and type or %NULL if the plugin was not
+ * found. gst_object_unref() after usage.
*
* MT safe.
*/
@@ -951,8 +953,8 @@ gst_registry_get_feature_list (GstRegistry * registry, GType type)
return gst_registry_get_element_factory_list (registry);
else if (type == GST_TYPE_TYPE_FIND_FACTORY)
return gst_registry_get_typefind_factory_list (registry);
- else if (type == GST_TYPE_DEVICE_MONITOR_FACTORY)
- return gst_registry_get_device_monitor_factory_list (registry);
+ else if (type == GST_TYPE_DEVICE_PROVIDER_FACTORY)
+ return gst_registry_get_device_provider_factory_list (registry);
data.type = type;
data.name = NULL;
@@ -1055,8 +1057,8 @@ gst_registry_lookup_bn (GstRegistry * registry, const char *basename)
* Look up a plugin in the given registry with the given filename.
* If found, plugin is reffed.
*
- * Returns: (transfer full): the #GstPlugin if found, or %NULL if not.
- * gst_object_unref() after usage.
+ * Returns: (transfer full) (nullable): the #GstPlugin if found, or
+ * %NULL if not. gst_object_unref() after usage.
*/
GstPlugin *
gst_registry_lookup (GstRegistry * registry, const char *filename)
diff --git a/gst/gstregistrybinary.c b/gst/gstregistrybinary.c
index ee4a7a0..7b8556e 100644
--- a/gst/gstregistrybinary.c
+++ b/gst/gstregistrybinary.c
@@ -56,7 +56,7 @@
#include <gst/gstelement.h>
#include <gst/gsttypefind.h>
#include <gst/gsttypefindfactory.h>
-#include <gst/gstdevicemonitorfactory.h>
+#include <gst/gstdeviceproviderfactory.h>
#include <gst/gsturi.h>
#include <gst/gstinfo.h>
#include <gst/gstenumtypes.h>
@@ -526,7 +526,7 @@ priv_gst_registry_binary_read_cache (GstRegistry * registry,
/* make sure these types exist */
GST_TYPE_ELEMENT_FACTORY;
GST_TYPE_TYPE_FIND_FACTORY;
- GST_TYPE_DEVICE_MONITOR_FACTORY;
+ GST_TYPE_DEVICE_PROVIDER_FACTORY;
#ifndef GST_DISABLE_GST_DEBUG
timer = g_timer_new ();
diff --git a/gst/gstregistrychunks.c b/gst/gstregistrychunks.c
index fcacd6b..f854865 100644
--- a/gst/gstregistrychunks.c
+++ b/gst/gstregistrychunks.c
@@ -33,7 +33,7 @@
#include <gst/gstelement.h>
#include <gst/gsttypefind.h>
#include <gst/gsttypefindfactory.h>
-#include <gst/gstdevicemonitorfactory.h>
+#include <gst/gstdeviceproviderfactory.h>
#include <gst/gsturi.h>
#include <gst/gstinfo.h>
#include <gst/gstenumtypes.h>
@@ -333,17 +333,17 @@ gst_registry_chunks_save_feature (GList ** list, GstPluginFeature * feature)
} else {
gst_registry_chunks_save_const_string (list, "");
}
- } else if (GST_IS_DEVICE_MONITOR_FACTORY (feature)) {
- GstRegistryChunkDeviceMonitorFactory *tff;
- GstDeviceMonitorFactory *factory = GST_DEVICE_MONITOR_FACTORY (feature);
+ } else if (GST_IS_DEVICE_PROVIDER_FACTORY (feature)) {
+ GstRegistryChunkDeviceProviderFactory *tff;
+ GstDeviceProviderFactory *factory = GST_DEVICE_PROVIDER_FACTORY (feature);
/* Initialize with zeroes because of struct padding and
* valgrind complaining about copying unitialized memory
*/
- tff = g_slice_new0 (GstRegistryChunkDeviceMonitorFactory);
+ tff = g_slice_new0 (GstRegistryChunkDeviceProviderFactory);
chk =
gst_registry_chunks_make_data (tff,
- sizeof (GstRegistryChunkDeviceMonitorFactory));
+ sizeof (GstRegistryChunkDeviceProviderFactory));
pf = (GstRegistryChunkPluginFeature *) tff;
@@ -668,16 +668,16 @@ gst_registry_chunks_load_feature (GstRegistry * registry, gchar ** in,
factory->extensions[i - 1] = str;
}
}
- } else if (GST_IS_DEVICE_MONITOR_FACTORY (feature)) {
- GstRegistryChunkDeviceMonitorFactory *dmf;
- GstDeviceMonitorFactory *factory = GST_DEVICE_MONITOR_FACTORY (feature);
+ } else if (GST_IS_DEVICE_PROVIDER_FACTORY (feature)) {
+ GstRegistryChunkDeviceProviderFactory *dmf;
+ GstDeviceProviderFactory *factory = GST_DEVICE_PROVIDER_FACTORY (feature);
const gchar *meta_data_str;
align (*in);
GST_DEBUG
("Reading/casting for GstRegistryChunkPluginFeature at address %p",
*in);
- unpack_element (*in, dmf, GstRegistryChunkDeviceMonitorFactory, end, fail);
+ unpack_element (*in, dmf, GstRegistryChunkDeviceProviderFactory, end, fail);
pf = (GstRegistryChunkPluginFeature *) dmf;
diff --git a/gst/gstregistrychunks.h b/gst/gstregistrychunks.h
index e2c86ba..57ced70 100644
--- a/gst/gstregistrychunks.h
+++ b/gst/gstregistrychunks.h
@@ -132,15 +132,15 @@ typedef struct _GstRegistryChunkTypeFindFactory
} GstRegistryChunkTypeFindFactory;
/*
- * GstRegistryChunkDeviceMonitorFactory:
+ * GstRegistryChunkDeviceProviderFactory:
*
- * A structure containing the device monitor factory fields
+ * A structure containing the device provider factory fields
*/
-typedef struct _GstRegistryChunkDeviceMonitorFactory
+typedef struct _GstRegistryChunkDeviceProviderFactory
{
GstRegistryChunkPluginFeature plugin_feature;
-} GstRegistryChunkDeviceMonitorFactory;
+} GstRegistryChunkDeviceProviderFactory;
/*
* GstRegistryChunkPadTemplate:
diff --git a/gst/gstsample.c b/gst/gstsample.c
index 76b76bd..ce8228a 100644
--- a/gst/gstsample.c
+++ b/gst/gstsample.c
@@ -143,10 +143,10 @@ had_parent:
*
* Get the buffer associated with @sample
*
- * Returns: (transfer none): the buffer of @sample or %NULL when there
- * is no buffer. The buffer remains valid as long as @sample is valid.
- * If you need to hold on to it for longer than that, take a ref to
- * the buffer with gst_buffer_ref().
+ * Returns: (transfer none) (nullable): the buffer of @sample or %NULL
+ * when there is no buffer. The buffer remains valid as long as
+ * @sample is valid. If you need to hold on to it for longer than
+ * that, take a ref to the buffer with gst_buffer_ref().
*/
GstBuffer *
gst_sample_get_buffer (GstSample * sample)
@@ -162,10 +162,10 @@ gst_sample_get_buffer (GstSample * sample)
*
* Get the caps associated with @sample
*
- * Returns: (transfer none): the caps of @sample or %NULL when there
- * is no caps. The caps remain valid as long as @sample is valid.
- * If you need to hold on to the caps for longer than that, take a ref to
- * the caps with gst_caps_ref().
+ * Returns: (transfer none) (nullable): the caps of @sample or %NULL
+ * when there is no caps. The caps remain valid as long as @sample is
+ * valid. If you need to hold on to the caps for longer than that,
+ * take a ref to the caps with gst_caps_ref().
*/
GstCaps *
gst_sample_get_caps (GstSample * sample)
diff --git a/gst/gststructure.c b/gst/gststructure.c
index 5013860..91f3ab3 100644
--- a/gst/gststructure.c
+++ b/gst/gststructure.c
@@ -1585,8 +1585,8 @@ gst_structure_get_double (const GstStructure * structure,
* The string should not be modified, and remains valid until the next
* call to a gst_structure_*() function with the given structure.
*
- * Returns: a pointer to the string or %NULL when the field did not exist
- * or did not contain a string.
+ * Returns: (nullable): a pointer to the string or %NULL when the
+ * field did not exist or did not contain a string.
*/
const gchar *
gst_structure_get_string (const GstStructure * structure,
@@ -2374,8 +2374,9 @@ priv_gst_structure_parse_fields (gchar * str, gchar ** end,
*
* Free-function: gst_structure_free
*
- * Returns: (transfer full): a new #GstStructure or %NULL when the string could
- * not be parsed. Free with gst_structure_free() after use.
+ * Returns: (transfer full) (nullable): a new #GstStructure or %NULL
+ * when the string could not be parsed. Free with
+ * gst_structure_free() after use.
*
* Since: 1.2
*/
@@ -2396,8 +2397,9 @@ gst_structure_new_from_string (const gchar * string)
*
* Free-function: gst_structure_free
*
- * Returns: (transfer full): a new #GstStructure or %NULL when the string could
- * not be parsed. Free with gst_structure_free() after use.
+ * Returns: (transfer full) (nullable): a new #GstStructure or %NULL
+ * when the string could not be parsed. Free with
+ * gst_structure_free() after use.
*/
GstStructure *
gst_structure_from_string (const gchar * string, gchar ** end)
diff --git a/gst/gsttaglist.c b/gst/gsttaglist.c
index c96cb56..be502c3 100644
--- a/gst/gsttaglist.c
+++ b/gst/gsttaglist.c
@@ -844,8 +844,9 @@ gst_tag_list_get_scope (const GstTagList * list)
*
* Serializes a tag list to a string.
*
- * Returns: a newly-allocated string, or %NULL in case of an error. The
- * string must be freed with g_free() when no longer needed.
+ * Returns: (nullable): a newly-allocated string, or %NULL in case of
+ * an error. The string must be freed with g_free() when no longer
+ * needed.
*/
gchar *
gst_tag_list_to_string (const GstTagList * list)
@@ -861,7 +862,8 @@ gst_tag_list_to_string (const GstTagList * list)
*
* Deserializes a tag list.
*
- * Returns: a new #GstTagList, or %NULL in case of an error.
+ * Returns: (nullable): a new #GstTagList, or %NULL in case of an
+ * error.
*/
GstTagList *
gst_tag_list_new_from_string (const gchar * str)
@@ -1131,8 +1133,8 @@ gst_tag_list_insert (GstTagList * into, const GstTagList * from,
/**
* gst_tag_list_merge:
- * @list1: first list to merge
- * @list2: second list to merge
+ * @list1: (allow-none): first list to merge
+ * @list2: (allow-none): second list to merge
* @mode: the mode to use
*
* Merges the two given lists into a new list. If one of the lists is %NULL, a
@@ -1140,7 +1142,7 @@ gst_tag_list_insert (GstTagList * into, const GstTagList * from,
*
* Free-function: gst_tag_list_unref
*
- * Returns: (transfer full): the new list
+ * Returns: (transfer full) (nullable): the new list
*/
GstTagList *
gst_tag_list_merge (const GstTagList * list1, const GstTagList * list2,
@@ -1424,8 +1426,9 @@ gst_tag_list_foreach (const GstTagList * list, GstTagForeachFunc func,
* Gets the value that is at the given index for the given tag in the given
* list.
*
- * Returns: (transfer none): The GValue for the specified entry or %NULL if the
- * tag wasn't available or the tag doesn't have as many entries
+ * Returns: (transfer none) (nullable): The GValue for the specified
+ * entry or %NULL if the tag wasn't available or the tag
+ * doesn't have as many entries
*/
const GValue *
gst_tag_list_get_value_index (const GstTagList * list, const gchar * tag,
diff --git a/gst/gsttagsetter.c b/gst/gsttagsetter.c
index b2955d6..7ed457e 100644
--- a/gst/gsttagsetter.c
+++ b/gst/gsttagsetter.c
@@ -340,8 +340,8 @@ gst_tag_setter_add_tag_value (GstTagSetter * setter,
*
* This function is not thread-safe.
*
- * Returns: (transfer none): a current snapshot of the taglist used in the
- * setter or %NULL if none is used.
+ * Returns: (transfer none) (nullable): a current snapshot of the
+ * taglist used in the setter or %NULL if none is used.
*/
const GstTagList *
gst_tag_setter_get_tag_list (GstTagSetter * setter)
diff --git a/gst/gsttaskpool.c b/gst/gsttaskpool.c
index d7ff344..20b8aa4 100644
--- a/gst/gsttaskpool.c
+++ b/gst/gsttaskpool.c
@@ -223,9 +223,9 @@ gst_task_pool_cleanup (GstTaskPool * pool)
*
* Start the execution of a new thread from @pool.
*
- * Returns: (transfer none): a pointer that should be used for the
- * gst_task_pool_join function. This pointer can be %NULL, you must
- * check @error to detect errors.
+ * Returns: (transfer none) (nullable): a pointer that should be used
+ * for the gst_task_pool_join function. This pointer can be %NULL, you
+ * must check @error to detect errors.
*/
gpointer
gst_task_pool_push (GstTaskPool * pool, GstTaskPoolFunction func,
diff --git a/gst/gsttoc.c b/gst/gsttoc.c
index bee13cb..be99cb1 100644
--- a/gst/gsttoc.c
+++ b/gst/gsttoc.c
@@ -360,7 +360,8 @@ gst_toc_entry_find_sub_entry (const GstTocEntry * entry, const gchar * uid)
*
* Find #GstTocEntry with given @uid in the @toc.
*
- * Returns: (transfer none): #GstTocEntry with specified @uid from the @toc, or %NULL if not found.
+ * Returns: (transfer none) (nullable): #GstTocEntry with specified
+ * @uid from the @toc, or %NULL if not found.
*/
GstTocEntry *
gst_toc_find_entry (const GstToc * toc, const gchar * uid)
@@ -393,8 +394,9 @@ gst_toc_find_entry (const GstToc * toc, const gchar * uid)
*
* Copy #GstTocEntry with all subentries (deep copy).
*
- * Returns: newly allocated #GstTocEntry in case of success, %NULL otherwise;
- * free it when done with gst_toc_entry_unref().
+ * Returns: (nullable): newly allocated #GstTocEntry in case of
+ * success, %NULL otherwise; free it when done with
+ * gst_toc_entry_unref().
*/
static GstTocEntry *
gst_toc_entry_copy (const GstTocEntry * entry)
@@ -437,8 +439,8 @@ gst_toc_entry_copy (const GstTocEntry * entry)
*
* Copy #GstToc with all subentries (deep copy).
*
- * Returns: newly allocated #GstToc in case of success, %NULL otherwise;
- * free it when done with gst_toc_unref().
+ * Returns: (nullable): newly allocated #GstToc in case of success,
+ * %NULL otherwise; free it when done with gst_toc_unref().
*/
static GstToc *
gst_toc_copy (const GstToc * toc)
@@ -492,8 +494,10 @@ gst_toc_entry_set_start_stop_times (GstTocEntry * entry, gint64 start,
/**
* gst_toc_entry_get_start_stop_times:
* @entry: #GstTocEntry to get values from.
- * @start: (out): the storage for the start value, leave %NULL if not need.
- * @stop: (out): the storage for the stop value, leave %NULL if not need.
+ * @start: (out) (allow-none): the storage for the start value, leave
+ * %NULL if not need.
+ * @stop: (out) (allow-none): the storage for the stop value, leave
+ * %NULL if not need.
*
* Get @start and @stop values from the @entry and write them into appropriate
* storages.
@@ -538,10 +542,10 @@ gst_toc_entry_set_loop (GstTocEntry * entry, GstTocLoopType loop_type,
/**
* gst_toc_entry_get_loop:
* @entry: #GstTocEntry to get values from.
- * @loop_type: (out): the storage for the loop_type value, leave %NULL if not
- * need.
- * @repeat_count: (out): the storage for the repeat_count value, leave %NULL if
- * not need.
+ * @loop_type: (out) (allow-none): the storage for the loop_type
+ * value, leave %NULL if not need.
+ * @repeat_count: (out) (allow-none): the storage for the repeat_count
+ * value, leave %NULL if not need.
*
* Get @loop_type and @repeat_count values from the @entry and write them into
* appropriate storages. Loops are e.g. used by sampled instruments. GStreamer
diff --git a/gst/gsttocsetter.c b/gst/gsttocsetter.c
index 42839d2..f5c7ea5 100644
--- a/gst/gsttocsetter.c
+++ b/gst/gsttocsetter.c
@@ -128,8 +128,8 @@ gst_toc_setter_reset (GstTocSetter * setter)
* modified without making it writable first.
*
*
- * Returns: (transfer full): TOC set, or %NULL. Unref with gst_toc_unref()
- * when no longer needed
+ * Returns: (transfer full) (nullable): TOC set, or %NULL. Unref with
+ * gst_toc_unref() when no longer needed
*/
GstToc *
gst_toc_setter_get_toc (GstTocSetter * setter)
diff --git a/gst/gsttypefind.c b/gst/gsttypefind.c
index 1fcbea1..ddcbfda 100644
--- a/gst/gsttypefind.c
+++ b/gst/gsttypefind.c
@@ -119,8 +119,8 @@ gst_type_find_register (GstPlugin * plugin, const gchar * name, guint rank,
* the stream. The returned memory is valid until the typefinding function
* returns and must not be freed.
*
- * Returns: (transfer none) (array length=size): the requested data, or %NULL
- * if that data is not available.
+ * Returns: (transfer none) (array length=size) (nullable): the
+ * requested data, or %NULL if that data is not available.
*/
const guint8 *
gst_type_find_peek (GstTypeFind * find, gint64 offset, guint size)
diff --git a/gst/gsttypefindfactory.c b/gst/gsttypefindfactory.c
index c216eb3..8a1b239 100644
--- a/gst/gsttypefindfactory.c
+++ b/gst/gsttypefindfactory.c
@@ -177,8 +177,8 @@ gst_type_find_factory_get_caps (GstTypeFindFactory * factory)
* copy it using g_strdupv(). This function may return %NULL to indicate
* a 0-length list.
*
- * Returns: (transfer none) (array zero-terminated=1) (element-type utf8): a
- * %NULL-terminated array of extensions associated with this factory
+ * Returns: (transfer none) (array zero-terminated=1) (element-type utf8) (nullable):
+ * a %NULL-terminated array of extensions associated with this factory
*/
const gchar *const *
gst_type_find_factory_get_extensions (GstTypeFindFactory * factory)
diff --git a/gst/gsturi.c b/gst/gsturi.c
index 00a496f..eb8cdcc 100644
--- a/gst/gsturi.c
+++ b/gst/gsturi.c
@@ -233,9 +233,9 @@ unescape_character (const char *scanner)
* Characters are encoded in PERCENTxy form, where xy is the ASCII hex code
* for character 16x+y.
*
- * Return value: a newly allocated string with the unescaped equivalents,
- * or %NULL if @escaped_string contained one of the characters
- * in @illegal_characters.
+ * Return value: (nullable): a newly allocated string with the
+ * unescaped equivalents, or %NULL if @escaped_string contained one of
+ * the characters in @illegal_characters.
**/
static char *
unescape_string (const gchar * escaped_string, const gchar * illegal_characters)
@@ -664,9 +664,10 @@ gst_uri_handler_get_uri_type (GstURIHandler * handler)
* Gets the list of protocols supported by @handler. This list may not be
* modified.
*
- * Returns: (transfer none) (element-type utf8): the supported protocols.
- * Returns %NULL if the @handler isn't implemented properly, or the @handler
- * doesn't support any protocols.
+ * Returns: (transfer none) (element-type utf8) (nullable): the
+ * supported protocols. Returns %NULL if the @handler isn't
+ * implemented properly, or the @handler doesn't support any
+ * protocols.
*/
const gchar *const *
gst_uri_handler_get_protocols (GstURIHandler * handler)
@@ -692,9 +693,10 @@ gst_uri_handler_get_protocols (GstURIHandler * handler)
*
* Gets the currently handled URI.
*
- * Returns: (transfer full): the URI currently handled by the @handler.
- * Returns %NULL if there are no URI currently handled. The
- * returned string must be freed with g_free() when no longer needed.
+ * Returns: (transfer full) (nullable): the URI currently handled by
+ * the @handler. Returns %NULL if there are no URI currently
+ * handled. The returned string must be freed with g_free() when no
+ * longer needed.
*/
gchar *
gst_uri_handler_get_uri (GstURIHandler * handler)
diff --git a/gst/gstutils.c b/gst/gstutils.c
index c411631..2aacbdc 100644
--- a/gst/gstutils.c
+++ b/gst/gstutils.c
@@ -773,8 +773,8 @@ gst_element_create_all_pads (GstElement * element)
* Retrieves a pad template from @element that is compatible with @compattempl.
* Pads from compatible templates can be linked together.
*
- * Returns: (transfer none): a compatible #GstPadTemplate, or %NULL if none
- * was found. No unreferencing is necessary.
+ * Returns: (transfer none) (nullable): a compatible #GstPadTemplate,
+ * or %NULL if none was found. No unreferencing is necessary.
*/
GstPadTemplate *
gst_element_get_compatible_pad_template (GstElement * element,
@@ -850,8 +850,8 @@ gst_element_get_compatible_pad_template (GstElement * element,
* #GST_PAD_REQUEST, requests a new pad. Can return %NULL for #GST_PAD_SOMETIMES
* templates.
*
- * Returns: (transfer full): the #GstPad, or NULL if one could not be found
- * or created.
+ * Returns: (transfer full) (nullable): the #GstPad, or %NULL if one
+ * could not be found or created.
*/
static GstPad *
gst_element_get_pad_from_template (GstElement * element, GstPadTemplate * templ)
@@ -891,7 +891,8 @@ gst_element_get_pad_from_template (GstElement * element, GstPadTemplate * templ)
* Requests a pad from @element. The returned pad should be unlinked and
* compatible with @templ. Might return an existing pad, or request a new one.
*
- * Returns: a #GstPad, or %NULL if one could not be found or created.
+ * Returns: (nullable): a #GstPad, or %NULL if one could not be found
+ * or created.
*/
static GstPad *
gst_element_request_compatible_pad (GstElement * element,
@@ -984,8 +985,9 @@ gst_pad_check_link (GstPad * srcpad, GstPad * sinkpad)
* and if none can be found, it will request a compatible REQUEST pad by looking
* at the templates of @element.
*
- * Returns: (transfer full): the #GstPad to which a link can be made, or %NULL
- * if one cannot be found. gst_object_unref() after usage.
+ * Returns: (transfer full) (nullable): the #GstPad to which a link
+ * can be made, or %NULL if one cannot be found. gst_object_unref()
+ * after usage.
*/
GstPad *
gst_element_get_compatible_pad (GstElement * element, GstPad * pad,
@@ -2311,8 +2313,9 @@ gst_pad_use_fixed_caps (GstPad * pad)
* Gets the parent of @pad, cast to a #GstElement. If a @pad has no parent or
* its parent is not an element, return %NULL.
*
- * Returns: (transfer full): the parent of the pad. The caller has a
- * reference on the parent, so unref when you're finished with it.
+ * Returns: (transfer full) (nullable): the parent of the pad. The
+ * caller has a reference on the parent, so unref when you're finished
+ * with it.
*
* MT safe.
*/
@@ -2957,7 +2960,8 @@ element_find_unlinked_pad (GstElement * element, GstPadDirection direction)
* owns a reference to it and should use gst_object_unref() on the
* pad when it is not needed any longer.
*
- * Returns: (transfer full): unlinked pad of the given direction, %NULL.
+ * Returns: (transfer full) (nullable): unlinked pad of the given
+ * direction, %NULL.
*/
GstPad *
gst_bin_find_unlinked_pad (GstBin * bin, GstPadDirection direction)
@@ -3017,8 +3021,8 @@ gst_bin_find_unlinked_pad (GstBin * bin, GstPadDirection direction)
* and want them all ghosted, you will have to create the ghost pads
* yourself).
*
- * Returns: (transfer floating) (type Gst.Bin): a newly-created bin,
- * or %NULL if an error occurred.
+ * Returns: (transfer floating) (type Gst.Bin) (nullable): a
+ * newly-created bin, or %NULL if an error occurred.
*/
GstElement *
gst_parse_bin_from_description (const gchar * bin_description,
@@ -3159,7 +3163,8 @@ gst_util_get_timestamp (void)
*
* The complexity of this search function is O(log (num_elements)).
*
- * Returns: (transfer none): The address of the found element or %NULL if nothing was found
+ * Returns: (transfer none) (nullable): The address of the found
+ * element or %NULL if nothing was found
*/
gpointer
gst_util_array_binary_search (gpointer array, guint num_elements,
@@ -3778,8 +3783,9 @@ gst_pad_create_stream_id (GstPad * pad, GstElement * parent,
* The returned stream-id string should be treated as an opaque string, its
* contents should not be interpreted.
*
- * Returns: a newly-allocated copy of the stream-id for @pad, or %NULL.
- * g_free() the returned string when no longer needed.
+ * Returns: (nullable): a newly-allocated copy of the stream-id for
+ * @pad, or %NULL. g_free() the returned string when no longer
+ * needed.
*
* Since: 1.2
*/
diff --git a/gst/gstvalue.c b/gst/gstvalue.c
index f088cca..77e6fa1 100644
--- a/gst/gstvalue.c
+++ b/gst/gstvalue.c
@@ -4785,8 +4785,10 @@ gst_value_can_intersect (const GValue * value1, const GValue * value2)
/**
* gst_value_intersect:
- * @dest: (out caller-allocates) (transfer full): a uninitialized #GValue that will hold the calculated
- * intersection value. May be %NULL if the resulting set if not needed.
+ * @dest: (out caller-allocates) (transfer full) (allow-none):
+ * a uninitialized #GValue that will hold the calculated
+ * intersection value. May be %NULL if the resulting set if not
+ * needed.
* @value1: a value to intersect
* @value2: another value to intersect
*
@@ -4870,9 +4872,10 @@ gst_value_register_intersect_func (GType type1, GType type2,
/**
* gst_value_subtract:
- * @dest: (out caller-allocates): the destination value for the result if the
- * subtraction is not empty. May be %NULL, in which case the resulting set
- * will not be computed, which can give a fair speedup.
+ * @dest: (out caller-allocates) (allow-none): the destination value
+ * for the result if the subtraction is not empty. May be %NULL,
+ * in which case the resulting set will not be computed, which can
+ * give a fair speedup.
* @minuend: the value to subtract from
* @subtrahend: the value to subtract
*
@@ -5059,7 +5062,8 @@ gst_value_move (GValue * dest, GValue * src)
*
* Free-function: g_free
*
- * Returns: (transfer full): the serialization for @value or %NULL if none exists
+ * Returns: (transfer full) (nullable): the serialization for @value
+ * or %NULL if none exists
*/
gchar *
gst_value_serialize (const GValue * value)