From 1b4efd76b0319f43b6761b3690f7d192646808e8 Mon Sep 17 00:00:00 2001 From: Joao Carreira Date: Sun, 2 Feb 2014 16:59:24 +0000 Subject: [PATCH 1/2] Bugfix in the LibAvContextHandle when a file with multiple streams is selected --- source/InputStream.cpp | 6 ++++-- source/LibAvContextHandle.cpp | 7 +++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/source/InputStream.cpp b/source/InputStream.cpp index 083dcb5..fc9deec 100755 --- a/source/InputStream.cpp +++ b/source/InputStream.cpp @@ -62,7 +62,8 @@ QString InputStream::supportedReadFormats() { QString formats; formats = "*.yuv " // Raw video - "*.avi"// Audio video interleaved + "*.avi "// Audio video interleaved + "*.wmv "// Windows media video ; return formats; } @@ -84,6 +85,7 @@ QStringList InputStream::supportedReadFormatsList() QStringList formats; formats << "Raw video (*.yuv)" // Raw video << "Audio video interleaved (*.avi)" // Audio video interleaved + << "Windows media video (*.wmv)" // Windows media video ; return formats; @@ -190,7 +192,7 @@ Void InputStream::readFrame() if( bytes_read != frame_bytes_input ) { m_iErrorStatus = READING; - qDebug() << " Reading error !!!" << endl; + qDebug( ) << " Reading error !!!" << endl; return; } m_cCurrFrame->FrameFromBuffer( m_pInputBuffer, m_iPixelFormat ); diff --git a/source/LibAvContextHandle.cpp b/source/LibAvContextHandle.cpp index e926a69..438cd30 100755 --- a/source/LibAvContextHandle.cpp +++ b/source/LibAvContextHandle.cpp @@ -135,10 +135,9 @@ 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 ) + width = video_dec_ctx->width; + height = video_dec_ctx->height; + switch( video_dec_ctx->pix_fmt ) { case AV_PIX_FMT_YUV420P: pixel_format = PlaYUVerFrame::YUV420; From bbfabf687f55e4bb2775e50a4c479fe4c003599a Mon Sep 17 00:00:00 2001 From: Joao Carreira Date: Sun, 2 Feb 2014 17:05:58 +0000 Subject: [PATCH 2/2] Add frame rate variable into InputStream --- source/InputStream.cpp | 2 ++ source/InputStream.h | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/source/InputStream.cpp b/source/InputStream.cpp index fc9deec..1a12523 100755 --- a/source/InputStream.cpp +++ b/source/InputStream.cpp @@ -43,6 +43,8 @@ InputStream::InputStream() m_iErrorStatus = 0; m_iPixelFormat = -1; + m_uiFrameRate = 25; + m_iFileFormat = INVALID; } diff --git a/source/InputStream.h b/source/InputStream.h index f00fa4f..da185ac 100755 --- a/source/InputStream.h +++ b/source/InputStream.h @@ -70,6 +70,7 @@ private: UInt m_uiWidth; UInt m_uiHeight; + UInt m_uiFrameRate; UInt m_uiTotalFrameNum; UInt m_uiCurrFrameNum; @@ -126,6 +127,10 @@ public: { return m_uiCurrFrameNum; } + UInt getFrameRate() + { + return m_uiFrameRate; + } Void setWidth( UInt new_width ) {