[FFmpeg-devel] [PATCH] AVFoundation: Add -pixel_format option

Lukasz Marek lukasz.m.luki2 at gmail.com
Sun May 11 10:04:50 CEST 2014


> @@ -285,7 +312,7 @@ static int avf_read_header(AVFormatContext *s)
>       stream->codec->codec_type = AVMEDIA_TYPE_VIDEO;
>       stream->codec->width      = (int)image_buffer_size.width;
>       stream->codec->height     = (int)image_buffer_size.height;
> -    stream->codec->pix_fmt    = AV_PIX_FMT_RGB24;
> +    stream->codec->pix_fmt    = pxl_fmt_spec.ff_id;
>
>       CFRelease(ctx->current_frame);
>       ctx->current_frame = nil;
> @@ -352,6 +379,7 @@ static const AVOption options[] = {
>       { "true", "", 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, AV_OPT_FLAG_DECODING_PARAM, "list_devices" },
>       { "false", "", 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, AV_OPT_FLAG_DECODING_PARAM, "list_devices" },
>       { "video_device_index", "select video device by index for devices with same name (starts at 0)", offsetof(AVFContext, video_device_index), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
> +    { "pixel_format", "Set pixel format", offsetof(AVFContext, pixel_format), AV_OPT_TYPE_STRING, { .str = "24rgb" }, 0, 0, AV_OPT_FLAG_DECODING_PARAM},

It should be AV_OPT_TYPE_PIXEL_FMT
name can be removed from avf_pixel_formats and do mapping between enum 
AVPixelFormat and AVFoundation directly.


More information about the ffmpeg-devel mailing list