On Mon, Nov 23, 2015 at 05:08:50PM -0500, Alexandre Lision wrote:
> --- a/configure
> +++ b/configure
> @@ -4557,6 +4559,11 @@ check_header linux/fb.h
> check_header linux/videodev2.h
> check_struct linux/videodev2.h "struct v4l2_frmivalenum" discrete
>
> +check_header AVFoundation/AVFoundation.h &&
> + check_objcflags -fobjc-arc &&
> + add_extralibs -framework Foundation -framework AVFoundation -framework
> CoreMedia || \
> + disable AVFoundation_AVFoundation_h
unnecessary \
> --- a/libavdevice/Makefile
> +++ b/libavdevice/Makefile
> @@ -9,6 +9,7 @@ OBJS = alldevices.o
> \
> # input/output devices
> OBJS-$(CONFIG_ALSA_INDEV) += alsa_dec.o alsa.o
> OBJS-$(CONFIG_ALSA_OUTDEV) += alsa_enc.o alsa.o
> +OBJS-$(CONFIG_AVFOUNDATION_INDEV) += avfoundation_dec.o
> OBJS-$(CONFIG_BKTR_INDEV) += bktr.o
> OBJS-$(CONFIG_DV1394_INDEV) += dv1394.o
> OBJS-$(CONFIG_FBDEV_INDEV) += fbdev.o
stray tab
The _dec suffix is pointless and not shared by other implementations
unless there is a matching outdev.
> --- /dev/null
> +++ b/libavdevice/avfoundation_dec.m
> @@ -0,0 +1,521 @@
> +
> +static const struct AVPixelFormatMap pixel_format_map[] = {
> + { AV_PIX_FMT_MONOBLACK, kCVPixelFormatType_1Monochrome },
> + { AV_PIX_FMT_RGB555BE, kCVPixelFormatType_16BE555 },
> + { AV_PIX_FMT_RGB555LE, kCVPixelFormatType_16LE555 },
> + { AV_PIX_FMT_RGB565BE, kCVPixelFormatType_16BE565 },
> + { AV_PIX_FMT_RGB565LE, kCVPixelFormatType_16LE565 },
> + { AV_PIX_FMT_RGB24, kCVPixelFormatType_24RGB },
> + { AV_PIX_FMT_BGR24, kCVPixelFormatType_24BGR },
> + { AV_PIX_FMT_ARGB, kCVPixelFormatType_32ARGB },
> + { AV_PIX_FMT_BGRA, kCVPixelFormatType_32BGRA },
> + { AV_PIX_FMT_ABGR, kCVPixelFormatType_32ABGR },
> + { AV_PIX_FMT_RGBA, kCVPixelFormatType_32RGBA },
> + { AV_PIX_FMT_BGR48BE, kCVPixelFormatType_48RGB },
> + { AV_PIX_FMT_UYVY422, kCVPixelFormatType_422YpCbCr8 },
> + { AV_PIX_FMT_YUVA444P, kCVPixelFormatType_4444YpCbCrA8R },
> + { AV_PIX_FMT_YUVA444P16LE, kCVPixelFormatType_4444AYpCbCr16 },
> + { AV_PIX_FMT_YUV444P, kCVPixelFormatType_444YpCbCr8 },
> + { AV_PIX_FMT_YUV422P16, kCVPixelFormatType_422YpCbCr16 },
> + { AV_PIX_FMT_YUV422P10, kCVPixelFormatType_422YpCbCr10 },
> + { AV_PIX_FMT_YUV444P10, kCVPixelFormatType_444YpCbCr10 },
> + { AV_PIX_FMT_YUV420P, kCVPixelFormatType_420YpCbCr8Planar },
> + { AV_PIX_FMT_NV12,
> kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange },
> + { AV_PIX_FMT_YUYV422, kCVPixelFormatType_422YpCbCr8_yuvs },
> +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
> + { AV_PIX_FMT_GRAY8, kCVPixelFormatType_OneComponent8 },
> +#endif
> + { AV_PIX_FMT_NONE, 0 }
> +};
The backwards-compatibility ifdef looks pointless. OS X 10.8 is quite
obsolete already, much more so when this comes into widespread use.
> +#define OFFSET(x) offsetof(AVFoundationCaptureContext, x)
> +#define DEC AV_OPT_FLAG_DECODING_PARAM
> +static const AVOption options[] = {
> + { "list_devices", "List available devices and exit",
> OFFSET(list_devices), AV_OPT_TYPE_INT, {.i64 = 0 }, 0,
> INT_MAX, DEC, "list_devices" },
> + { "all", "Show all the supported devices",
> OFFSET(list_devices), AV_OPT_TYPE_CONST, {.i64 = ALL_DEVICES }, 0,
> INT_MAX, DEC, "list_devices" },
> + { "audio", "Show only the audio devices",
> OFFSET(list_devices), AV_OPT_TYPE_CONST, {.i64 = AUDIO_DEVICES }, 0,
> INT_MAX, DEC, "list_devices" },
> + { "video", "Show only the video devices",
> OFFSET(list_devices), AV_OPT_TYPE_CONST, {.i64 = VIDEO_DEVICES }, 0,
> INT_MAX, DEC, "list_devices" },
> + { NULL },
> +};
spaces inside {} please
> + // Take stream info from the first frame.
> + while (ctx->frames_captured < 1) {
> + CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.1, YES);
> + }
nit: pointless {}
> + image_buffer = ctx->current_frame;
> + image_buffer_size = CVImageBufferGetEncodedSize(image_buffer);
nit: align
> + if (ctx->current_frame) {
> + CFRelease(ctx->current_frame);
> + }
nit: pointless {}
> +/**
> + * Try to open device given in filename
> + * Two supported formats: "device_unique_id" or "[device_unique_id]"
> + */
> +static AVCaptureDevice* create_device(AVFormatContext *s)
Having that comment as doxygen seems pretty pointless.
> + if (ctx->current_frame != nil) {
> + if (av_new_packet(pkt,
> (int)CVPixelBufferGetDataSize(ctx->current_frame)) < 0) {
> + return AVERROR(EIO);
> + }
nit: pointless {}
> +AVInputFormat ff_avfoundation_demuxer = {
> + .name = "avfoundation",
> + .long_name = NULL_IF_CONFIG_SMALL("AVFoundation AVCaptureDevice
> grab"),
The name of an internal struct has no place in .long_name.
Diego
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel