Expose active camera codec in status
This commit is contained in:
parent
07fec735d5
commit
0103067c3a
@ -261,6 +261,7 @@ HikvisionCamera::HikvisionCamera(const config::HikvisionCameraConfig& camera)
|
|||||||
height_ = camera_.height();
|
height_ = camera_.height();
|
||||||
buffer_size_ = camera_.buffer_size() > 0 ? static_cast<size_t>(camera_.buffer_size()) : 30;
|
buffer_size_ = camera_.buffer_size() > 0 ? static_cast<size_t>(camera_.buffer_size()) : 30;
|
||||||
codec_ = camera_.codec().empty() ? "H264" : camera_.codec();
|
codec_ = camera_.codec().empty() ? "H264" : camera_.codec();
|
||||||
|
state_.codec = codec_;
|
||||||
sdk_path_ = normalizeSdkPath(
|
sdk_path_ = normalizeSdkPath(
|
||||||
camera_.sdk_path().empty() ? defaultRuntimeSdkPath() : camera_.sdk_path());
|
camera_.sdk_path().empty() ? defaultRuntimeSdkPath() : camera_.sdk_path());
|
||||||
// Keep the shared_ptr itself immutable after construction. Readers and the
|
// Keep the shared_ptr itself immutable after construction. Readers and the
|
||||||
|
|||||||
@ -50,6 +50,7 @@ MujocoCamera::MujocoCamera(config::MujocoCameraConfig config)
|
|||||||
encode_width_ = positiveOrDefault(encoder.width(), width_);
|
encode_width_ = positiveOrDefault(encoder.width(), width_);
|
||||||
encode_height_ = positiveOrDefault(encoder.height(), height_);
|
encode_height_ = positiveOrDefault(encoder.height(), height_);
|
||||||
codec_ = encoder.codec().empty() ? "H264" : encoder.codec();
|
codec_ = encoder.codec().empty() ? "H264" : encoder.codec();
|
||||||
|
state_.codec = codec_;
|
||||||
enable_stream_timestamp_ = encoder.enable_stream_timestamp();
|
enable_stream_timestamp_ = encoder.enable_stream_timestamp();
|
||||||
consume_new_frame_only_ = config_.consume_new_frame_only();
|
consume_new_frame_only_ = config_.consume_new_frame_only();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -132,6 +132,7 @@ RealsenseCamera::RealsenseCamera(const config::RealSenseCameraConfig& camera):ca
|
|||||||
}
|
}
|
||||||
|
|
||||||
codec_ = encoder.codec().empty() ? "H264" : encoder.codec();
|
codec_ = encoder.codec().empty() ? "H264" : encoder.codec();
|
||||||
|
state_.codec = codec_;
|
||||||
}
|
}
|
||||||
|
|
||||||
RealsenseCamera::~RealsenseCamera() {
|
RealsenseCamera::~RealsenseCamera() {
|
||||||
|
|||||||
@ -153,6 +153,7 @@ UVCCamera::UVCCamera(const config::UVCCameraConfig& camera):camera_(camera)
|
|||||||
}
|
}
|
||||||
|
|
||||||
codec_ = encoder.codec().empty() ? "H264" : encoder.codec();
|
codec_ = encoder.codec().empty() ? "H264" : encoder.codec();
|
||||||
|
state_.codec = codec_;
|
||||||
}
|
}
|
||||||
UVCCamera::~UVCCamera() {
|
UVCCamera::~UVCCamera() {
|
||||||
stop();
|
stop();
|
||||||
|
|||||||
@ -122,6 +122,7 @@ namespace cmvr::device{
|
|||||||
int fps;
|
int fps;
|
||||||
int width;
|
int width;
|
||||||
int height;
|
int height;
|
||||||
|
std::string codec; ///< 当前配置或正在使用的视频编码器
|
||||||
};
|
};
|
||||||
|
|
||||||
/// @brief 从 XML 或其他配置中读取的相机网络参数
|
/// @brief 从 XML 或其他配置中读取的相机网络参数
|
||||||
|
|||||||
@ -132,6 +132,7 @@ grpc::Status gRPCCameraServiceImpl::GetStatus(grpc::ServerContext* context,
|
|||||||
response->mutable_state()->set_fps(state.fps);
|
response->mutable_state()->set_fps(state.fps);
|
||||||
response->mutable_state()->set_width(state.width);
|
response->mutable_state()->set_width(state.width);
|
||||||
response->mutable_state()->set_height(state.height);
|
response->mutable_state()->set_height(state.height);
|
||||||
|
response->mutable_state()->set_codec(state.codec);
|
||||||
return grpc::Status::OK;
|
return grpc::Status::OK;
|
||||||
}
|
}
|
||||||
catch(const exception &e) {
|
catch(const exception &e) {
|
||||||
|
|||||||
@ -48,6 +48,7 @@ message CameraState {
|
|||||||
int32 fps = 7;
|
int32 fps = 7;
|
||||||
int32 width = 8;
|
int32 width = 8;
|
||||||
int32 height = 9;
|
int32 height = 9;
|
||||||
|
string codec = 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
message GetCameraStateCommand {
|
message GetCameraStateCommand {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user