[FFmpeg-devel] [PATCH] Use v4l2 input format automatically if filename starts with "/dev/video"
Nicolas George
george at nsup.org
Fri Oct 24 18:37:00 CEST 2014
Le tridi 3 brumaire, an CCXXIII, Andrey Utkin a écrit :
> ---
> 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;
MAX looks a bit high; maybe EXTENSION?
> + return 0;
> +}
> +
> static int v4l2_read_header(AVFormatContext *ctx)
> {
> struct video_data *s = ctx->priv_data;
> @@ -1033,6 +1040,7 @@ AVInputFormat ff_v4l2_demuxer = {
> .name = "video4linux2,v4l2",
> .long_name = NULL_IF_CONFIG_SMALL("Video4Linux2 device grab"),
> .priv_data_size = sizeof(struct video_data),
> + .read_probe = v4l2_read_probe,
> .read_header = v4l2_read_header,
> .read_packet = v4l2_read_packet,
> .read_close = v4l2_read_close,
Regards,
--
Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20141024/dde0b397/attachment.asc>
More information about the ffmpeg-devel
mailing list