[FFmpeg-devel] [PATCH] configure: Check linking against CoreGraphics or, ApplicationServices framework for avfoundation input device.

Carl Eugen Hoyos cehoyos at ag.or.at
Sun Feb 8 15:19:40 CET 2015


Hi!

On Wednesday 04 February 2015 01:48:53 pm Thilo Borgmann wrote:
>
> fixes Ticket #4238.
>
> Testing for CGImageGetTypeID function is questionable (see trac
> discussion). If someone has a better idea, please let me know.

Alternative patch attached.

Also attached is a patch that I believe is necessary for 
iOS audio capture, but it is mostly untested.
(It allows device listing though.)

Please comment, Carl Eugen
-------------- next part --------------
diff --git a/configure b/configure
index f31d372..d948757 100755
--- a/configure
+++ b/configure
@@ -2483,7 +2483,7 @@ xwma_demuxer_select="riffdec"
 # indevs / outdevs
 alsa_indev_deps="alsa_asoundlib_h snd_pcm_htimestamp"
 alsa_outdev_deps="alsa_asoundlib_h"
-avfoundation_indev_extralibs="-framework CoreVideo -framework Foundation -framework AVFoundation -framework CoreMedia -framework CoreGraphics"
+avfoundation_indev_extralibs="-framework CoreVideo -framework Foundation -framework AVFoundation -framework CoreMedia"
 avfoundation_indev_select="avfoundation"
 bktr_indev_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h"
 caca_outdev_deps="libcaca"
@@ -4868,7 +4868,11 @@ for func in $MATH_FUNCS; do
 done
 
 # these are off by default, so fail if requested and not available
-enabled avfoundation_indev && { check_header_oc AVFoundation/AVFoundation.h || disable avfoundation_indev; }
+enabled avfoundation_indev && { check_header_oc AVFoundation/AVFoundation.h &&
+                                { check_lib2 CoreGraphics/CoreGraphics.h CGGetActiveDisplayList -framework ApplicationServices ||
+                                  check_lib2 CoreGraphics/CoreGraphics.h CGGetActiveDisplayList -framework CoreGraphics ||
+                                  true; } ||
+                                disable avfoundation_indev; }
 enabled avisynth          && { { check_lib2 "windows.h" LoadLibrary; } ||
                                { check_lib2 "dlfcn.h" dlopen -ldl; } ||
                                die "ERROR: LoadLibrary/dlopen not found for avisynth"; }
-------------- next part --------------
diff --git a/libavdevice/avfoundation.m b/libavdevice/avfoundation.m
index 1a7eb5b..e1d1050 100644
--- a/libavdevice/avfoundation.m
+++ b/libavdevice/avfoundation.m
@@ -500,8 +500,14 @@ static int get_audio_config(AVFormatContext *s)
 
     if (basic_desc->mFormatID == kAudioFormatLinearPCM &&
         ctx->audio_float &&
+        ctx->audio_bits_per_sample == 32 &&
         ctx->audio_packed) {
         stream->codec->codec_id = ctx->audio_be ? AV_CODEC_ID_PCM_F32BE : AV_CODEC_ID_PCM_F32LE;
+    } else if (basic_desc->mFormatID == kAudioFormatLinearPCM &&
+        ctx->audio_signed_integer &&
+        ctx->audio_bits_per_sample == 16 &&
+        ctx->audio_packed) {
+        stream->codec->codec_id = ctx->audio_be ? AV_CODEC_ID_PCM_S16BE : AV_CODEC_ID_PCM_S16LE;
     } else {
         av_log(s, AV_LOG_ERROR, "audio format is not supported\n");
         return 1;


More information about the ffmpeg-devel mailing list