[Live-devel] QuickTimeFileSink save to new files

Pi-Ming Cheng cheng004 at umn.edu
Tue Jun 30 16:38:47 PDT 2009


Hi,

We have an application to save streaming video from an IP camera to 
files every 30 secs. I plan to modify the code of QuickTimeFileSink (by 
creating a new class) so that I can use a timer to close the old file 
and open a new file without deleting the instance of QuickTimeFileSink.

(1) To close the old file is straightforward -- two function calls
   completeOutputFile();
   CloseOutputFile(fOutFid);
The resulting QuickTime file plays back fine without any problems.

(2) To open a new file is problematic -- I did the following:
       gettimeofday(&fStartTime, NULL);
       fAppleCreationTime = fStartTime.tv_sec - 0x83dac000;

       char outfilename[64];
       sprintf(outfilename, "%d.mov", (int)(fStartTime.tv_sec) );
       fOutFid = OpenOutputFile(envir(), outfilename);

       fHaveCompletedOutputFile = False;
       fMDATposition = ftell(fOutFid);
       addAtomHeader("mdat");

       then startPlaying() function

When I played the file back -- (1) from an IP camera that only has a 
video subsession -- the file tells the player that the entire video is 
60 secs long even though it actually has only 30 secs of video in it, 
(2) from an IP camera that has both video and audio subsessions -- the 
file plays back 30 secs of audio first, then 30 secs of video (audio and 
video not synced).

The next (3rd) file saved tells the player that the entire video is 90 
secs long (even though only 30 secs of video is in the file), the 4th 
file is 120 secs .....

Looks like I did not re-set some flags or variables correctly.
Can someone please help me?
Thank you very much!


More information about the live-devel mailing list