On 19 Jan 2022, at 15:42, Romain Beauxis wrote:
Hi, thanks for the patch. I've not done a full code review yet, just a
few
initial remarks below:
This patch adds support for a new, audio-specific input device using
the documented and battle-tested AUHAL input. This provides a pendant
to the AudioToolbox audio-only output.
A couple of advantages for this:
* It avoids a lot of the complexity of supporting audio and video in a
single input
* The AUHAL API seems tested, documented and robust
* This implementation hopefully gives good control over audio latency
and also minimizes data copy
From: Romain Beauxis <to...@rastageeks.org>
To: ffmpeg-devel@ffmpeg.org
Subject: [PATCH] Add AudioToolbox audio input device.
Date: 18. January 2022 at 23:29
Signed-off-by: Romain Beauxis <to...@rastageeks.org>
---
configure | 5 +
doc/indevs.texi | 44 ++++
libavdevice/Makefile | 1 +
libavdevice/alldevices.c | 1 +
libavdevice/audiotoolbox_dec.m | 466
+++++++++++++++++++++++++++++++++
5 files changed, 517 insertions(+)
create mode 100644 libavdevice/audiotoolbox_dec.m
diff --git a/configure b/configure
index 1413122d87..80e39aae44 100755
--- a/configure
+++ b/configure
@@ -204,6 +204,7 @@ External library support:
--disable-avfoundation disable Apple AVFoundation framework
[autodetect]
--enable-avisynth enable reading of AviSynth script files
[no]
--disable-bzlib disable bzlib [autodetect]
+ --disable-coremedia disable Apple CoreMedia framework
[autodetect]
--disable-coreimage disable Apple CoreImage framework
[autodetect]
--enable-chromaprint enable audio fingerprinting with
chromaprint [no]
--enable-frei0r enable frei0r video filtering [no]
@@ -1750,6 +1751,7 @@ EXTERNAL_AUTODETECT_LIBRARY_LIST="
appkit
avfoundation
bzlib
+ coremedia
coreimage
iconv
libxcb
@@ -3493,6 +3495,8 @@ alsa_outdev_deps="alsa"
avfoundation_indev_deps="avfoundation corevideo coremedia pthreads"
avfoundation_indev_suggest="coregraphics applicationservices"
avfoundation_indev_extralibs="-framework Foundation"
+audiotoolbox_indev_deps="coremedia audiotoolbox"
+audiotoolbox_indev_extralibs="-framework CoreMedia -framework
AudioToolbox"
audiotoolbox_outdev_deps="audiotoolbox pthreads"
audiotoolbox_outdev_extralibs="-framework AudioToolbox -framework
CoreAudio"
bktr_indev_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h
dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h"
@@ -6340,6 +6344,7 @@ check_lib camera2ndk "stdbool.h stdint.h
camera/NdkCameraManager.h" ACameraManag
enabled appkit && check_apple_framework AppKit
enabled audiotoolbox && check_apple_framework AudioToolbox
enabled avfoundation && check_apple_framework AVFoundation
+enabled coremedia && check_apple_framework CoreMedia
enabled coreimage && check_apple_framework CoreImage
enabled metal && check_apple_framework Metal
enabled videotoolbox && check_apple_framework VideoToolbox
diff --git a/doc/indevs.texi b/doc/indevs.texi
index 858c0fa4e4..30a91d304f 100644
--- a/doc/indevs.texi
+++ b/doc/indevs.texi
@@ -103,6 +103,50 @@ Set the maximum number of frames to buffer.
Default is 5.
@end table
+@section AudioToolbox
+
+AudioToolbox input device.
+
+Allows native input from CoreAudio devices on OSX.
Nit: Nowadays it's macOS instead of OSX
+
+All available devices can be enumerated by using
@option{-list_devices true}, listing
+all device names, and corresponding unique ID.
Instead of adding another device that uses a custom list-devices option,
could you
instead implement the .get_device_list callback? (See alsa or pulse
modules for an
example) Then listing would work properly with the `ffmpeg -sources`
command and
devices could be iterated over using the avdevice APIs as well.
(Ideally we would have that for AVFoundation too but its really hard now
to do that
in a backwards compatible manner)
+
+@subsection Options
+
+AudioToolbox supports the following options:
+
+@table @option
+
+@item channels
+Set the number of channels. Default is device's default.
+
+@item frames_queue_length
+Maximum of buffers in the input queue
+
+@item buffer_frame_size
+Buffer frame size, gouverning internal latency
+
+@item big_endian
+Return big endian samples
+
+@item sample_format
+Sample format
+
+@end table
+
+@subsection Examples
+
+@itemize
+
+@item
+Print the list of supported devices
+@example
+$ ffmpeg -f audiotoolbox -list_devices true -i ""
+@end example
+
+@end itemize
+
@section avfoundation
[…]
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".