diff options
author | Jef <jef@targetspot.com> | 2024-09-24 08:54:57 -0400 |
---|---|---|
committer | Jef <jef@targetspot.com> | 2024-09-24 08:54:57 -0400 |
commit | 20d28e80a5c861a9d5f449ea911ab75b4f37ad0d (patch) | |
tree | 12f17f78986871dd2cfb0a56e5e93b545c1ae0d0 /Src/Plugins/Input/in_wmvdrm/VideoDataConverter.cpp | |
parent | 537bcbc86291b32fc04ae4133ce4d7cac8ebe9a7 (diff) | |
download | winamp-20d28e80a5c861a9d5f449ea911ab75b4f37ad0d.tar.gz |
Initial community commit
Diffstat (limited to 'Src/Plugins/Input/in_wmvdrm/VideoDataConverter.cpp')
-rw-r--r-- | Src/Plugins/Input/in_wmvdrm/VideoDataConverter.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/Src/Plugins/Input/in_wmvdrm/VideoDataConverter.cpp b/Src/Plugins/Input/in_wmvdrm/VideoDataConverter.cpp new file mode 100644 index 00000000..35130024 --- /dev/null +++ b/Src/Plugins/Input/in_wmvdrm/VideoDataConverter.cpp @@ -0,0 +1,41 @@ +#include "main.h" +#include "VideoDataConverter.h" +#include <cassert> + +class YV12Converter : public VideoDataConverter +{ +public: + YV12Converter(int w, int h) + : width(w), height(h) + { + yv12.y.rowBytes = width; + yv12.v.rowBytes = width / 2; + yv12.u.rowBytes = width / 2; + vOffset = width*height; + uOffset = width*height/4; + } + + void *Convert(void *videoData) + { + yv12.y.baseAddr = (unsigned char*)videoData; + yv12.v.baseAddr = yv12.y.baseAddr + vOffset; + yv12.u.baseAddr = yv12.v.baseAddr + uOffset; + + return (void *)&yv12; + } + + int width, height; + int vOffset, uOffset; + YV12_PLANES yv12; +}; + +VideoDataConverter *MakeConverter(VideoOutputStream *stream) +{ + switch (stream->FourCC()) + { + case '21VY': + return new YV12Converter(stream->DestinationWidth(), stream->DestinationHeight()); + default: + return new VideoDataConverter; + } +}
\ No newline at end of file |