Minor changes on functions names and variables
This commit is contained in:
1 parent
50fd611291
commit
b9aecade42
7 files changed
+57
-34
No files matched your search
@@ -21,14 +21,19 @@
|
|||||||
* \brief Input handling
|
* \brief Input handling
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <cstdio>
|
#include "config.h"
|
||||||
|
|
||||||
|
#include <cstdio>
|
||||||
#include <QtDebug>
|
#include <QtDebug>
|
||||||
|
|
||||||
#include "InputStream.h"
|
#include "InputStream.h"
|
||||||
#include "LibMemAlloc.h"
|
#include "LibMemAlloc.h"
|
||||||
#include "LibMemory.h"
|
#include "LibMemory.h"
|
||||||
|
|
||||||
|
#ifdef USE_FFMPEG
|
||||||
|
#include "LibAvContextHandle.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace plaYUVer
|
namespace plaYUVer
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -142,13 +147,12 @@ Void InputStream::init( QString filename, UInt width, UInt height, Int input_for
|
|||||||
m_iFileFormat = YUVFormat;
|
m_iFileFormat = YUVFormat;
|
||||||
m_iPixelFormat = input_format;
|
m_iPixelFormat = input_format;
|
||||||
|
|
||||||
m_cStreamInformationString = QString( "[" );
|
|
||||||
|
|
||||||
#ifdef USE_FFMPEG
|
#ifdef USE_FFMPEG
|
||||||
if( QFileInfo( filename ).completeSuffix().compare( QString( "yuv" ) ) )
|
if( QFileInfo( filename ).completeSuffix().compare( QString( "yuv" ) ) )
|
||||||
{
|
{
|
||||||
avStatus = m_cLibAvContext.initAvFormat( m_cFilename.toLocal8Bit().data(), m_uiWidth, m_uiHeight, m_iPixelFormat, m_uiFrameRate );
|
avStatus = m_cLibAvContext.initAvFormat( m_cFilename.toLocal8Bit().data(), m_uiWidth, m_uiHeight, m_iPixelFormat, m_uiFrameRate );
|
||||||
m_cStreamInformationString.append( QString::fromUtf8( m_cLibAvContext.getStreamInformation() ) );
|
m_cFormatName = QString::fromUtf8( m_cLibAvContext.getCodecName() );
|
||||||
|
|
||||||
m_uiTotalFrameNum = 100;
|
m_uiTotalFrameNum = 100;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -181,15 +185,17 @@ Void InputStream::init( QString filename, UInt width, UInt height, Int input_for
|
|||||||
m_uiTotalFrameNum = ftell( m_pFile ) / ( frame_bytes_input );
|
m_uiTotalFrameNum = ftell( m_pFile ) / ( frame_bytes_input );
|
||||||
fseek( m_pFile, 0, SEEK_SET );
|
fseek( m_pFile, 0, SEEK_SET );
|
||||||
|
|
||||||
m_cStreamInformationString.append( QString::fromUtf8("rawvideo ") );
|
m_cFormatName = QString::fromUtf8("rawvideo ");
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
if( !getMem1D<Pel>( &m_pInputBuffer, m_pcCurrFrame->getBytesPerFrame() ) )
|
if( !getMem1D<Pel>( &m_pInputBuffer, m_pcCurrFrame->getBytesPerFrame() ) )
|
||||||
{
|
{
|
||||||
//Error
|
//Error
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_cStreamInformationString = QString( "[" );
|
||||||
|
m_cStreamInformationString.append( m_cFormatName );
|
||||||
m_cStreamInformationString.append( QString("/ "));
|
m_cStreamInformationString.append( QString("/ "));
|
||||||
m_cStreamInformationString.append( PlaYUVerFrame::supportedPixelFormatList().at( m_iPixelFormat ) );
|
m_cStreamInformationString.append( PlaYUVerFrame::supportedPixelFormatList().at( m_iPixelFormat ) );
|
||||||
m_cStreamInformationString.append( "] " );
|
m_cStreamInformationString.append( "] " );
|
||||||
@@ -304,7 +310,7 @@ cv::Mat InputStream::getFrameCvMat()
|
|||||||
|
|
||||||
Void InputStream::seekInput( Int new_frame_num )
|
Void InputStream::seekInput( Int new_frame_num )
|
||||||
{
|
{
|
||||||
if( new_frame_num < 0 || new_frame_num >= m_uiTotalFrameNum )
|
if( new_frame_num < 0 || new_frame_num >= (Int)m_uiTotalFrameNum )
|
||||||
return;
|
return;
|
||||||
#ifdef USE_FFMPEG
|
#ifdef USE_FFMPEG
|
||||||
if( m_cLibAvContext.getStatus() )
|
if( m_cLibAvContext.getStatus() )
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ private:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
QString m_cFilename;
|
QString m_cFilename;
|
||||||
|
QString m_cFormatName;
|
||||||
QString m_cStreamInformationString;
|
QString m_cStreamInformationString;
|
||||||
|
|
||||||
FILE* m_pFile; /**< The input file pointer >*/
|
FILE* m_pFile; /**< The input file pointer >*/
|
||||||
@@ -127,8 +128,12 @@ public:
|
|||||||
return m_cFilename;
|
return m_cFilename;
|
||||||
}
|
}
|
||||||
QString getStreamInformationString()
|
QString getStreamInformationString()
|
||||||
|
{
|
||||||
|
return m_cStreamInformationString;
|
||||||
|
}
|
||||||
|
QString getFormatName()
|
||||||
{
|
{
|
||||||
return m_cStreamInformationString;
|
return m_cFormatName;
|
||||||
}
|
}
|
||||||
UInt getFrameNum()
|
UInt getFrameNum()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -124,17 +124,6 @@ enum InputStreamFormats
|
|||||||
NUMBER_FORMATS
|
NUMBER_FORMATS
|
||||||
};
|
};
|
||||||
|
|
||||||
const std::string gInputStreamFormatsNames[] =
|
|
||||||
{
|
|
||||||
"YUV420p",
|
|
||||||
"YUV444p",
|
|
||||||
"YUV422p",
|
|
||||||
"YUV411p",
|
|
||||||
"YUV410p",
|
|
||||||
"GRAY",
|
|
||||||
"RGB8",
|
|
||||||
};
|
|
||||||
|
|
||||||
enum ColorSpace
|
enum ColorSpace
|
||||||
{
|
{
|
||||||
COLOR_INVALID = -1,
|
COLOR_INVALID = -1,
|
||||||
|
|||||||
@@ -29,16 +29,6 @@
|
|||||||
namespace plaYUVer
|
namespace plaYUVer
|
||||||
{
|
{
|
||||||
|
|
||||||
QStringList PlaYUVerFrame::supportedPixelFormatList()
|
|
||||||
{
|
|
||||||
QStringList formats;
|
|
||||||
for( Int i = 0; i < NUMBER_FORMATS; i++ )
|
|
||||||
{
|
|
||||||
formats.append(gInputStreamFormatsNames[i].data());
|
|
||||||
}
|
|
||||||
return formats;
|
|
||||||
}
|
|
||||||
|
|
||||||
PlaYUVerFrame::PlaYUVerFrame( UInt width, UInt height, Int pel_format )
|
PlaYUVerFrame::PlaYUVerFrame( UInt width, UInt height, Int pel_format )
|
||||||
{
|
{
|
||||||
m_pppcInputPel[0] = NULL;
|
m_pppcInputPel[0] = NULL;
|
||||||
|
|||||||
@@ -38,13 +38,46 @@ class QImage;
|
|||||||
namespace plaYUVer
|
namespace plaYUVer
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
static const QString gInputStreamFormatsNames[] =
|
||||||
|
{
|
||||||
|
"YUV420p",
|
||||||
|
"YUV444p",
|
||||||
|
"YUV422p",
|
||||||
|
"YUV411p",
|
||||||
|
"YUV410p",
|
||||||
|
"GRAY",
|
||||||
|
"RGB8",
|
||||||
|
};
|
||||||
|
|
||||||
class PlaYUVerFrame
|
class PlaYUVerFrame
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PlaYUVerFrame( UInt width, UInt height, Int pel_format );
|
PlaYUVerFrame( UInt width, UInt height, Int pel_format );
|
||||||
~PlaYUVerFrame();
|
~PlaYUVerFrame();
|
||||||
|
|
||||||
static QStringList supportedPixelFormatList();
|
enum PixelFormats
|
||||||
|
{
|
||||||
|
NO_FMT = -1,
|
||||||
|
YUV420p = 0,
|
||||||
|
YUV444p,
|
||||||
|
YUV422p,
|
||||||
|
YUV411p,
|
||||||
|
YUV410p,
|
||||||
|
GRAY,
|
||||||
|
RGB8,
|
||||||
|
NUMBER_FORMATS
|
||||||
|
};
|
||||||
|
|
||||||
|
static QStringList supportedPixelFormatList()
|
||||||
|
{
|
||||||
|
QStringList formats;
|
||||||
|
for( Int i = 0; i < NUMBER_FORMATS; i++ )
|
||||||
|
{
|
||||||
|
formats.append(gInputStreamFormatsNames[i]);
|
||||||
|
}
|
||||||
|
return formats;
|
||||||
|
}
|
||||||
|
|
||||||
Void FrametoRGB8();
|
Void FrametoRGB8();
|
||||||
|
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ Bool LibAvContextHandle::initAvFormat( char* filename, UInt& width, UInt& height
|
|||||||
|
|
||||||
const char *codec_name = avcodec_get_name(video_dec_ctx->codec_id);
|
const char *codec_name = avcodec_get_name(video_dec_ctx->codec_id);
|
||||||
|
|
||||||
sprintf(m_acStreamInformationString, "%s ", codec_name);
|
sprintf(m_acCodecName, "%s ", codec_name);
|
||||||
|
|
||||||
Double fr = 30;
|
Double fr = 30;
|
||||||
if( video_stream->avg_frame_rate.den && video_stream->avg_frame_rate.num )
|
if( video_stream->avg_frame_rate.den && video_stream->avg_frame_rate.num )
|
||||||
|
|||||||
@@ -65,9 +65,9 @@ public:
|
|||||||
{
|
{
|
||||||
return m_bHasStream;
|
return m_bHasStream;
|
||||||
}
|
}
|
||||||
Char* getStreamInformation()
|
Char* getCodecName()
|
||||||
{
|
{
|
||||||
return m_acStreamInformationString;
|
return m_acCodecName;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t *video_dst_data[4];
|
uint8_t *video_dst_data[4];
|
||||||
@@ -84,7 +84,7 @@ private:
|
|||||||
|
|
||||||
Bool m_bHasStream;
|
Bool m_bHasStream;
|
||||||
|
|
||||||
Char m_acStreamInformationString[20];
|
Char m_acCodecName[20];
|
||||||
};
|
};
|
||||||
|
|
||||||
} // NAMESPACE
|
} // NAMESPACE
|
||||||
|
|||||||
Reference in new issue
Block a user