37 lines
675 B
C++
37 lines
675 B
C++
#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;
|
|
}
|