Commit 5ac3a309 authored by Felix Matouschek's avatar Felix Matouschek Committed by Michael Niedermayer

avdevice: add android_camera indev

This commit adds an indev for Android devices on API level 24+ which
uses the Android NDK Camera2 API to capture video from builtin cameras
Signed-off-by: 's avatarFelix Matouschek <felix@matouschek.org>
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent ecb3d6ed
......@@ -39,6 +39,7 @@ version <next>:
- Removed the ffmenc and ffmdec muxer and demuxer
- VideoToolbox HEVC encoder and hwaccel
- VAAPI-accelerated ProcAmp (color balance), denoise and sharpness filters
- Add android_camera indev
version 3.4:
......
......@@ -281,6 +281,7 @@ libavdevice
avfoundation.m Thilo Borgmann
android_camera.c Felix Matouschek
decklink* Marton Balint
dshow.c Roger Pack (CC rogerdpack@gmail.com)
fbdev_enc.c Lukasz Marek
......
......@@ -3081,6 +3081,8 @@ xmv_demuxer_select="riffdec"
xwma_demuxer_select="riffdec"
# indevs / outdevs
android_camera_indev_deps="android camera2ndk mediandk pthreads"
android_camera_indev_extralibs="-landroid -lcamera2ndk -lmediandk"
alsa_indev_deps="alsa"
alsa_outdev_deps="alsa"
avfoundation_indev_deps="avfoundation corevideo coremedia pthreads"
......@@ -5756,6 +5758,10 @@ check_lib shell32 "windows.h shellapi.h" CommandLineToArgvW -lshell32
check_lib wincrypt "windows.h wincrypt.h" CryptGenRandom -ladvapi32
check_lib psapi "windows.h psapi.h" GetProcessMemoryInfo -lpsapi
check_lib android android/native_window.h ANativeWindow_acquire -landroid
check_lib mediandk "stdint.h media/NdkImage.h" AImage_delete -lmediandk
check_lib camera2ndk "stdbool.h stdint.h camera/NdkCameraManager.h" ACameraManager_create -lcamera2ndk
enabled appkit && check_apple_framework AppKit
enabled audiotoolbox && check_apple_framework AudioToolbox
enabled avfoundation && check_apple_framework AVFoundation
......
......@@ -63,6 +63,46 @@ Set the number of channels. Default is 2.
@end table
@section android_camera
Android camera input device.
This input devices uses the Android Camera2 NDK API which is
available on devices with API level 24+. The availability of
android_camera is autodetected during configuration.
This device allows capturing from all cameras on an Android device,
which are integrated into the Camera2 NDK API.
The available cameras are enumerated internally and can be selected
with the @var{camera_index} parameter. The input file string is
discarded.
Generally the back facing camera has index 0 while the front facing
camera has index 1.
@subsection Options
@table @option
@item video_size
Set the video size given as a string such as 640x480 or hd720.
Falls back to the first available configuration reported by
Android if requested video size is not available or by default.
@item framerate
Set the video framerate.
Falls back to the first available configuration reported by
Android if requested framerate is not available or by default (-1).
@item camera_index
Set the index of the camera to use. Default is 0.
@item input_queue_size
Set the maximum number of frames to buffer. Default is 5.
@end table
@section avfoundation
AVFoundation input device.
......
......@@ -14,6 +14,7 @@ OBJS-$(CONFIG_SHARED) += reverse.o
# input/output devices
OBJS-$(CONFIG_ALSA_INDEV) += alsa_dec.o alsa.o timefilter.o
OBJS-$(CONFIG_ALSA_OUTDEV) += alsa_enc.o alsa.o
OBJS-$(CONFIG_ANDROID_CAMERA_INDEV) += android_camera.o
OBJS-$(CONFIG_AVFOUNDATION_INDEV) += avfoundation.o
OBJS-$(CONFIG_BKTR_INDEV) += bktr.o
OBJS-$(CONFIG_CACA_OUTDEV) += caca.o
......
......@@ -29,6 +29,7 @@
/* devices */
extern AVInputFormat ff_alsa_demuxer;
extern AVOutputFormat ff_alsa_muxer;
extern AVInputFormat ff_android_camera_demuxer;
extern AVInputFormat ff_avfoundation_demuxer;
extern AVInputFormat ff_bktr_demuxer;
extern AVOutputFormat ff_caca_muxer;
......
This diff is collapsed.
......@@ -28,7 +28,7 @@
#include "libavutil/version.h"
#define LIBAVDEVICE_VERSION_MAJOR 58
#define LIBAVDEVICE_VERSION_MINOR 1
#define LIBAVDEVICE_VERSION_MINOR 2
#define LIBAVDEVICE_VERSION_MICRO 100
#define LIBAVDEVICE_VERSION_INT AV_VERSION_INT(LIBAVDEVICE_VERSION_MAJOR, \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment