29
29
// LinkOniMapStream class
30
30
// ---------------------------------------------------------------------------
31
31
32
- LinkOniMapStream::LinkOniMapStream (xn::PrimeClient* pSensor, OniSensorType sensorType, LinkOniDevice* pDevice) :
33
- LinkOniStream(pSensor, sensorType, pDevice),
32
+ LinkOniMapStream::LinkOniMapStream (const char * configFile, const char * configSection, xn::PrimeClient* pSensor, OniSensorType sensorType, LinkOniDevice* pDevice) :
33
+ LinkOniStream(configFile, configSection, pSensor, sensorType, pDevice),
34
34
m_nSupportedModesCount(0 ),
35
35
m_aSupportedModes(NULL )
36
36
{
@@ -55,7 +55,46 @@ XnStatus LinkOniMapStream::Init()
55
55
nRetVal = FillSupportedVideoModes ();
56
56
XN_IS_STATUS_OK (nRetVal);
57
57
58
- nRetVal = SetMirror (TRUE );
58
+ // read video mode
59
+ XnChar section[255 ];
60
+ sprintf (section, " %s.VideoMode" , m_configSection);
61
+ OniVideoMode videoMode;
62
+ GetVideoMode (&videoMode);
63
+
64
+ XnInt32 temp32;
65
+ if (XN_STATUS_OK == xnOSReadIntFromINI (m_configFile, section, " XResolution" , &temp32))
66
+ {
67
+ videoMode.resolutionX = (int )temp32;
68
+ }
69
+ if (XN_STATUS_OK == xnOSReadIntFromINI (m_configFile, section, " YResolution" , &temp32))
70
+ {
71
+ videoMode.resolutionY = (int )temp32;
72
+ }
73
+ if (XN_STATUS_OK == xnOSReadIntFromINI (m_configFile, section, " FPS" , &temp32))
74
+ {
75
+ videoMode.fps = (int )temp32;
76
+ }
77
+ if (XN_STATUS_OK == xnOSReadIntFromINI (m_configFile, section, " PixelFormat" , &temp32))
78
+ {
79
+ videoMode.pixelFormat = (OniPixelFormat)temp32;
80
+ }
81
+
82
+ nRetVal = SetVideoMode (&videoMode);
83
+ XN_IS_STATUS_OK (nRetVal);
84
+
85
+ nRetVal = setIntPropertyFromINI (" LinkPixelFormat" , LINK_PROP_PIXEL_FORMAT);
86
+ XN_IS_STATUS_OK (nRetVal);
87
+
88
+ nRetVal = setIntPropertyFromINI (" Compression" , LINK_PROP_COMPRESSION);
89
+ XN_IS_STATUS_OK (nRetVal);
90
+
91
+ OniBool bMirror = TRUE ;
92
+ if (XN_STATUS_OK == xnOSReadIntFromINI (m_configFile, section, " Mirror" , &temp32))
93
+ {
94
+ bMirror = (temp32 == 1 );
95
+ }
96
+
97
+ nRetVal = SetMirror (bMirror);
59
98
XN_IS_STATUS_OK (nRetVal);
60
99
61
100
return (XN_STATUS_OK);
0 commit comments