Hans Verkuil wrote: > On Wednesday 25 October 2006 21:43, Duncan Webb wrote: >> Duncan Webb wrote: >>> Hans Verkuil wrote: >>>> On Wednesday 04 October 2006 23:10, Duncan Webb wrote: >>>>> Is there a way to start and stop mpeg stream. When the mpeg >>>>> stream is opened then we get a GOP, so what would be nice is to >>>>> be able to stop the stream at the end of a group of pictures and >>>>> finish reading the data (with out having to parse a buffer). Or >>>>> even better open the stream in a paused mode and then send a >>>>> start to start the stream running. (A bit like using threads) >>>> If you call IVTV_IOC_S_GOP_END with arg 1, then the card won't >>>> stop capturing until the end of a GOP is reached. >>> Hope that this is not a silly question. >>> >>> If I do this: >>> cat /dev/video0 >> ~/test.mpeg & >>> ivtvctl --device=/dev/video0 --end-gop=1 >>> >>> Would you expect the output to stop? >>> >>> On another xterm running >>> watch ls -l ~/test.mpeg >>> shows the file still growing. >>> >>> TIA >>> Duncan >>> >>> I'm using a PVR-500 and ivtv-0.8.0 >> I think that I should explain what I'm trying to do a bit more, so >> that I get an answer. > > You weren't forgotten, I just didn't have a lot of time. > > Now I'm no expert on this and I've never actually tested it, but as far > as I can tell the best way to do what you want is to: > > 1) call IVTV_IOC_S_GOP_END once during initialization to tell the driver > that you want to wait until the last GOP when the capture stops. It > doesn't actually stop the capture, it just tells the driver HOW to stop > a capture. > > 2) When you want to stop the capture issue a VIDIOC_STREAMOFF ioctl. > That stops the capture, but allows you to continue reading until no > more data is available. And then you can close the file descriptor > altogether. > > Note that this may well change in the future, it's rather ivtv-specific > behavior.
Aha, need to use VIDIOC_STREAMOFF. I'll try this out in the next few days and let you know. I had noticed that you are rather busy over the last few days. Sorry if was impatient. Thanks Duncan > >> I would like to use the VPS signal to control the start and end of >> the recording. So what is happening is that in the main thread the >> vbi device is being read and the VPS parsed, when a valid time is >> received a second thread is being used to read and write the video >> stream. When the signal changes to another time, then I would like to >> terminate the mpeg worker thread reading until the end of the GOP. >> >> If the IVTV_IOC_S_GOP_END works then there is no problem, if not then >> I may have to parse the MPEG stream in the worker thread, which would >> increase the load on the CPU. >> >> I just want to have confirmation that it is working. And if not in >> all versions, which version does the call work. >> >> TIA >> Duncan >> >> >> _______________________________________________ >> ivtv-devel mailing list >> [email protected] >> http://ivtvdriver.org/mailman/listinfo/ivtv-devel > > _______________________________________________ > ivtv-devel mailing list > [email protected] > http://ivtvdriver.org/mailman/listinfo/ivtv-devel > _______________________________________________ ivtv-devel mailing list [email protected] http://ivtvdriver.org/mailman/listinfo/ivtv-devel
