[FFmpeg-devel] [PATCH] Use v4l2 input format automatically if filename starts with "/dev/video"

Michael Niedermayer michaelni at gmx.at
Sat Oct 25 15:58:18 CEST 2014


On Fri, Oct 24, 2014 at 07:50:25PM +0400, Andrey Utkin wrote:
> ---
>  libavdevice/v4l2.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c
> index cf7a92c..ebc50bb 100644
> --- a/libavdevice/v4l2.c
> +++ b/libavdevice/v4l2.c
> @@ -806,6 +806,13 @@ static int device_try_init(AVFormatContext *ctx,
>      return ret;
>  }
>  
> +static int v4l2_read_probe(AVProbeData *p)
> +{
> +    if (av_strstart(p->filename, "/dev/video", NULL))
> +        return AVPROBE_SCORE_MAX;
> +    return 0;

can  strcmp || sscanf("/dev/video%d"
be used too ?
or would these miss some cases ?

also like others suggested the score maybe should be lower


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

it is not once nor twice but times without number that the same ideas make
their appearance in the world. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20141025/19394d37/attachment.asc>


More information about the ffmpeg-devel mailing list