<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <br>
    <blockquote cite="mid:5211F465.7030405@nomadsystems.com.au"
      type="cite">I need to split an RTSP feed into multiple files of 30
      seconds. I have done
      <br>
      what has been suggested in the thread by sub-classing
      "QuickTimeFileSink"
      <br>
      and in the "QuickTimeFileSink::afterGettingFrame" ( after sync
      point )
      <br>
      re-open a new file without stopping the RTSP session.
      <br>
      <br>
      I indeed get the data into multiple files of 30 seconds, BUT the
      stream
      <br>
      doesn't seem to be in the right spot to re-start the new files. So
      in
      <br>
      consequence only the first file is playable.
      <br>
    </blockquote>
    <br>
    <title>Snippet</title>
    Regarding the un-playable file I feel a bit silly , but it was just
    missing the <br>
    re-initialization of the "fHaveCompletedOutputFile = false" to write
    the footer<br>
    and voila.<br>
    <br>
    Having said that, I still have the problem of not starting the next
    files at the <br>
    right spot I believe. When I play them I have a few seconds where
    nothing<br>
    moves before to pick up what I suppose is a key frame.<br>
    So in "QuickTimeFileSink::afterGettingFrame" this is what I do :
    <title>Snippet</title>
    <title>Snippet</title>
    <pre style="font-family:Consolas;font-size:13;color:black;background:white;"><span style="color:blue;">void</span> QuickTimeFileSink
::afterGettingFrame(<span style="color:blue;">void</span>* clientData, <span style="color:blue;">unsigned</span> packetDataSize,
                    <span style="color:blue;">unsigned</span> <span style="color:green;">/*numTruncatedBytes*/</span>,
                    <span style="color:blue;">struct</span> timeval presentationTime,
                    <span style="color:blue;">unsigned</span> <span style="color:green;">/*durationInMicroseconds*/</span>) {
  SubsessionIOState* ioState = (SubsessionIOState*)clientData;
  <span style="color:blue;">if</span> (!ioState->syncOK(presentationTime)) {
    <span style="color:green;">// Ignore this data:</span>
    ioState->fOurSink.continuePlaying();
    <span style="color:blue;">return</span>;
  }

<span style="color:green;">  // [my-code]</span>
  Boolean keyFrame = (ioState->fBuffer && 
        *(ioState->fBuffer->dataStart()) == H264_IDR_FRAME);
  ioState->fOurSink.afterGettingFrame1(
        packetDataSize, presentationTime, keyFrame);
  <span style="color:green;">// [/</span><span style="color:green;"><span style="color:green;">my-code</span>]</span>

  ioState->afterGettingFrame(packetDataSize, presentationTime);
}

</pre>
    "afterGettingFrame1" is the handler in my subclassed
    QuickTimeFileSink <br>
    class I use to do the file close/re-open when the "keyFrame = true"
    and<br>
    the 30 seconds elapsed.<br>
    <br>
    But for some reasons, this doesn't work.<br>
    <br>
    Any ideas why ?<br>
    <br>
    Many thanks in advance.<br>
  </body>
</html>