Commit 0ce32b17 authored by Ghislain MARY's avatar Ghislain MARY

Fix capture orientation.

parent cee79b1e
......@@ -240,7 +240,7 @@ MSVideoSize MSWinRTCapHelper::SelectBestVideoSize(MSVideoSize vs)
MSWinRTCap::MSWinRTCap()
: mIsInitialized(false), mIsActivated(false), mIsStarted(false), mFps(15), mStartTime(0), mDeviceOrientation(0)
: mIsInitialized(false), mIsActivated(false), mIsStarted(false), mFps(15), mStartTime(0)
{
if (smInstantiated) {
ms_error("[MSWinRTCap] A video capture filter is already instantiated. A second one can not be created.");
......@@ -334,7 +334,7 @@ float MSWinRTCap::getAverageFps()
MSVideoSize MSWinRTCap::getVideoSize()
{
MSVideoSize vs;
if ((mDeviceOrientation % 180) == 90) {
if ((mHelper->DeviceOrientation % 180) == 90) {
vs.width = mVideoSize.height;
vs.height = mVideoSize.width;
} else {
......@@ -357,9 +357,9 @@ void MSWinRTCap::selectBestVideoSize(MSVideoSize vs)
void MSWinRTCap::setDeviceOrientation(int degrees)
{
if (mFront) {
mDeviceOrientation = degrees % 360;
mHelper->DeviceOrientation = degrees % 360;
} else {
mDeviceOrientation = (360 - degrees) % 360;
mHelper->DeviceOrientation = (360 - degrees) % 360;
}
}
......
......@@ -56,6 +56,12 @@ namespace libmswinrtvid
Platform::Agile<MediaCapture^> get() { return mCapture; }
}
property int DeviceOrientation
{
int get() { return mDeviceOrientation; }
void set(int value) { mDeviceOrientation = value; }
}
private:
~MSWinRTCapHelper();
void OnCaptureFailed(Windows::Media::Capture::MediaCapture^ sender, Windows::Media::Capture::MediaCaptureFailedEventArgs^ errorEventArgs);
......@@ -98,7 +104,7 @@ namespace libmswinrtvid
void setFps(float fps);
MSVideoSize getVideoSize();
void setVideoSize(MSVideoSize vs);
int getDeviceOrientation() { return mDeviceOrientation; }
int getDeviceOrientation() { return mHelper->DeviceOrientation; }
void setDeviceOrientation(int degrees);
static void detectCameras(MSWebCamManager *manager, MSWebCamDesc *desc);
......@@ -120,7 +126,6 @@ namespace libmswinrtvid
MSAverageFPS mAvgFps;
MSVideoSize mVideoSize;
uint64_t mStartTime;
int mDeviceOrientation;
MSVideoStarter mStarter;
Platform::String^ mDeviceId;
bool mFront;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment