multimedia/client/qt_gl_/yuvgl/media/ImageUtil.cpp

37 lines
675 B
C++
Raw Normal View History

2020-06-04 15:28:45 +00:00
#pragma once
#include "ImageUtil.h"
bool GuidCompare(GUID g1, GUID g2) {
if (g1.Data1 != g2.Data1) {
return false;
}
if (g1.Data2 != g2.Data2) {
return false;
}
if (g1.Data3 != g2.Data3) {
return false;
}
return true;
}
AVPixelFormat GetFormatFromGuid(GUID g)
{
if (GuidCompare(g, MEDIASUBTYPE_YUY2)) {
return AV_PIX_FMT_YUYV422;
}
if (GuidCompare(g, MEDIASUBTYPE_RGB24)) {
return AV_PIX_FMT_RGB24;
}
if (GuidCompare(g, MEDIASUBTYPE_RGB32)) {
return AV_PIX_FMT_RGB32;
}
if (GuidCompare(g, MEDIASUBTYPE_MJPG)) {
return AV_PIX_FMT_YUVJ420P;
}
if (GuidCompare(g, MEDIASUBTYPE_IYUV)) {
return AV_PIX_FMT_YUYV422;
}
return AV_PIX_FMT_NONE;
}