GNOME Bugzilla – Bug 753265
osxaudio: Add device provider support
Last modified: 2016-07-04 20:45:58 UTC
Currently, pulse, v4l2, windows kernel streaming video src implemented device provider. I think if osx plugins support this, it would be very useful.
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.
Thanks Sebastian, it will help me a lot!
This has been very old. But I can start to work on this!
The code is also already in avfvideosrc.m: https://cgit.freedesktop.org/gstreamer/gst-plugins-bad/tree/sys/applemedia/avfvideosrc.m#n421
Anything else missing here, maybe for another plugin?
I'm looking into good/sys/osxaudio for now:)
And then osxvideo also, if I can.
Sure, let us know if you find something that should be implemented here still :)
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.
Created attachment 326306 [details] [review] osxaudio: Support audio device provider on osx Fix some mistakes in description.
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 :)
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.
Created attachment 326854 [details] [review] osxaudio: Support audio device provider on osx Following slomo's comment.
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!
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 :)
Created attachment 326989 [details] [review] osxaudio: Support audio device provider on osx Following slomo's comment :)
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.
Created attachment 326993 [details] [review] osxaudio: Support audio device provider on osx 5th patch, following slomo's comment :)
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?
(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.
No worries :)
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.
Created attachment 327120 [details] [review] osxaudio: Support audio device provider on osx
Attachment 327120 [details] pushed as 1face2a - osxaudio: Support audio device provider on osx
For any other OSX specific plugins, please open new bugs if you work on them. avfvideosrc might be another candidate :) Thanks for the patch
Sure :) Thanks for merge!
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 ?