MJPEG player with UDP server using Synapse lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- lenuisible ยท 2013-05-22 15:52 Hi guys, I have what should be an easy program to write with Lazarus and Synapse, but I can't figure out what receive method I should use. Let me describe the context : - I have a camera which send a UDP stream, which is basically a MJPEG video stream composed by approximately 10 JPEG images per second of 25kB each - each datagram starts with 4 bytes giving its size (header+ JPEG) - The 16th byte gives the position of the starting of the JPEG (FFD8) - The end of the datagram is also the end of the JPEG (FFD9) So what I try to achieve : - use a UDP socket to receive the datagrams - find out the size of every datagrams - cut the interesting part (the JPG) - display them I've looked at the UDP Server example on the synapse howto (http://www.synapse.ararat.cz/doku.php/public:howto:udpserver), but I'm a bit lost identifying what method I should use. To be a bit more precise : - is there an existing function to get a datagram size ? - How could I define a buffer big enough to receive 25KB ? I've thought using the RecvBuffer function (http://synapse.ararat.cz/doc/he lp/blcksock.TBlockSocket.html#RecvBuffer), but I don't understand how to define a 25KB "Tmemory" buffer ... - Which receive method I could use to split the datagram without having to use string ? I may be wrong, but I'm afraid working with string will be too slow to handle a 250KBps stream (and the RecvPacket seems to be limited to 8192 char lines, even if I use ansistring) Thanks in advance for your help, Rgds