Am working on sending real time video data from an embedded Linux device on to a usb device. Am using the c language. Currently, I have a code that can detect the usb, my challenge is how to send the video data from the camera to the usb device.
Thanks in advance.
This question is marked "community wiki".
This is really an instrument-design question. Whole books have been written on developing real-time data acquisition systems. Below are just a few considerations.
Your first problem is going to be data rate. To sustain your throughput, you MUST flow data out as fast as it flows in. If you can do that, you can keep the process going until your USB device fills up.
For any sort of video, you'd better be using at least USB2 for output. Even then, the USB2 specification lists 480 Mbps as the maximum raw data rate and your actual data rate had better be FAR below that. (That's because although 480 Mbps is the raw data rate spec for USB2, device peculiarities and all the overhead of tossing data through the system will slow things down.)
Chances are that the the raw input from your video device will be much higher than the USB2 spec. Hence you'll have to do some real-time processing to decimate the data. Your output data rate will limit the video frame rate, pixel count, compression scheme, etc. that you can save. Assuming you've got a reasonably powerful machine, simple processing should be sustainable.
The software to do all of this could be as simple as a pipeline within a shell script. By using the shell, you'll save yourself all of the problems of buffering data within your C program. I STRONGLY suggest USING the power of the shell rather than trying to duplicate it in your own code.
In general, sending a binary stream to an output device using the shell can be done trivially by using "cat" or "dd" to the mounted output file. The system will automatically buffer data during interrupts. I'd suggest limiting your C programming to specific data-processing algorithms you want to perform.
This is ignoring all sorts of considerations of device latency, guaranteed response times, garbage collection, optimization, etc. But without additional details, as guerda said, one can't be more specific. And even with the details it's a non-trivial engineering project.
This answer is marked "community wiki".