for #140: try to implement management of DRI frame

pull/191/head
mpromonet 5 years ago
parent 13e27dc78f
commit 05b52703ec

@ -45,13 +45,15 @@ class MJPEGVideoSource : public JPEGVideoSource
virtual u_int8_t qFactor() { return 128; };
virtual u_int8_t width() { return m_width; };
virtual u_int8_t height() { return m_height; };
virtual u_int16_t restartInterval() { return m_restartInterval; }
u_int8_t const* quantizationTables( u_int8_t& precision, u_int16_t& length );
protected:
MJPEGVideoSource(UsageEnvironment& env, FramedSource* source) : JPEGVideoSource(env),
m_inputSource(source),
m_width(0), m_height(0), m_qTableSize(0), m_precision(0),
m_type(0)
m_type(0), m_restartInterval(0)
{
memset(&m_qTable,0,sizeof(m_qTable));
}
@ -68,4 +70,5 @@ class MJPEGVideoSource : public JPEGVideoSource
unsigned int m_qTableSize;
unsigned int m_precision;
u_int8_t m_type;
u_int16_t m_restartInterval;
};

@ -65,11 +65,17 @@ void MJPEGVideoSource::afterGettingFrame(unsigned frameSize,unsigned numTruncate
i+=length+2;
}
// SOS
else if ( ((i+1) < frameSize) && (fTo[i] == 0xFF) && (fTo[i+1] == 0xDA) ) {
else if ( ((i+3) < frameSize) && (fTo[i] == 0xFF) && (fTo[i+1] == 0xDA) ) {
int length = (fTo[i+2]<<8)|(fTo[i+3]);
LOG(DEBUG) << "SOS length:" << length;
headerSize = i+length+2;
// DRI
} else if ( ((i+5) < frameSize) && (fTo[i] == 0xFF) && (fTo[i+1] == 0xDD) ) {
m_type |= 0x40;
int length = (fTo[i+2]<<8)|(fTo[i+3]);
m_restartInterval = (fTo[i+4]<<8)|(fTo[i+5]);
i+=length+2;
} else {
i++;
}

Loading…
Cancel
Save