Merge branch 'master' into devel
This commit is contained in:
commit
15c5bb02e7
9 files changed
+61
-34
No files matched your search
@@ -35,7 +35,7 @@ namespace plaYUVer
|
||||
std::vector<PlaYUVerSupportedFormat> LibAvContextHandle::supportedReadFormats()
|
||||
{
|
||||
INI_REGIST_PLAYUVER_SUPPORTED_FMT;
|
||||
REGIST_PLAYUVER_SUPPORTED_FMT( "Portable Grayscale Map ", "pgm" );
|
||||
REGIST_PLAYUVER_SUPPORTED_FMT( "Portable Grayscale Map", "pgm" );
|
||||
REGIST_PLAYUVER_SUPPORTED_FMT( "Portable Network Graphics", "png" );
|
||||
REGIST_PLAYUVER_SUPPORTED_FMT( "Joint Photographic Experts Group", "jpg" );
|
||||
REGIST_PLAYUVER_SUPPORTED_FMT( "Windows Bitmap", "bmp" );
|
||||
@@ -43,6 +43,8 @@ std::vector<PlaYUVerSupportedFormat> LibAvContextHandle::supportedReadFormats()
|
||||
REGIST_PLAYUVER_SUPPORTED_FMT( "Windows media video", "wmv" );
|
||||
REGIST_PLAYUVER_SUPPORTED_FMT( "MPEG4", "mp4" );
|
||||
REGIST_PLAYUVER_SUPPORTED_FMT( "Matroska Multimedia Container", "mkv" );
|
||||
REGIST_PLAYUVER_SUPPORTED_FMT( "H.264 streams", "h264" );
|
||||
REGIST_PLAYUVER_SUPPORTED_FMT( "HEVC streams", "hevc" );
|
||||
END_REGIST_PLAYUVER_SUPPORTED_FMT;
|
||||
}
|
||||
|
||||
@@ -110,7 +112,8 @@ Void LibAvContextHandle::closeAvFormat()
|
||||
m_bHasStream = false;
|
||||
}
|
||||
|
||||
Bool LibAvContextHandle::initAvFormat( const char* filename, UInt& width, UInt& height, Int& pixel_format, Double& frame_rate, UInt64& num_frames )
|
||||
Bool LibAvContextHandle::initAvFormat( const char* filename, UInt& width, UInt& height, Int& pixel_format, UInt& bits_pel, Double& frame_rate,
|
||||
UInt64& num_frames )
|
||||
{
|
||||
fmt_ctx = NULL;
|
||||
video_dec_ctx = NULL;
|
||||
@@ -209,6 +212,13 @@ Bool LibAvContextHandle::initAvFormat( const char* filename, UInt& width, UInt&
|
||||
num_frames = num_frames == 0 ? 1 : num_frames;
|
||||
|
||||
Int pix_fmt = video_dec_ctx->pix_fmt;
|
||||
|
||||
// Set bits per pixel to default (8 bits)
|
||||
bits_pel = 8;
|
||||
|
||||
/**
|
||||
* Auxiliar conversation to re-use similar pixfmt
|
||||
*/
|
||||
switch( pix_fmt )
|
||||
{
|
||||
case AV_PIX_FMT_YUVJ420P:
|
||||
@@ -220,6 +230,11 @@ Bool LibAvContextHandle::initAvFormat( const char* filename, UInt& width, UInt&
|
||||
case AV_PIX_FMT_YUVJ444P:
|
||||
pix_fmt = AV_PIX_FMT_YUV444P;
|
||||
break;
|
||||
case AV_PIX_FMT_GRAY16LE:
|
||||
case AV_PIX_FMT_GRAY16BE:
|
||||
bits_pel = 16;
|
||||
pix_fmt = AV_PIX_FMT_GRAY8;
|
||||
break;
|
||||
}
|
||||
|
||||
width = video_dec_ctx->width;
|
||||
|
||||
@@ -65,7 +65,7 @@ public:
|
||||
m_bHasStream( false )
|
||||
{
|
||||
}
|
||||
Bool initAvFormat( const char* filename, UInt& width, UInt& height, Int& pixel_format, Double& frame_rate, UInt64& num_frames );
|
||||
Bool initAvFormat( const char* filename, UInt& width, UInt& height, Int& pixel_format, UInt& bits_pel, Double& frame_rate, UInt64& num_frames );
|
||||
Void closeAvFormat();
|
||||
Bool decodeAvFormat();
|
||||
|
||||
|
||||
@@ -142,11 +142,11 @@ Void PlaYUVerStream::findHandler()
|
||||
{
|
||||
m_iStreamHandler = INVALID_HANDLER;
|
||||
|
||||
if( m_uiBitsPerPixel != 8 )
|
||||
{
|
||||
m_iStreamHandler = YUV_IO;
|
||||
return;
|
||||
}
|
||||
// if( m_uiBitsPerPixel != 8 )
|
||||
// {
|
||||
// m_iStreamHandler = YUV_IO;
|
||||
// return;
|
||||
// }
|
||||
|
||||
std::string currExt = m_cFilename.substr( m_cFilename.find_last_of( "." ) + 1 );
|
||||
currExt = lowercase( currExt );
|
||||
@@ -246,7 +246,7 @@ Bool PlaYUVerStream::open( std::string filename, UInt width, UInt height, Int in
|
||||
#ifdef USE_FFMPEG
|
||||
if( m_iStreamHandler == FFMPEG )
|
||||
{
|
||||
if( !m_cLibAvContext->initAvFormat( m_pchFilename, m_uiWidth, m_uiHeight, m_iPixelFormat, m_dFrameRate, m_uiTotalFrameNum ) )
|
||||
if( !m_cLibAvContext->initAvFormat( m_pchFilename, m_uiWidth, m_uiHeight, m_iPixelFormat, m_uiBitsPerPixel, m_dFrameRate, m_uiTotalFrameNum ) )
|
||||
{
|
||||
throw "Cannot open file using FFmpeg libs";
|
||||
}
|
||||
@@ -369,7 +369,7 @@ Bool PlaYUVerStream::reload()
|
||||
if( m_iStreamHandler == FFMPEG )
|
||||
{
|
||||
m_cLibAvContext->closeAvFormat();
|
||||
if( !m_cLibAvContext->initAvFormat( m_pchFilename, m_uiWidth, m_uiHeight, m_iPixelFormat, m_dFrameRate, m_uiTotalFrameNum ) )
|
||||
if( !m_cLibAvContext->initAvFormat( m_pchFilename, m_uiWidth, m_uiHeight, m_iPixelFormat, m_uiBitsPerPixel, m_dFrameRate, m_uiTotalFrameNum ) )
|
||||
{
|
||||
throw "Cannot open file using FFmpeg libs";
|
||||
}
|
||||
@@ -524,7 +524,7 @@ Void PlaYUVerStream::loadAll()
|
||||
|
||||
Void PlaYUVerStream::getDuration( Int* duration_array )
|
||||
{
|
||||
Int hours, mins, secs;
|
||||
Int hours, mins, secs = 0;
|
||||
#ifdef USE_FFMPEG
|
||||
if( m_iStreamHandler == FFMPEG )
|
||||
{
|
||||
@@ -533,7 +533,6 @@ Void PlaYUVerStream::getDuration( Int* duration_array )
|
||||
else
|
||||
#endif
|
||||
if( m_iStreamHandler == YUV_IO )
|
||||
|
||||
{
|
||||
secs = m_uiTotalFrameNum / m_dFrameRate;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user