diff options
| author | Ryan Houdek <Sonicadvance1@gmail.com> | 2016-01-01 08:50:15 -0600 |
|---|---|---|
| committer | Ryan Houdek <Sonicadvance1@gmail.com> | 2016-01-09 00:21:20 -0600 |
| commit | 3f15aa4b574bc2d5d0df6337db6d9e848421f4f6 (patch) | |
| tree | cfdc14c523ab2f40180d1cdc29ec3d1de055bcd3 /Source/Core/VideoCommon | |
| parent | af9beecc100895661377f63703111b3b41c56047 (diff) | |
Add support for framedumping to OpenGL ES.
Diffstat (limited to 'Source/Core/VideoCommon')
| -rw-r--r-- | Source/Core/VideoCommon/AVIDump.cpp | 14 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/AVIDump.h | 8 |
2 files changed, 17 insertions, 5 deletions
diff --git a/Source/Core/VideoCommon/AVIDump.cpp b/Source/Core/VideoCommon/AVIDump.cpp index f767d961a7..909a88e6be 100644 --- a/Source/Core/VideoCommon/AVIDump.cpp +++ b/Source/Core/VideoCommon/AVIDump.cpp @@ -36,6 +36,7 @@ static AVFormatContext* s_format_context = nullptr; static AVStream* s_stream = nullptr; static AVFrame* s_src_frame = nullptr; static AVFrame* s_scaled_frame = nullptr; +AVPixelFormat s_pix_fmt = AV_PIX_FMT_BGR24; static uint8_t* s_yuv_buffer = nullptr; static SwsContext* s_sws_context = nullptr; static int s_width; @@ -55,8 +56,13 @@ static void InitAVCodec() } } -bool AVIDump::Start(int w, int h) +bool AVIDump::Start(int w, int h, DumpFormat format) { + if (format == DumpFormat::FORMAT_BGR) + s_pix_fmt = AV_PIX_FMT_BGR24; + else + s_pix_fmt = AV_PIX_FMT_RGBA; + s_width = w; s_height = h; @@ -148,12 +154,12 @@ static void PreparePacket(AVPacket* pkt) void AVIDump::AddFrame(const u8* data, int width, int height) { - avpicture_fill((AVPicture*)s_src_frame, const_cast<u8*>(data), AV_PIX_FMT_BGR24, width, height); + avpicture_fill((AVPicture*)s_src_frame, const_cast<u8*>(data), s_pix_fmt, width, height); - // Convert image from BGR24 to desired pixel format, and scale to initial + // Convert image from {BGR24, RGBA} to desired pixel format, and scale to initial // width and height if ((s_sws_context = sws_getCachedContext(s_sws_context, - width, height, AV_PIX_FMT_BGR24, + width, height, s_pix_fmt, s_width, s_height, s_stream->codec->pix_fmt, SWS_BICUBIC, nullptr, nullptr, nullptr))) { diff --git a/Source/Core/VideoCommon/AVIDump.h b/Source/Core/VideoCommon/AVIDump.h index c8b59ae747..63fce15112 100644 --- a/Source/Core/VideoCommon/AVIDump.h +++ b/Source/Core/VideoCommon/AVIDump.h @@ -13,7 +13,13 @@ private: static void CloseFile(); public: - static bool Start(int w, int h); + enum class DumpFormat + { + FORMAT_BGR, + FORMAT_RGBA + }; + + static bool Start(int w, int h, DumpFormat format); static void AddFrame(const u8* data, int width, int height); static void Stop(); static void DoState(); |
