Hans Verkuil wrote:
> On Friday 03 November 2006 18:19, Duncan Webb wrote:
>> Hans Verkuil wrote:
>>> On Thursday 02 November 2006 19:50, Duncan Webb wrote:
>>>> Duncan Webb wrote:
>>>>> Hans Verkuil wrote:
>>>>>> On Tuesday 31 October 2006 07:09, Duncan Webb wrote:
>>>>>>>>> Aha, need to use VIDIOC_STREAMOFF. I'll try this out in the
>>>>>>>>> next few days and let you know.
>>>>>>>> Thanks, this works quite nicely.
>>>>>>>>
>>>>>>>> There are a couple of things that I've noticed:
>>>>>> Oops, I missed the following questions in your original email.
>>>>>>
>>>>>>>> 1) If the video device is read again after VIDIOC_STREAMOFF
>>>>>>>> and reading 0 bytes, it does continue streaming. This means
>>>>>>>> that it's not possible to use VIDIOC_STREAMOFF and
>>>>>>>> VIDIOC_STREAMON to pause the recording. AFAICS Not a problem
>>>>>>>> for what I'm doing but could be a problem if anybody wants to
>>>>>>>> pause the video recording.
>>>>>> STREAMOFF is not meant for pausing (there are ivtv ioctls for
>>>>>> that). STREAMON is not implemented at all currently.
>>>>>>
>>>>>>>> 2) The end of program marker is written by VIDIOC_STREAMOFF
>>>>>>>> instead of during the close.
>>>>>> That's correct. You should interpret STREAMOFF as a close() that
>>>>>> waits for the end of the GOP. You should not try to do anything
>>>>>> after the STREAMOFF.
>>>> I've done some more testing on this, attached is a tiny program to
>>>> turn off the stream.
>>>>
>>>> Am I correct that to pause the stream the IVTV_IOC_PAUSE_ENCODE
>>>> and IVTV_IOC_RESUME_ENCODE should be used?
>>>>
>>>> Two thing that I've noticed both cause an "Interrupted System
>>>> Call" error.
>>>>
>>>> 1) If IVTV_IOC_S_GOP_END is not called
>>>> 2) If the PAUSE and RESUME calls are made.
>>>>
>>>> After the interrupted system call a reboot is required, or at
>>>> least I've not found a way to reset the driver.
>>>>
>>>> I'm wondering if the calls have been made incorrectly?
>>> Hi Duncan,
>>>
>>> You are clearly going into uncharted territories here :-)
>>>
>>> The good news is that your code is correct, the bad news is that
>>> the driver code is really broken. I've attached a patch for
>>> ivtv-0.8 that fixes the bugs. The pause bug was really bad: pause
>>> and resume were swapped internally! And after stopping with END_GOP
>>> on an important flag wasn't cleared, so the next time the read()
>>> would stop working.
>>>
>>> Let me know how it goes. If this is working fine for you, then I'll
>>> commit the changes.
>> The IVTV_IOC_S_GOP_END has worked like a dream, thanks.
>>
>> The IVTV_IOC_PAUSE_ENCODE and IVTV_IOC_RESUME_ENCODE still seem to be
>> broken.
>>
>> It reads two blocks after the resume and then blocks.
>>
>> I've done a bit more tweaking on the program, so I've attached it.
>
> Works fine for me. Can you run ivtvctl -D95 to enable debugging? And
> mail me what the kernel log says around the time the resume blocks?
Here's the log and a patch I use to determine if the V4L2 calls are correct.
Otherwise I'm using 0.8.0.
Regards,
Duncan
ivtv0 info: ENC: read 28672, 102400 bytes left
ivtv0 ioctl: ivtv_v4l2_ioctls: cmd=0x00004038, dir=0, type='@', nr=56, size=0
ivtv0 ioctl: v4l2 ioctl 0x00004038
ivtv0 ioctl: IVTV_IOC_PAUSE_ENCODE
ivtv0 ioctl: VIDIOC_S_CTRL(00980909, 1)
ivtv0 api: API Call: 0x000000da (CX2341X_ENC_MUTE_AUDIO)
ivtv0 info: Mute
ivtv0 api: API Call: 0x000000d2 (CX2341X_ENC_PAUSE_ENCODER)
ivtv0 api: result not ready, waiting 10 ms (attempt 2)
ivtv0 api: Releasing mailbox (before 0x00000007, after 0x00000000)
ivtv0 dma: ENC: Sched DMA
ivtv0 info: DMA/MPG type 0x00000000,size 0x00006800,offset 0x001006c0
ivtv0 dma: Sched dma: addr: 0x1f907000, SG_length: 1, array_size 0x00008000,
type 0x00000000
ivtv0 dma: ENC: DMA Done
ivtv0 dma: deqbuf: 0 DeQ from empty list!
ivtv0 info: encoder thread sleeping 1955
ivtv0 dma: ENC: Sched DMA
ivtv0 info: DMA/MPG type 0x00000000,size 0x00007800,offset 0x00106ec0
ivtv0 dma: Sched dma: addr: 0x1f907000, SG_length: 1, array_size 0x00008000,
type 0x00000000
ivtv0 dma: ENC: DMA Done
ivtv0 dma: deqbuf: 0 DeQ from empty list!
ivtv0 info: encoder thread sleeping 1955
ivtv0 dma: ENC: Sched DMA
ivtv0 info: DMA/MPG type 0x00000000,size 0x00006800,offset 0x0010e6c0
ivtv0 dma: Sched dma: addr: 0x1f907000, SG_length: 1, array_size 0x00008000,
type 0x00000000
ivtv0 dma: ENC: DMA Done
ivtv0 dma: deqbuf: 0 DeQ from empty list!
ivtv0 info: encoder thread sleeping 1955
ivtv0 ioctl: ivtv_v4l2_ioctls: cmd=0x00004039, dir=0, type='@', nr=57, size=0
ivtv0 ioctl: v4l2 ioctl 0x00004039
ivtv0 ioctl: IVTV_IOC_RESUME_ENCODE
ivtv0 api: API Call: 0x000000d2 (CX2341X_ENC_PAUSE_ENCODER)
ivtv0 api: Releasing mailbox (before 0x00000007, after 0x00000000)
ivtv0 api: API Call: 0x000000dc (CX2341X_ENC_MISC)
ivtv0 api: API Call: 0x000000da (CX2341X_ENC_MUTE_AUDIO)
ivtv0 ioctl: VIDIOC_S_CTRL(00980909, 0)
ivtv0 info: Unmute
ivtv0 info: v4l2 read
ivtv0 info: ivtv_read: stream 0..
ivtv0 info: ENC: 128 bufs, 0x00014800 fill; 125 free 0 dma 3 full 0 io
ivtv0 dma: deqbuf: 0 DeQ from empty list!
ivtv0 dma: deqbuf: 0 DeQ from empty list!
ivtv0 dma: deqbuf: 0 DeQ from empty list!
ivtv0 dma: deqbuf: 0 DeQ from empty list!
ivtv0 dma: deqbuf: 0 DeQ from empty list!
ivtv0 dma: Gather 1: x=3 bytes_needed 0x00020000 buf_fill 0x00014800
ivtv0 info: ENC: read 83968, 47104 bytes left
ivtv0 info: v4l2 read
ivtv0 info: ivtv_read: stream 0..
ivtv0 info: ENC: 128 bufs, 0x00000000 fill; 128 free 0 dma 0 full 0 io
ivtv0 dma: deqbuf: 0 DeQ from empty list!
ivtv0 dma: deqbuf: 0 DeQ from empty list!
ivtv0 dma: Gather 1: x=0 bytes_needed 0x00020000 buf_fill 0x00000000
ivtv0 dma: deqbuf: 0 DeQ from empty list!
ivtv0 dma: deqbuf: 0 DeQ from empty list!
ivtv0 dma: Gather 1: x=0 bytes_needed 0x00020000 buf_fill 0x00000000
--- driver/ivtv-ioctl.c.orig 2006-08-27 01:26:10.000000000 +0200
+++ driver/ivtv-ioctl.c 2006-10-14 12:03:43.000000000 +0200
@@ -1529,6 +1529,17 @@
int ivtv_v4l2_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
unsigned long arg)
{
+ struct ivtv_open_id *id = (struct ivtv_open_id *)filp->private_data;
+ struct ivtv *itv = id->itv;
+ if ((IVTV_DBGFLG_IOCTL) & ivtv_debug) {
+ unsigned int dir = cmd >> _IOC_DIRSHIFT & _IOC_DIRMASK;
+ unsigned int type = cmd >> _IOC_TYPESHIFT & _IOC_TYPEMASK;
+ unsigned int nr = cmd >> _IOC_NRSHIFT & _IOC_NRMASK;
+ unsigned int size = cmd >> _IOC_SIZESHIFT & _IOC_SIZEMASK;
+ IVTV_DEBUG_IOCTL("ivtv_v4l2_ioctls: cmd=0x%08X, dir=%u,
type='%c', nr=%u, size=%u\n",
+ cmd, dir, type, nr, size);
+ }
+
switch (cmd) {
/* This is temporary, I guess, it won't work unless here, so
it's
_______________________________________________
ivtv-devel mailing list
[email protected]
http://ivtvdriver.org/mailman/listinfo/ivtv-devel