Find the answer to your Linux question:
Results 1 to 3 of 3
Suppose to have a module written in C by yourself, wich controls a V4L device. This module give an abstraction for using video inputs, video output, audio inputs and video ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux User
    Join Date
    Aug 2005
    Location
    Italy
    Posts
    401

    Multithreading, file access and race conditions...


    Suppose to have a module written in C by yourself, wich controls a V4L device. This module give an abstraction for using video inputs, video output, audio inputs and video outputs by multiple threads of the same program.

    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!
    When using Windows, have you ever told "Ehi... do your business?"
    Linux user #396597 (http://counter.li.org)

  2. #2
    Linux Guru lakerdonald's Avatar
    Join Date
    Jun 2004
    Location
    St. Petersburg, FL
    Posts
    5,035
    Can you clarify your question? Are you asking about how you can lock a file or section of code? Or what?

  3. #3
    Linux User
    Join Date
    Aug 2005
    Location
    Italy
    Posts
    401

    Library architecture...

    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.
    When using Windows, have you ever told "Ehi... do your business?"
    Linux user #396597 (http://counter.li.org)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •