[MPlayer-dev-eng] Structure of Mencoder, want to record to new file based on serial-trigg

D Richard Felker III dalias at aerifal.cx
Tue Jun 17 19:48:58 CEST 2003


On Tue, Jun 17, 2003 at 07:27:24PM +0200, Martin Osmundsvåg wrote:
> Hi!
> I'm not sure if I should adress this question to this forum, but I hope 
> it's allright :)
> 
> I'm would like to make a serial trigger for mencoder so it will record 
> as long the DCD is low. The problem with mencoder is the time used for 
> initialization. Therefore I looked at the code and found the main loop. 
> I did the initializaion part and polled the serial port. When the port 
> was trigged I jumped into the main loop -- mencoder started recording 
> immediately.
> 
> The problem is that I want to start over again without quiting the 
> program. The problem is that I can't start at the main() again. Then 
> I'll get messages that it's unable to open /dev/video0: Device or 
> resource busy. I have the following mencoder.c structure taken from it's 
> rev 1.2.15:

Why can't you just restart the program? Also, have you considered just
using an external program that listens on the serial port and sends
SIGSTOP/SIGCONT to mencoder?? The output would all go in one file that
way, but maybe that's what you want...??

BTW, the "Device or resource busy" problem comes from the fact that
mencoder isn't properly closing the stream/demuxer like it should
(which is ok since it's only meant for doing one file)... So if you
want to take your approach, you need to figure out how to make it
close stuff down properly between files.

Rich



More information about the MPlayer-dev-eng mailing list