After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 574434 - [camerabin] Changing default video/audio source for Windows
[camerabin] Changing default video/audio source for Windows
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
0.10.10
Other Windows
: Normal normal
: 0.10.17
Assigned To: Stefan Sauer (gstreamer, gtkdoc dev)
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2009-03-07 00:27 UTC by Andoni Morales
Modified: 2009-11-05 22:48 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
set default sources and sink in a more flexible way (11.80 KB, patch)
2009-10-15 13:28 UTC, Stefan Sauer (gstreamer, gtkdoc dev)
none Details | Review

Description Andoni Morales 2009-03-07 00:27:48 UTC
v4lsrc and pulsesrc are not avalaible in Windows, instead we should use dshowaudiosrc and ksvideosrc.

In gstcamerabin.c:

#ifdef WIN32
   #define DEFAULT_SRC_VID_SRC "ksvideosrc"
#else
   #define DEFAULT_SRC_VID_SRC "v4l2src"
#endif

In camerabinvideo.c:

#ifdef WIN32
   #define DEFAULT_AUD_SRC "dshowaudiosrc"
#else
   #define DEFAULT_AUD_SRC "pulsesrc"
#endif
Comment 1 Andoni Morales 2009-03-07 00:35:07 UTC
I forgot to mention the involved plugin: camerabin
Comment 2 Stefan Sauer (gstreamer, gtkdoc dev) 2009-03-10 20:45:04 UTC
Andoni, would using autoaudiosrc and autovideosrc work? Do  "ksvideosrc"
and "dshowaudiosrc" have a rank>0?

Comment 3 Andoni Morales 2009-03-10 21:29:28 UTC
I think it wouldn't work as both of them have a "0" rank
Comment 4 Tim-Philipp Müller 2009-03-10 21:42:49 UTC
I don't think the auto* plugins will exclude elements based on rank, they'll only use the rank for sorting (unlike decodebin/playbin).
Comment 5 Andoni Morales 2009-03-10 21:50:32 UTC
Using autovideosrc and autoaudiosrc I get these errors from the pipeline:

..\..\gst\autodetect\gstautovideosrc.c(322): gst_auto_video_src_find_best (): /GstPipeline:pipeline0/GstAutoVideoSrc:autovideosrc0:
Failed to find a usable video source


..\..\gst\autodetect\gstautoaudiosrc.c(325): gst_auto_audio_src_find_best (): /GstPipeline:pipeline0/GstAutoAudioSrc:autoaudiosrc0:
Failed to find a usable audio source
Comment 6 Stefan Sauer (gstreamer, gtkdoc dev) 2009-03-11 08:09:58 UTC
All 4 elements have this code:

  /* only select elements with autoplugging rank */
  rank = gst_plugin_feature_get_rank (feature);
  if (rank < GST_RANK_MARGINAL)
    return FALSE;

So the plugins need to be GST_RANK_MARGINAL atleast. If those are the best elements for windows, it would be good to make MOVING to good request for them and at the same time ensure they pass the plugin-moving requirements.
Comment 7 Tim-Philipp Müller 2009-03-11 09:48:53 UTC
> So the plugins need to be GST_RANK_MARGINAL at least.

You're right, I was mixing things up with the uri handlers. Sorry for the noise.

If the plugins work somewhat reliably, we may just as well give them a rank, regardless of whether they're in -bad or -good. Especially if there's no good/better alternative.

Andoni: do these two elements work well for you then?
Comment 8 Andoni Morales 2009-03-11 10:06:26 UTC
Actualy, there is only one audio source element for Windows: dhsowaudiosrc, which is working well.
Instead we have two video source elements, dshowvideosrc and ksvideosrc. Both of them works well. I prefer ksvideosrc, which has a very low latency and works better on Vista. The problem is that ksvideosrc seems to be unmantained by Ole Andre Ravnas, so the best choice could be dshowvideosrc.
Comment 9 Stefan Sauer (gstreamer, gtkdoc dev) 2009-10-08 07:41:47 UTC
Andoni, how shall we proceed here?  Give both dshowaudiosrc, dshowvideosrc as RANK for now? The defaults in camerabin should also be changed regardless to use the auto*src/sink elements.
Comment 10 Andoni Morales 2009-10-08 09:47:06 UTC
Hi Stefan,
Over the past year I have been working to provide a comprehensive set of precompiled binaries for GStreamer in Windows through a project called GStreamer WinBuild, a complete build system for Linux and Windows (we are also working in giving support for Mac OSX).
The feedback I get from the users is that both dshowvideosrc and dshowaudiosrc  are doing well on XP and Vista even if the quality of the plugins is not the best we could expect (ksvideosrc is also there but does work very well on Vista). Moreover Julien Isorce has been working lately in refactoring the dshow stuff and has merged important improvements in the audio source elements(Bug #587595). So we can consider that these source elements are actually the best ones.
We are currently ranking PRIMARY both dshowvideosrc and dshowaudiosrc elements, so these elements are electable by autovideosrc and autoaudiosrc.
We are also using in gst-plugins-good/win32/common/config.h the following settings:

/* Default audio sink */
#define DEFAULT_AUDIOSINK "directsoundsink"

/* Default audio source */
#define DEFAULT_AUDIOSRC "dshowaudiosrc"

/* Default video sink */
#define DEFAULT_VIDEOSINK "directdrawsink"

/* Default video source */
#define DEFAULT_VIDEOSRC "dshowvideosrc"

I don't know if it has some effect somewhere, but in case...
 
Ragarding camerabin, I suppose that using auto*src would be the best option, even if I'd prefer using gconf*src on linux so users could select the default sources to use through 'gstreamer-properties'
Comment 11 Stefan Sauer (gstreamer, gtkdoc dev) 2009-10-09 15:34:39 UTC
I think we need to do the same thing as in playbin (playsink.c)

  if (playsink->video_sink) {
    GST_DEBUG_OBJECT (playsink, "trying configured videosink");
    chain->sink = try_element (playsink, playsink->video_sink, FALSE);
  } else {
    /* only try fallback if no specific sink was chosen */
    if (chain->sink == NULL) {
      GST_DEBUG_OBJECT (playsink, "trying autovideosink");
      elem = gst_element_factory_make ("autovideosink", "videosink");
      chain->sink = try_element (playsink, elem, TRUE);
    }
    if (chain->sink == NULL) {
      /* if default sink from config.h is different then try it too */
      if (strcmp (DEFAULT_VIDEOSINK, "autovideosink")) {
        GST_DEBUG_OBJECT (playsink, "trying " DEFAULT_VIDEOSINK);
        elem = gst_element_factory_make (DEFAULT_VIDEOSINK, "videosink");
        chain->sink = try_element (playsink, elem, TRUE);
      }
    }
  }
  if (chain->sink == NULL)
    goto no_sinks;

Speaking of that, it should probably first try DEFAULT_VIDEOSINK and use autovideosink as a last resort (if its different from DEFAULT_VIDEOSINK).

This way a packager can e.g. configure --with-default-videosink=gconfvideosink for gnome or --with-default-videosink=directdrawsink on windows.
Comment 12 Andoni Morales 2009-10-09 16:40:56 UTC
+1
I think it's an excellent option.
Comment 13 Stefan Sauer (gstreamer, gtkdoc dev) 2009-10-15 13:28:42 UTC
Created attachment 145518 [details] [review]
set default sources and sink in a more flexible way

I'll commit this after the freeze.
Comment 14 Stefan Sauer (gstreamer, gtkdoc dev) 2009-11-05 22:48:06 UTC
commit 52e314ef812478661a56f2141e0958f332bb92d1
Author: Stefan Kost <ensonic@users.sf.net>
Date:   Thu Oct 15 16:15:03 2009 +0300

    camerabin: set camerabin default sources/sinks like in playbin2. Fixes #574434
    
    This uses same approach like in playbin, namely checking for user defined
    element, auto{audio,video}{sink,src} and finally DEFAULT_{AUDIO,VIDEO}{SRC,SINK}
    defines from config.h.