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

Reimar Döffinger Reimar.Doeffinger at gmx.de
Sat Oct 25 15:28:25 CEST 2014


On Sat, Oct 25, 2014 at 03:08:10PM +0200, wm4 wrote:
> On Sat, 25 Oct 2014 14:43:39 +0200
> Nicolas George <george at nsup.org> wrote:
> > That would not be heavy-weight, that would be outright irresponsible:
> > ioctl() opcodes are not globally unique. An opcode that maps to a harmless
> > probe on v4l devices can trigger catastrophic consequences on other devices.
> > 
> > (Remember 2003, when installing Mandrake 9.2 would brick LG CD drives? That
> > was the same issue, but our case is worse because what Mandrake did was
> > actually supposed to work reliably if LG had not messed their firmware.)
> > 
> > (If your conclusion is that the ioctl() interface is braindead, I am right
> > there with you, but that is something we have to live with.)
> 
> Then there's no sane way to handle this. Basically, you need to know:
> yes, this is a video device.

I think this might be the whole reason for the disagreement.
Me and Nicolas don't think there is any reason at all for you to
_know_ it is a video device.
That's why we have probe scores.
We just make the best guess we find reasonable and then assign a score
corresponding to the confidence we have in that.
So I actually don't see much of an issue with the patch except the
question which confidence we should assign to a test that just
checks for /dev/video.
Anything I miss?

> > > I admittedly just assumed that v4l2:///dev/video/... would work
> > > currently. If not, that sounds like something that can and should
> > > be fixed.
> > 
> > Well, "foo:" prefixes are normally reserved for protocols. We could add to
> > that "or formats with the NOFILE flag", that would probably make things
> > better. Or if we are afraid to trigger untested corner cases, have a
> > dedicated new flag AVFMT_PROTO_PREFIX or something.
> 
> Such a flag might probably work...

I think this is too complex and not directly related to this.
Maybe we should move it to a different thread if someone wants to work
on it?


More information about the ffmpeg-devel mailing list