summaryrefslogtreecommitdiffstats
path: root/libavdevice/v4l2.c
diff options
context:
space:
mode:
authorAndrey Utkin <andrey.utkin@corp.bluecherry.net>2014-10-29 01:59:25 +0100
committerCarl Eugen Hoyos <cehoyos@ag.or.at>2014-10-29 01:59:25 +0100
commitb608fba67265eae1d46d043793073afae80f4b42 (patch)
tree6214740a8daef6d71bd6a8b226bed3cae6e79027 /libavdevice/v4l2.c
parent19a6431ec247e4842236292cc5f8cfc8f87da11e (diff)
downloadffmpeg-streaming-b608fba67265eae1d46d043793073afae80f4b42.zip
ffmpeg-streaming-b608fba67265eae1d46d043793073afae80f4b42.tar.gz
Use v4l2 input format automatically if filename starts with "/dev/video"
Signed-off-by: Carl Eugen Hoyos <cehoyos@ag.or.at>
Diffstat (limited to 'libavdevice/v4l2.c')
-rw-r--r--libavdevice/v4l2.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c
index cf7a92c..59bb78b 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 - 1;
+ 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,
OpenPOWER on IntegriCloud