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 753265 - osxaudio: Add device provider support
osxaudio: Add device provider support
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other Mac OS
: Normal enhancement
: 1.9.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-08-05 02:05 UTC by Hyunjun Ko
Modified: 2016-07-04 20:45 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
osxaudio: Support audio device provider on osx (17.64 KB, patch)
2016-04-18 07:46 UTC, Hyunjun Ko
none Details | Review
osxaudio: Support audio device provider on osx (17.46 KB, patch)
2016-04-19 06:59 UTC, Hyunjun Ko
none Details | Review
osxaudio: Support audio device provider on osx (16.92 KB, patch)
2016-04-27 11:34 UTC, Hyunjun Ko
none Details | Review
osxaudio: Support audio device provider on osx (16.35 KB, patch)
2016-04-29 02:59 UTC, Hyunjun Ko
none Details | Review
osxaudio: Support audio device provider on osx (19.43 KB, patch)
2016-04-29 07:40 UTC, Hyunjun Ko
none Details | Review
osxaudio: Support audio device provider on osx (18.12 KB, patch)
2016-04-29 08:13 UTC, Hyunjun Ko
none Details | Review
osxaudio: Support audio device provider on osx (19.43 KB, application/mbox)
2016-05-02 01:13 UTC, Hyunjun Ko
  Details
osxaudio: Support audio device provider on osx (19.43 KB, patch)
2016-05-02 01:14 UTC, Hyunjun Ko
committed Details | Review

Description Hyunjun Ko 2015-08-05 02:05:11 UTC
Currently, pulse, v4l2, windows kernel streaming video src implemented device provider.

I think if osx plugins support this, it would be very useful.
Comment 1 Sebastian Dröge (slomo) 2015-08-05 06:08:25 UTC
openwebrtc has some code for coreaudio and avf here: https://github.com/EricssonResearch/openwebrtc/blob/master/local/owr_device_list_avf.m

That could be taken into the relevant plugins.
Comment 2 Hyunjun Ko 2015-08-05 07:20:59 UTC
Thanks Sebastian, it will help me a lot!
Comment 3 Hyunjun Ko 2016-04-14 02:01:12 UTC
This has been very old. But I can start to work on this!
Comment 4 Joe Gorse 2016-04-14 02:17:23 UTC
The code is also already in avfvideosrc.m:
https://cgit.freedesktop.org/gstreamer/gst-plugins-bad/tree/sys/applemedia/avfvideosrc.m#n421
Comment 5 Sebastian Dröge (slomo) 2016-04-14 06:13:15 UTC
Anything else missing here, maybe for another plugin?
Comment 6 Hyunjun Ko 2016-04-14 06:16:11 UTC
I'm looking into good/sys/osxaudio for now:)
Comment 7 Hyunjun Ko 2016-04-14 06:18:15 UTC
And then osxvideo also, if I can.
Comment 8 Sebastian Dröge (slomo) 2016-04-14 06:22:55 UTC
Sure, let us know if you find something that should be implemented here still :)
Comment 9 Hyunjun Ko 2016-04-18 07:46:19 UTC
Created attachment 326224 [details] [review]
osxaudio: Support audio device provider on osx


I've completed for probing audio devices on osx platform.
It doesn't support hot-plugin yet. 
I'm still investigating into this, but I guess there's no simple way like pulse or v4l2 using udev.
Comment 10 Hyunjun Ko 2016-04-19 06:59:52 UTC
Created attachment 326306 [details] [review]
osxaudio: Support audio device provider on osx

Fix some mistakes in description.
Comment 11 Sebastian Dröge (slomo) 2016-04-27 07:55:00 UTC
Review of attachment 326306 [details] [review]:

Mostly looks good to me, thanks! You might want to update your mail address in the commit to your @igalia.com one though.

::: sys/osxaudio/gstosxaudiodeviceprovider.c
@@ +85,3 @@
+gst_osx_audio_device_provider_finalize (GObject * object)
+{
+  G_OBJECT_CLASS (gst_osx_audio_device_provider_parent_class)->finalize

No need for empty finalize functions

@@ +127,3 @@
+      kAudioDevicePropertyScopeInput;
+
+  AudioObjectPropertyAddress deviceNameAddress = {

We only allow declarations at the top of a block, not after some code

@@ +306,3 @@
+gst_osx_audio_device_finalize (GObject * object)
+{
+  G_OBJECT_CLASS (gst_osx_audio_device_parent_class)->finalize (object);

Can also go away because empty

@@ +338,3 @@
+      klass = "Audio/Source";
+
+      template_caps = gst_static_pad_template_get_caps (&src_factory);

Maybe we can reuse the pad templates from the elements here, and share them in a common place instead of copying them?

@@ +383,3 @@
+  }
+
+  return;

No need for the empty returns here

::: sys/osxaudio/gstosxaudiodeviceprovider.h
@@ +32,3 @@
+
+G_BEGIN_DECLS
+    typedef struct _GstOsxAudioDeviceProvider GstOsxAudioDeviceProvider;

Indentation wrong :)
Comment 12 Hyunjun Ko 2016-04-27 11:19:36 UTC
Review of attachment 326306 [details] [review]:

::: sys/osxaudio/gstosxaudiodeviceprovider.c
@@ +338,3 @@
+      klass = "Audio/Source";
+
+      template_caps = gst_static_pad_template_get_caps (&src_factory);

That's correct. This is exactly same as how osxaudiosrc and sink does get_caps.
Comment 13 Hyunjun Ko 2016-04-27 11:34:07 UTC
Created attachment 326854 [details] [review]
osxaudio: Support audio device provider on osx

Following slomo's comment.
Comment 14 Hyunjun Ko 2016-04-29 02:59:46 UTC
Created attachment 326986 [details] [review]
osxaudio: Support audio device provider on osx

slomo.
I totally misunderstood your comment about caps! :(
I reupload modiied patch.
Thanks!
Comment 15 Sebastian Dröge (slomo) 2016-04-29 07:23:24 UTC
Review of attachment 326986 [details] [review]:

::: sys/osxaudio/gstosxaudiodeviceprovider.c
@@ +302,3 @@
+
+      elem = gst_element_factory_make (element_name, "audiosrc");
+      template_caps = gst_pad_get_pad_template_caps (GST_BASE_SRC_PAD (elem));

I meant putting the caps into a header as a string #define, and then use that in both places. Creating an instance of the element here just to get the pad template caps seems a bit extreme :)
Comment 16 Hyunjun Ko 2016-04-29 07:40:43 UTC
Created attachment 326989 [details] [review]
osxaudio: Support audio device provider on osx

Following slomo's comment :)
Comment 17 Sebastian Dröge (slomo) 2016-04-29 07:47:35 UTC
Review of attachment 326989 [details] [review]:

::: sys/osxaudio/gstosxaudiosink.h
@@ +89,3 @@
 GType gst_osx_audio_sink_get_type (void);
 
+static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",

This way, every source file that includes the header has a copy of the pad template.

Make it an extern declaration in the header, and a non-static definition in the source file.
Comment 18 Hyunjun Ko 2016-04-29 08:13:38 UTC
Created attachment 326993 [details] [review]
osxaudio: Support audio device provider on osx

5th patch, following slomo's comment :)
Comment 19 Sebastian Dröge (slomo) 2016-04-29 08:45:40 UTC
Review of attachment 326993 [details] [review]:

You're missing the Makefile.am change to include the new file now :) Otherwise looks good, but it should probably be also made conditional for OSX... or does it compile/work on iOS too?
Comment 20 Hyunjun Ko 2016-04-29 08:56:51 UTC
(In reply to Sebastian Dröge (slomo) from comment #19)
> Review of attachment 326993 [details] [review] [review]:
> 
> You're missing the Makefile.am change to include the new file now :)
> Otherwise looks good, but it should probably be also made conditional for
> OSX... or does it compile/work on iOS too?

I was insane :(
I didn't check IOS.
I'm going to check to be conditional for OSX an to build on iOS.
Comment 21 Sebastian Dröge (slomo) 2016-04-29 09:01:20 UTC
No worries :)
Comment 22 Hyunjun Ko 2016-05-02 01:13:23 UTC
Created attachment 327119 [details]
osxaudio: Support audio device provider on osx

I re-worked to support osxaudiodeviceprovider only on OS_X
I confirmed it's ok to build on IOS, too.
Comment 23 Hyunjun Ko 2016-05-02 01:14:31 UTC
Created attachment 327120 [details] [review]
osxaudio: Support audio device provider on osx
Comment 24 Sebastian Dröge (slomo) 2016-05-02 06:58:59 UTC
Attachment 327120 [details] pushed as 1face2a - osxaudio: Support audio device provider on osx
Comment 25 Sebastian Dröge (slomo) 2016-05-02 06:59:48 UTC
For any other OSX specific plugins, please open new bugs if you work on them. avfvideosrc might be another candidate :)

Thanks for the patch
Comment 26 Hyunjun Ko 2016-05-02 07:01:47 UTC
Sure :) 
Thanks for merge!
Comment 27 Marcin Lewandowski 2016-07-04 20:45:58 UTC
I am not 100% sure, but isn't this code using also non-reliable integer device IDs which is the same issue as https://bugzilla.gnome.org/show_bug.cgi?id=759558 ?