<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
<META content="MSHTML 6.00.2900.6036" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY text=#000000 bgColor=#ffffff>
<DIV><FONT face=Arial size=2>I'm dealing with Onvif too and I need to extend
JPEGVideoSource, call it JPEGVideoSourceEx. How to make the MediaSubsession
create a JPEGVideoSourceEx class instead of a JPEGVideoSource.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Thank you,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2> Renato MAURO</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=belloni@imavis.com href="mailto:belloni@imavis.com">Cristiano
Belloni</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A title=live-devel@ns.live555.com
href="mailto:live-devel@ns.live555.com">LIVE555 Streaming Media - development
& use</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Wednesday, October 27, 2010 9:51
AM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> Re: [Live-devel]
JPEGVideoRTPSink and Restart markers</DIV>
<DIV><BR></DIV>Il 27/10/2010 02:39, Ross Finlayson ha scritto:
<BLOCKQUOTE cite=mid:f06240800c8ed24424f62@%5B66.80.62.44%5D type="cite">
<BLOCKQUOTE type="cite">I'm trying to create a rtsp server to stream MJPEG
images. <BR></BLOCKQUOTE><BR>Ugh. JPEG is a *terrible* codec for video
streaming. <BR></BLOCKQUOTE><BR>I agree, but *everyone* requests JPEG as an
entry point. Onvif, for example, requests MJPEG/RTP streaming as a MUST
IMPLEMENT.<BR><BR>
<BLOCKQUOTE cite=mid:f06240800c8ed24424f62@%5B66.80.62.44%5D
type="cite"><BR><BR>
<BLOCKQUOTE type="cite"> I have implemented a new
TestJPEGFileServerMediaSubsession that creates a TestJPEGVideoRTPSink.
<BR><BR>In TestJPEGVideoRTPSink::doSpecialFrameHandling I'm adding the
quantization tables of the image into the header using
setSpecialHeaderBytes <BR></BLOCKQUOTE><BR>Note that the existing
"JPEGVideoRTPSink" code already does this. You should not have to reinvent
the wheel here. <BR><BR><BR>
<BLOCKQUOTE type="cite">This is working fine using some JPEG images, but
fails with others. <BR><BR>I'm testing one image that has the marker 0xFF,
0xDD ( Define Restart Interval) and I think I have to do something else
seeing this comment in the code <BR><BR>// Note: We assume that there are
no 'restart markers' <BR><BR>So, what should I do with images containing
restart markers and macroblocks? <BR></BLOCKQUOTE><BR>The JPEG transmitting
code ("JPEGVideoSource" and "JPEGVideoRTPSink") currently don't support
"Restart Marker Headers" (see RFC 2435, section 3.1.7). You will need
to update the (definition and implementation) of these two classes to
support them. <BR></BLOCKQUOTE>I did something similar, Francisco. In a
nutshell, you've got to extend JPEGVideoSource and look for DRI markers like
this:<BR><BR> //Look for the DRI marker<BR> for
(unsigned i = 0; i < JPEGHeaderSize; ++i)
{<BR> if (fBuffer[i] == 0xFF)
{<BR> if
(fBuffer[i+1] == 0xDD) { //
DRI<BR>
if ((fBuffer[i+2] != 0) || (fBuffer[i+3] != 4))
{<BR>
envir() << "Wrong DRI
marker!\n";<BR>
continue;<BR>
}<BR>
else
{<BR>
fRestartInterval = (fBuffer[i+4] << 8) +
fBuffer[i+5];<BR>
printf ("DRI restart Interval found @ %d is %d\n", i,
fRestartInterval);<BR>
break;<BR>
}<BR>
}<BR> }<BR>
}<BR><BR>Then, extend JPEGVideoRTPSink to take care about the restart markers
in doSpecialFrameHandling():<BR>(In reality, here I extended VideoRTPSink
because I needed to, feel free to do your adaptations)<BR><BR>u_int8_t
RestartMarkerHeader[4]; // the special header<BR>u_int16_t restartInterval =
source->restartInterval();<BR><BR>RestartMarkerHeader[0] = restartInterval
>> 8;<BR>RestartMarkerHeader[1] =
restartInterval;<BR>RestartMarkerHeader[2] = 0xFF;<BR>RestartMarkerHeader[3] =
0xFF;<BR><BR>setSpecialHeaderBytes(RestartMarkerHeader, sizeof
RestartMarkerHeader, sizeof mainJPEGHeader /* start position
*/);<BR><BR>Finally, reflect the size change in the headers in
specialHeaderSize():<BR><BR>// We assume that there are 'restart
markers'<BR>headerSize += 4;<BR><BR>
<DIV class=moz-signature>-- <BR>Belloni Cristiano<BR>Imavis Srl.<BR><A
href="http://www.imavis.com">www.imavis.com</A><BR><A
href="mailto://belloni@imavis.com">belloni@imavis.com</A><BR></DIV>
<P>
<HR>
<P></P>_______________________________________________<BR>live-devel mailing
list<BR>live-devel@lists.live555.com<BR>http://lists.live555.com/mailman/listinfo/live-devel<BR></BLOCKQUOTE></BODY></HTML>