diff --git a/source/lib/PlaYUVerFrame.cpp b/source/lib/PlaYUVerFrame.cpp index 6348740..b72adea 100755 --- a/source/lib/PlaYUVerFrame.cpp +++ b/source/lib/PlaYUVerFrame.cpp @@ -33,9 +33,16 @@ namespace plaYUVer PlaYUVerFrame::PlaYUVerFrame( UInt width, UInt height, Int pel_format ) { m_pppcInputPel = NULL; + m_pcRGBPelInterlaced = NULL; m_uiWidth = width; m_uiHeight = height; m_iPixelFormat = pel_format; + m_iNumberChannels = 3; + + if( m_uiWidth == 0 || m_uiWidth == 0 || m_iPixelFormat == -1 ) + { + return; + } m_bHasRGBPel = false; @@ -57,6 +64,9 @@ PlaYUVerFrame::PlaYUVerFrame( UInt width, UInt height, Int pel_format ) case RGB8: getMem3ImageComponents( &m_pppcInputPel, m_uiHeight, m_uiWidth, 1, 1 ); break; + default: + m_pppcInputPel = NULL; + break; } getMem1D( &m_pcRGBPelInterlaced, m_uiHeight * m_uiWidth * 3 ); openPixfc(); diff --git a/source/lib/PlaYUVerFrame.h b/source/lib/PlaYUVerFrame.h index 7f912b9..b0a1266 100755 --- a/source/lib/PlaYUVerFrame.h +++ b/source/lib/PlaYUVerFrame.h @@ -36,7 +36,6 @@ #endif #include "TypeDef.h" - class QImage; namespace plaYUVer @@ -54,7 +53,7 @@ static const QString gInputStreamFormatsNames[] = class PlaYUVerFrame { public: - PlaYUVerFrame( UInt width, UInt height, Int pel_format ); + PlaYUVerFrame( UInt width = 0, UInt height = 0, Int pel_format = 0 ); ~PlaYUVerFrame(); enum PixelFormats @@ -119,11 +118,21 @@ public: { return m_iPixelFormat; } + Int getNumberChannels() + { + return m_iNumberChannels; + } + + Bool isValid() + { + return ( m_uiWidth > 0 ) && ( m_uiHeight > 0 ) && ( m_iPixelFormat >= 0 ); + } private: UInt m_uiWidth; UInt m_uiHeight; Int m_iPixelFormat; + Int m_iNumberChannels; Bool m_bHasRGBPel; Pel*** m_pppcInputPel; @@ -135,7 +144,8 @@ private: PixFcSSE* m_pcPixfc; inline Void FrametoRGB8Pixfc(); #endif -}; +} +; } // NAMESPACE