MCPcopy Create free account
hub / github.com/OpenNI/OpenNI / Init

Method Init

Source/Modules/nimCodecs/XnJpegCodec.cpp:70–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68}
69
70XnStatus XnJpegCodec::Init(const ProductionNode& node)
71{
72 XnStatus nRetVal = XN_STATUS_OK;
73
74 nRetVal = XnCodec::Init(node);
75 XN_IS_STATUS_OK(nRetVal);
76
77 if (node.GetInfo().GetDescription().Type != XN_NODE_TYPE_IMAGE)
78 {
79 XN_LOG_ERROR_RETURN(XN_STATUS_BAD_PARAM, XN_MASK_OPEN_NI, "Codec JPEG requires an image node!");
80 }
81
82 strcpy(m_strNodeName, node.GetName());
83
84 ImageGenerator image(node);
85 image.GetContext(m_context);
86
87 // register for changes in resolution or cropping
88 nRetVal = image.RegisterToMapOutputModeChange(NodeConfigurationChangedCallback, this, m_hOutputModeCallback);
89 XN_IS_STATUS_OK_LOG_ERROR("Register to map output mode change", nRetVal);
90
91 if (image.IsCapabilitySupported(XN_CAPABILITY_CROPPING))
92 {
93 nRetVal = image.GetCroppingCap().RegisterToCroppingChange(NodeConfigurationChangedCallback, this, m_hCroppingCallback);
94 XN_IS_STATUS_OK_LOG_ERROR("Register to cropping change", nRetVal);
95 }
96
97 // now init
98 nRetVal = XnStreamInitCompressImageJ(&m_CompJPEGContext);
99 XN_IS_STATUS_OK_LOG_ERROR("Init image compressor", nRetVal);
100
101 nRetVal = XnStreamInitUncompressImageJ(&m_UncompJPEGContext);
102 if (nRetVal != XN_STATUS_OK)
103 {
104 xnLogError(XN_MASK_OPEN_NI, "Init image uncompressor");
105 XnStreamFreeCompressImageJ(&m_CompJPEGContext);
106 return (nRetVal);
107 }
108
109 m_image = image;
110
111 nRetVal = OnNodeConfigurationChanged();
112 XN_IS_STATUS_OK_LOG_ERROR("Handle node configuration change", nRetVal);
113
114 m_bValid = TRUE;
115
116 return (XN_STATUS_OK);
117}
118
119XnFloat XnJpegCodec::GetWorseCompressionRatio() const
120{

Callers

nothing calls this directly

Calls 12

GetNameMethod · 0.80
GetContextMethod · 0.80
GetCroppingCapMethod · 0.80
InitFunction · 0.50
GetDescriptionMethod · 0.45
GetInfoMethod · 0.45
IsCapabilitySupportedMethod · 0.45

Tested by

no test coverage detected