[Live-devel] Retriving raw data from IP cameras via RTSP

Ross Finlayson finlayson at live555.com
Tue Dec 1 06:27:18 PST 2009


>We are very interested to retrieve raw data from IP cameras (MJPEG, 
>MPEG4, H.264) via RTSP and using your Live 555.
>In order to do it we implemented the Demux class which inherit from 
>the class FramedSource.
>Inside de Demux class we have the AfterReadingFrame which is call 
>each time a frame is available.
>
>Definition of AfterReadingFrame.
>static void AfterReadingFrame(void* clientData, unsigned 
>frameSize,unsigned /*numTruncatedBytes*/,struct timeval 
>presentationTime,unsigned /*durationInMicroseconds*/);
>
>The function AfterReadingFrame is passed to the getNextFrame as seen below.
>subsession->readSource()->getNextFrame(m_FrameBuffer,MAX_RTP_FRAME_SIZE,RTSP.AfterReadingFrame,subsession,onSourceClosure,subsession);
>
>Inside of the AfterReadingFrame function we are accessing to the 
>frame buffer, variable fTo and looking for the frame size from the 
>variable fFrameSize

No, this is wrong.  The class variables "fTo" and "fFrameSize" are 
used only if you are implementing the "doGetNextFrame()" virtual 
function - i.e., only if you are implementing a media source (that 
delivers data to some downstream object).  (If you don't plan to 
implement a media source, then you should be inherting from 
"MediaSink", not "FramedSource".)

Instead, things are quite simple - the actual parameters to your 
"AfterReadingFrame()" function contain all of the information that 
you need:
- "clientData" will be "subsession" (i.e., the 
"afterGettingClientData" parameter that you passed to the call to 
"getNextFrame()"
- "frameSize" will be the size of the delivered frame, which will 
have *already* been delivered into "m_FrameBuffer" (the "to" 
parameter that you passed to the call to "getNextFrame()"
- "presentationTime" will be the presentation time of the delivered 
frame of data.

In other words, in your "AfterReadingFrame()" function, you already 
have a delivered frame of data.  It's in "m_FrameBuffer", and is of 
length "frameSize", and has presentation time "presentationTime".
-- 

Ross Finlayson
Live Networks, Inc.
http://www.live555.com/


More information about the live-devel mailing list