Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThilo Borgmann <thilo.borgmann@mail.de>2014-11-13 19:22:48 +0300
committerMichael Niedermayer <michaelni@gmx.at>2014-11-14 20:28:12 +0300
commit2045334239459f49e513a42e1b9965a94c5a0f5f (patch)
treee809bbbf8b664d5c44c57cb44db6205b6599b88a /libavdevice/avfoundation.m
parentcde0ad5ea780b1fef1890b3f55d8e6e3e1bdf96f (diff)
lavd/avfoundation: Introduce device alias 'none' to allow the user to record only audio or video.
Changes the selection of a default device to none instead of the system default device. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavdevice/avfoundation.m')
-rw-r--r--libavdevice/avfoundation.m16
1 files changed, 10 insertions, 6 deletions
diff --git a/libavdevice/avfoundation.m b/libavdevice/avfoundation.m
index 1207cbf038..1a7eb5b27e 100644
--- a/libavdevice/avfoundation.m
+++ b/libavdevice/avfoundation.m
@@ -604,7 +604,10 @@ static int avf_read_header(AVFormatContext *s)
goto fail;
}
} else if (ctx->video_filename &&
- strncmp(ctx->video_filename, "default", 7)) {
+ strncmp(ctx->video_filename, "none", 4)) {
+ if (!strncmp(ctx->video_filename, "default", 7)) {
+ video_device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
+ } else {
// looking for video inputs
for (AVCaptureDevice *device in video_devices) {
if (!strncmp(ctx->video_filename, [[device localizedName] UTF8String], strlen(ctx->video_filename))) {
@@ -626,13 +629,12 @@ static int avf_read_header(AVFormatContext *s)
}
}
#endif
+ }
if (!video_device) {
av_log(ctx, AV_LOG_ERROR, "Video device not found\n");
goto fail;
}
- } else {
- video_device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
}
// get audio device
@@ -646,7 +648,10 @@ static int avf_read_header(AVFormatContext *s)
audio_device = [devices objectAtIndex:ctx->audio_device_index];
} else if (ctx->audio_filename &&
- strncmp(ctx->audio_filename, "default", 7)) {
+ strncmp(ctx->audio_filename, "none", 4)) {
+ if (!strncmp(ctx->audio_filename, "default", 7)) {
+ audio_device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeAudio];
+ } else {
NSArray *devices = [AVCaptureDevice devicesWithMediaType:AVMediaTypeAudio];
for (AVCaptureDevice *device in devices) {
@@ -655,13 +660,12 @@ static int avf_read_header(AVFormatContext *s)
break;
}
}
+ }
if (!audio_device) {
av_log(ctx, AV_LOG_ERROR, "Audio device not found\n");
goto fail;
}
- } else {
- audio_device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeAudio];
}
// Video nor Audio capture device not found, looking for AVMediaTypeVideo/Audio