Aysun Tasyapi wrote:
I am trying to give a yuv file(4.2.2) to encode demo instead of using
camera.
But i don't know what i must change. What must i change in code?
If you know Would you help me? Would you explain please?
Easy:
1. Add new parameter to the command options, e.g. -f | --file
Edit main.c
static void parseArgs(...)
{
const struct shortOptions -> add "f:" at the beginning/end of the string
const struct longOptions -> add: {"file", required_argument, NULL,
'f'} at the beginning/end of the table (must match with shortOptions
in the switch statement (which checks for valid params add:
switch(c) {
case: 'f': (do your yuv file checks here, save the name, etc.)
}
You can really skip this step and hardcode filename in the source, w/e.
2. Edit video.c
in "void *videoThrFxn(void *arg)" add the following:
a) open the desired file
b) in "while (!gblGetQuit()) {" loop find all occurrences to ioctl(..).
Ioctl is used to exchange buffers with the v4l driver. Comment out these
sections.
Instead of getting a framebuffer from the driver (first ioctl in while()
loop) do reading the next frame from file (you've previously opened).
You should read frames from file to some kind of buffer, which you can
allocate anywhere before while() loop.
You should also make this frame visible as an input buffer to the
encoder, you can do this by replacing:
e.frameBuffer = vidBufs[v4l2buf.index].start;
with
e.frameBuffer = your_buffer_with_a_raw_frame;
(NOTE: you can leave ioctl's where they are, and just don't use the
buffers returned by them, instead use the buffer read from the file, w/e)
And that's it. Of course you have to handle end of file conditions, etc.
Best,
--
Adam Dawidziuk
Sentivision
_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source