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

Fix capture orientation.

parent cee79b1e
...@@ -240,7 +240,7 @@ MSVideoSize MSWinRTCapHelper::SelectBestVideoSize(MSVideoSize vs) ...@@ -240,7 +240,7 @@ MSVideoSize MSWinRTCapHelper::SelectBestVideoSize(MSVideoSize vs)
MSWinRTCap::MSWinRTCap() 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) { if (smInstantiated) {
ms_error("[MSWinRTCap] A video capture filter is already instantiated. A second one can not be created."); ms_error("[MSWinRTCap] A video capture filter is already instantiated. A second one can not be created.");
...@@ -334,7 +334,7 @@ float MSWinRTCap::getAverageFps() ...@@ -334,7 +334,7 @@ float MSWinRTCap::getAverageFps()
MSVideoSize MSWinRTCap::getVideoSize() MSVideoSize MSWinRTCap::getVideoSize()
{ {
MSVideoSize vs; MSVideoSize vs;
if ((mDeviceOrientation % 180) == 90) { if ((mHelper->DeviceOrientation % 180) == 90) {
vs.width = mVideoSize.height; vs.width = mVideoSize.height;
vs.height = mVideoSize.width; vs.height = mVideoSize.width;
} else { } else {
...@@ -357,9 +357,9 @@ void MSWinRTCap::selectBestVideoSize(MSVideoSize vs) ...@@ -357,9 +357,9 @@ void MSWinRTCap::selectBestVideoSize(MSVideoSize vs)
void MSWinRTCap::setDeviceOrientation(int degrees) void MSWinRTCap::setDeviceOrientation(int degrees)
{ {
if (mFront) { if (mFront) {
mDeviceOrientation = degrees % 360; mHelper->DeviceOrientation = degrees % 360;
} else { } else {
mDeviceOrientation = (360 - degrees) % 360; mHelper->DeviceOrientation = (360 - degrees) % 360;
} }
} }
......
...@@ -56,6 +56,12 @@ namespace libmswinrtvid ...@@ -56,6 +56,12 @@ namespace libmswinrtvid
Platform::Agile<MediaCapture^> get() { return mCapture; } Platform::Agile<MediaCapture^> get() { return mCapture; }
} }
property int DeviceOrientation
{
int get() { return mDeviceOrientation; }
void set(int value) { mDeviceOrientation = value; }
}
private: private:
~MSWinRTCapHelper(); ~MSWinRTCapHelper();
void OnCaptureFailed(Windows::Media::Capture::MediaCapture^ sender, Windows::Media::Capture::MediaCaptureFailedEventArgs^ errorEventArgs); void OnCaptureFailed(Windows::Media::Capture::MediaCapture^ sender, Windows::Media::Capture::MediaCaptureFailedEventArgs^ errorEventArgs);
...@@ -98,7 +104,7 @@ namespace libmswinrtvid ...@@ -98,7 +104,7 @@ namespace libmswinrtvid
void setFps(float fps); void setFps(float fps);
MSVideoSize getVideoSize(); MSVideoSize getVideoSize();
void setVideoSize(MSVideoSize vs); void setVideoSize(MSVideoSize vs);
int getDeviceOrientation() { return mDeviceOrientation; } int getDeviceOrientation() { return mHelper->DeviceOrientation; }
void setDeviceOrientation(int degrees); void setDeviceOrientation(int degrees);
static void detectCameras(MSWebCamManager *manager, MSWebCamDesc *desc); static void detectCameras(MSWebCamManager *manager, MSWebCamDesc *desc);
...@@ -120,7 +126,6 @@ namespace libmswinrtvid ...@@ -120,7 +126,6 @@ namespace libmswinrtvid
MSAverageFPS mAvgFps; MSAverageFPS mAvgFps;
MSVideoSize mVideoSize; MSVideoSize mVideoSize;
uint64_t mStartTime; uint64_t mStartTime;
int mDeviceOrientation;
MSVideoStarter mStarter; MSVideoStarter mStarter;
Platform::String^ mDeviceId; Platform::String^ mDeviceId;
bool mFront; 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