summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/Src/AVIDump.cpp
diff options
context:
space:
mode:
authorsmelenchuk <smelenchuk@gmail.com>2011-02-11 18:59:42 +0000
committersmelenchuk <smelenchuk@gmail.com>2011-02-11 18:59:42 +0000
commitb0fa0a83f8a370e3661de3c06fce85e53973f189 (patch)
tree2cff242878bfeb667ade8d7f65f513811b8337a6 /Source/Core/VideoCommon/Src/AVIDump.cpp
parentca78d3639ba621a99e325c919f6cbb2a46596990 (diff)
* Dump AVI output on every VI (fixes issue #4064).
* Add audio dumping (fixes issue #1638). git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7131 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/VideoCommon/Src/AVIDump.cpp')
-rw-r--r--Source/Core/VideoCommon/Src/AVIDump.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/Source/Core/VideoCommon/Src/AVIDump.cpp b/Source/Core/VideoCommon/Src/AVIDump.cpp
index 296f8f9165..a8639158b9 100644
--- a/Source/Core/VideoCommon/Src/AVIDump.cpp
+++ b/Source/Core/VideoCommon/Src/AVIDump.cpp
@@ -30,6 +30,8 @@
#include "CommonPaths.h"
#include "Log.h"
+#include "HW/VideoInterface.h" //for TargetRefreshRate
+
HWND m_emuWnd;
LONG m_byteBuffer;
LONG m_frameCount;
@@ -189,8 +191,7 @@ bool AVIDump::SetVideoFormat()
memset(&m_header, 0, sizeof(m_header));
m_header.fccType = streamtypeVIDEO;
m_header.dwScale = 1;
- // TODO: Decect FPS using NTSC/PAL
- m_header.dwRate = 60;
+ m_header.dwRate = VideoInterface::TargetRefreshRate;
m_header.dwSuggestedBufferSize = m_bitmap.biSizeImage;
return SUCCEEDED(AVIFileCreateStream(m_file, &m_stream, &m_header));
@@ -202,6 +203,8 @@ bool AVIDump::SetVideoFormat()
#include "StringUtil.h"
#include "Log.h"
+#include "HW/VideoInterface.h" //for TargetRefreshRate
+
extern "C" {
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
@@ -253,14 +256,14 @@ bool AVIDump::CreateFile()
return false;
}
- s_Stream->codec->codec_id = s_FormatContext->oformat->video_codec;
+ s_Stream->codec->codec_id = CODEC_ID_FFV1; //s_FormatContext->oformat->video_codec;
s_Stream->codec->codec_type = AVMEDIA_TYPE_VIDEO;
s_Stream->codec->bit_rate = 400000;
s_Stream->codec->width = s_width;
s_Stream->codec->height = s_height;
- s_Stream->codec->time_base = (AVRational){1, 30};
+ s_Stream->codec->time_base = (AVRational){1, VideoInterface::TargetRefreshRate};
s_Stream->codec->gop_size = 12;
- s_Stream->codec->pix_fmt = PIX_FMT_YUV420P;
+ s_Stream->codec->pix_fmt = PIX_FMT_BGRA;
av_set_parameters(s_FormatContext, NULL);
@@ -272,7 +275,7 @@ bool AVIDump::CreateFile()
}
if(!(s_SwsContext = sws_getContext(s_width, s_height, PIX_FMT_BGR24, s_width, s_height,
- PIX_FMT_YUV420P, SWS_BICUBIC, NULL, NULL, NULL)))
+ PIX_FMT_BGRA, SWS_BICUBIC, NULL, NULL, NULL)))
{
CloseFile();
return false;
@@ -281,10 +284,10 @@ bool AVIDump::CreateFile()
s_BGRFrame = avcodec_alloc_frame();
s_YUVFrame = avcodec_alloc_frame();
- s_size = avpicture_get_size(PIX_FMT_YUV420P, s_width, s_height);
+ s_size = avpicture_get_size(PIX_FMT_BGRA, s_width, s_height);
s_YUVBuffer = new uint8_t[s_size];
- avpicture_fill((AVPicture *)s_YUVFrame, s_YUVBuffer, PIX_FMT_YUV420P, s_width, s_height);
+ avpicture_fill((AVPicture *)s_YUVFrame, s_YUVBuffer, PIX_FMT_BGRA, s_width, s_height);
s_OutBuffer = new uint8_t[s_size];