Results 1 to 3 of 3
Enjoy an ad free experience by logging in. Not a member yet? Register.
- Join Date
- Aug 2005
Multithreading, file access and race conditions...
If every thread share the same file descriptor, there is some problem using multiple features available by the V4L driver (for example a thread uses video input, another the tuner)? That's because multiple threads call ioctl routines on the same file descriptor?
If so, I can suppose to solve the problem opening the same file multiple times (for each thread): if -EBUSy is returned it means driver can handle multiple instances. Is it right?
Damn, it will take so long to implement that's all! And if won't work?
Thanks for all help!
Can you clarify your question? Are you asking about how you can lock a file or section of code? Or what?
- Join Date
- Aug 2005
I have in the same library audio/video decoders interfaces, audio/video outputs. Decoders takes data from demuxers, wich read from any input and separate audio data from video data. All these interfaces permits the selection of particoular module (i.e.: audio output interface can be implemented via ALSA, OSS, NAS, Arts...)
To introduce V4L capabilities in my library, I think to insert a general V4L module, wich permits with the same handle to make video input, video output, audio output, audio input... (but I don't know it will works... this is the topic of my post).
V4L audio/video inputs routines will be used in a demuxer implementation, while V4L audio and video output routines will be used in a audio/video output module of my library.
The library architecture permits to create a demuxer wich reads audio and video data from a V4L device, send this data to decoders (if necessary), and finally output audio/video data on selected output devices. Because I can instanciate a V4L video input and at the same time an audio input (or V4L video input and V4L audio output... it don't care), I suppose to have a race condition for accessing the device.
I'd like to link my code, but I'm still learning cvs to post my project on sourceforget.net...
Finally the clarification: I know how to protect my race conditions... My problem is to know if I can use multiple features of the same V4L device (i.e.: video input and audio input), using the same file descriptor.