[FFmpeg-devel] [PATCH 1/2] lavd/v4l2: implement list device callback

Lukasz Marek lukasz.m.luki2 at gmail.com
Sun Dec 21 23:39:05 CET 2014


On 21.12.2014 22:43, Lukasz Marek wrote:
> Signed-off-by: Lukasz Marek <lukasz.m.luki2 at gmail.com>
> ---
>   libavdevice/v4l2.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
>   1 file changed, 58 insertions(+)
>
> diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c
> index 2969980..9d4d7ae 100644
> --- a/libavdevice/v4l2.c
> +++ b/libavdevice/v4l2.c
> @@ -1006,6 +1006,63 @@ static int v4l2_read_close(AVFormatContext *ctx)
>       return 0;
>   }
>
> +static int v4l2_get_device_list(AVFormatContext *ctx, AVDeviceInfoList *device_list)
> +{
> +    struct video_data *s = ctx->priv_data;
> +    AVDeviceInfo *device = NULL;
> +    struct v4l2_capability cap;
> +    int i, ret = 0;
> +
> +    if (!device_list)
> +        return AVERROR(EINVAL);
> +
> +    for (i = 0; i <= 31; i++) {
> +        snprintf(ctx->filename, sizeof(ctx->filename), "/dev/video%d", i);

I wasn't sure this is correct. I changed this loop to opendir/readdir - 
similar way v4l-utils does.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-lavd-v4l2-implement-list-device-callback.patch
Type: text/x-patch
Size: 3325 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20141221/47d19bf7/attachment.bin>


More information about the ffmpeg-devel mailing list