Read steam information from LibAvContextHandle when it is possible

This commit is contained in:
jfmcarreira committed 2014-02-02 14:07:42 +00:00
1 parent 7c033380d4
commit 4523accb07
2 files changed
+15 -3

No files matched your search

+1 -2
View File
@@ -109,7 +109,6 @@ QStringList InputStream::supportedPixelFormatList()
Bool InputStream::needFormatDialog( QString filename )
{
return true;
QString fileExtension = QFileInfo( filename ).completeSuffix();
if( !fileExtension.compare( QString( "yuv" ) ) )
{
@@ -130,7 +129,7 @@ Void InputStream::init( QString filename, UInt width, UInt height, Int input_for
m_iPixelFormat = input_format;
#ifdef USE_FFMPEG
Bool avStatus = m_cLibAvContext.initAvFormat( filename, width, height, input_format );
Bool avStatus = m_cLibAvContext.initAvFormat( filename, m_uiWidth, m_uiHeight, m_iPixelFormat );
#endif
if( m_uiWidth <= 0 || m_uiHeight <= 0 )
+14 -1
View File
@@ -24,7 +24,7 @@
#include "LibAvContextHandle.h"
#ifdef USE_FFMPEG
#include <cstdio>
#include <QtDebug>
@@ -135,6 +135,19 @@ Bool LibAvContextHandle::initAvFormat( QString filename, UInt& width, UInt& heig
video_dst_bufsize = ret;
}
AVCodecContext *in_codec = fmt_ctx->streams[0]->codec;
width = in_codec->width;
height = in_codec->height;
switch( in_codec->pix_fmt )
{
case AV_PIX_FMT_YUV420P:
pixel_format = PlaYUVerFrame::YUV420;
break;
case AV_PIX_FMT_GRAY8:
pixel_format = PlaYUVerFrame::YUV400;
break;
}
/* dump input information to stderr */
av_dump_format( fmt_ctx, 0, src_filename, 0 );
if( !video_stream )