/*
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "camera_framework_moduletest.h"
#include <cinttypes>
#include <memory>
#include <vector>
#include <thread>
#include "accesstoken_kit.h"
#include "camera_error_code.h"
#include "camera_log.h"
#include "camera_output_capability.h"
#include "camera_util.h"
#include "capture_scene_const.h"
#include "capture_session.h"
#include "hap_token_info.h"
#include "hcamera_device.h"
#include "hcamera_device_callback_proxy.h"
#include "hcamera_device_proxy.h"
#include "hcamera_service.h"
#include "hcamera_service_stub.h"
#include "input/camera_input.h"
#include "input/camera_manager.h"
#include "ipc_skeleton.h"
#include "iservice_registry.h"
#include "nativetoken_kit.h"
#include "night_session.h"
#include "parameter.h"
#include "scan_session.h"
#include "session/profession_session.h"
#include "session/secure_camera_session.h"
#include "surface.h"
#include "system_ability_definition.h"
#include "test_common.h"
#include "token_setproc.h"
using namespace testing::ext;
using namespace OHOS::HDI::Camera::V1_0;
namespace OHOS {
namespace CameraStandard {
namespace {
enum class CAM_PHOTO_EVENTS {
CAM_PHOTO_CAPTURE_START = 0,
CAM_PHOTO_CAPTURE_END,
CAM_PHOTO_CAPTURE_ERR,
CAM_PHOTO_FRAME_SHUTTER,
CAM_PHOTO_MAX_EVENT,
CAM_PHOTO_FRAME_SHUTTER_END,
CAM_PHOTO_CAPTURE_READY,
CAM_PHOTO_ESTIMATED_CAPTURE_DURATION
};
enum class CAM_PREVIEW_EVENTS {
CAM_PREVIEW_FRAME_START = 0,
CAM_PREVIEW_FRAME_END,
CAM_PREVIEW_FRAME_ERR,
CAM_PREVIEW_SKETCH_STATUS_CHANGED,
CAM_PREVIEW_MAX_EVENT
};
enum class CAM_VIDEO_EVENTS {
CAM_VIDEO_FRAME_START = 0,
CAM_VIDEO_FRAME_END,
CAM_VIDEO_FRAME_ERR,
CAM_VIDEO_MAX_EVENT
};
enum class CAM_MACRO_DETECT_EVENTS {
CAM_MACRO_EVENT_IDLE = 0,
CAM_MACRO_EVENT_ACTIVE,
CAM_MACRO_EVENT_MAX_EVENT
};
enum class CAM_MOON_CAPTURE_BOOST_EVENTS {
CAM_MOON_CAPTURE_BOOST_EVENT_IDLE = 0,
CAM_MOON_CAPTURE_BOOST_EVENT_ACTIVE,
CAM_MOON_CAPTURE_BOOST_EVENT_MAX_EVENT
};
const int32_t WAIT_TIME_AFTER_CAPTURE = 1;
const int32_t WAIT_TIME_AFTER_DEFERRED_CAPTURE = 2;
const int32_t WAIT_TIME_AFTER_RECORDING = 3;
const int32_t WAIT_TIME_AFTER_START = 2;
const int32_t WAIT_TIME_BEFORE_STOP = 1;
const int32_t WAIT_TIME_AFTER_CLOSE = 1;
const int32_t CAMERA_NUMBER = 2;
const int32_t SKETCH_PREVIEW_MIN_HEIGHT = 720;
const int32_t SKETCH_PREVIEW_MAX_WIDTH = 3000;
const int32_t SKETCH_DEFAULT_WIDTH = 640;
const int32_t SKETCH_DEFAULT_HEIGHT = 480;
const int32_t PRVIEW_WIDTH_176 = 176;
const int32_t PRVIEW_HEIGHT_144 = 144;
const int32_t PRVIEW_WIDTH_640 = 640;
const int32_t PRVIEW_WIDTH_4096 = 4096;
const int32_t PRVIEW_HEIGHT_3072 = 3072;
const int32_t PRVIEW_WIDTH_4160 = 4160;
const int32_t PRVIEW_HEIGHT_3120 = 3120;
const int32_t PRVIEW_WIDTH_8192 = 8192;
const int32_t PRVIEW_HEIGHT_6144 = 6144;
bool g_camInputOnError = false;
bool g_sessionclosed = false;
bool g_brightnessStatusChanged = false;
std::shared_ptr<OHOS::Camera::CameraMetadata> g_metaResult = nullptr;
int32_t g_videoFd = -1;
int32_t g_previewFd = -1;
int32_t g_sketchFd = -1;
std::bitset<static_cast<int>(CAM_PHOTO_EVENTS::CAM_PHOTO_MAX_EVENT)> g_photoEvents;
std::bitset<static_cast<unsigned int>(CAM_PREVIEW_EVENTS::CAM_PREVIEW_MAX_EVENT)> g_previewEvents;
std::bitset<static_cast<unsigned int>(CAM_VIDEO_EVENTS::CAM_VIDEO_MAX_EVENT)> g_videoEvents;
std::bitset<static_cast<unsigned int>(CAM_MACRO_DETECT_EVENTS::CAM_MACRO_EVENT_MAX_EVENT)> g_macroEvents;
std::bitset<static_cast<unsigned int>(CAM_MOON_CAPTURE_BOOST_EVENTS::CAM_MOON_CAPTURE_BOOST_EVENT_MAX_EVENT)>
g_moonCaptureBoostEvents;
std::list<int32_t> g_sketchStatus;
std::unordered_map<std::string, int> g_camStatusMap;
std::unordered_map<std::string, bool> g_camFlashMap;
class AppCallback : public CameraManagerCallback,
public ErrorCallback,
public PhotoStateCallback,
public PreviewStateCallback,
public ResultCallback,
public MacroStatusCallback,
public FeatureDetectionStatusCallback,
public BrightnessStatusCallback {
public:
void OnCameraStatusChanged(const CameraStatusInfo& cameraDeviceInfo) const override
{
const std::string cameraID = cameraDeviceInfo.cameraDevice->GetID();
const CameraStatus cameraStatus = cameraDeviceInfo.cameraStatus;
switch (cameraStatus) {
case CAMERA_STATUS_UNAVAILABLE: {
MEDIA_DEBUG_LOG(
"AppCallback::OnCameraStatusChanged %{public}s: CAMERA_STATUS_UNAVAILABLE", cameraID.c_str());
g_camStatusMap[cameraID] = CAMERA_STATUS_UNAVAILABLE;
break;
}
case CAMERA_STATUS_AVAILABLE: {
MEDIA_DEBUG_LOG(
"AppCallback::OnCameraStatusChanged %{public}s: CAMERA_STATUS_AVAILABLE", cameraID.c_str());
g_camStatusMap[cameraID] = CAMERA_STATUS_AVAILABLE;
break;
}
default: {
MEDIA_DEBUG_LOG("AppCallback::OnCameraStatusChanged %{public}s: unknown", cameraID.c_str());
EXPECT_TRUE(false);
}
}
return;
}
void OnFlashlightStatusChanged(const std::string& cameraID, const FlashStatus flashStatus) const override
{
switch (flashStatus) {
case FLASH_STATUS_OFF: {
MEDIA_DEBUG_LOG(
"AppCallback::OnFlashlightStatusChanged %{public}s: FLASH_STATUS_OFF", cameraID.c_str());
g_camFlashMap[cameraID] = false;
break;
}
case FLASH_STATUS_ON: {
MEDIA_DEBUG_LOG("AppCallback::OnFlashlightStatusChanged %{public}s: FLASH_STATUS_ON", cameraID.c_str());
g_camFlashMap[cameraID] = true;
break;
}
case FLASH_STATUS_UNAVAILABLE: {
MEDIA_DEBUG_LOG(
"AppCallback::OnFlashlightStatusChanged %{public}s: FLASH_STATUS_UNAVAILABLE", cameraID.c_str());
g_camFlashMap.erase(cameraID);
break;
}
default: {
MEDIA_DEBUG_LOG("AppCallback::OnFlashlightStatusChanged %{public}s: unknown", cameraID.c_str());
EXPECT_TRUE(false);
}
}
return;
}
void OnError(const int32_t errorType, const int32_t errorMsg) const override
{
MEDIA_DEBUG_LOG("AppCallback::OnError errorType: %{public}d, errorMsg: %{public}d", errorType, errorMsg);
g_camInputOnError = true;
if (errorType == CAMERA_DEVICE_PREEMPTED) {
g_sessionclosed = true;
}
return;
}
void OnResult(const uint64_t timestamp, const std::shared_ptr<OHOS::Camera::CameraMetadata>& result) const override
{
MEDIA_INFO_LOG("CameraDeviceServiceCallback::OnResult() is called!");
if (result != nullptr) {
g_metaResult = result;
common_metadata_header_t* data = result->get();
std::vector<int32_t> fpsRange;
camera_metadata_item_t entry;
int ret = OHOS::Camera::FindCameraMetadataItem(data, OHOS_ABILITY_FPS_RANGES, &entry);
MEDIA_INFO_LOG("CameraDeviceServiceCallback::FindCameraMetadataItem() %{public}d", ret);
if (ret != 0) {
没有合适的资源?快使用搜索试试~ 我知道了~
基于C++的多媒体相机框架设计源码,实现相机设备和相机采集功能
共721个文件
h:245个
cpp:197个
svg:75个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 190 浏览量
2024-05-31
06:45:04
上传
评论
收藏 7.97MB ZIP 举报
温馨提示
多媒体相机框架项目源码,共698个文件,采用C++、TypeScript和JavaScript等语言开发,涉及多种文件类型如头文件(.h)、C++源代码(.cpp)、SVG矢量图、ETS文件、PNG图片、TypeScript源代码、JSON配置文件、GN构建文件、JSON5配置文件和XML配置文件等。该项目专注于相机设备和相机采集功能的实现,提供了一个高效、可靠的多媒体相机框架解决方案。
资源推荐
资源详情
资源评论
收起资源包目录
基于C++的多媒体相机框架设计源码,实现相机设备和相机采集功能 (721个子文件)
2408e64aba8646bd9f4766cbe4e470e5 16B
99ec9e3c4574444691a427efcb135b80 48B
ab20ad7945ad4564beac128720cf2e25 16B
hvigorw.bat 2KB
cameraSample.cer 2KB
camera_service.cfg 843B
CODEOWNERS 699B
camera_framework_moduletest.cpp 336KB
camera_framework_unittest.cpp 309KB
capture_session.cpp 190KB
camera_session_napi.cpp 138KB
camera_ndk_unittest.cpp 103KB
photo_output_napi.cpp 102KB
hcapture_session.cpp 79KB
camera_manager.cpp 77KB
hcamera_service.cpp 65KB
profession_session_napi.cpp 64KB
hcamera_device.cpp 61KB
profession_session.cpp 60KB
camera_manager_napi.cpp 58KB
hcamera_host_manager.cpp 49KB
preview_output_napi.cpp 48KB
video_output_napi.cpp 40KB
camera_manager.cpp 35KB
metadata_output_napi.cpp 30KB
photo_output.cpp 30KB
preview_output.cpp 26KB
hcamera_service_stub.cpp 26KB
hstream_repeat.cpp 26KB
camera_capture_mode.cpp 26KB
camera_capture_video.cpp 24KB
camera_input_napi.cpp 23KB
hcamera_service_proxy.cpp 22KB
camera_manager_impl.cpp 22KB
camera_picker_napi.cpp 22KB
sketch_wrapper.cpp 21KB
capture_session.cpp 20KB
photo_job_repository.cpp 19KB
camera_video.cpp 19KB
hstream_capture.cpp 19KB
portrait_session_napi.cpp 19KB
main.cpp 18KB
capture_session_impl.cpp 17KB
photo_post_processor.cpp 17KB
camera_profile_napi.cpp 16KB
camera_output_capability_napi.cpp 16KB
camera_util.cpp 15KB
portrait_session.cpp 15KB
test_common.cpp 14KB
camera_input.cpp 14KB
camera_report_uitls.cpp 14KB
camera_info_napi.cpp 13KB
slow_motion_session_napi.cpp 13KB
camera_napi_utils.cpp 13KB
dps_event_report.cpp 13KB
camera_napi.cpp 13KB
video_output.cpp 13KB
hcapture_session_proxy.cpp 13KB
video_encoder.cpp 13KB
hcamera_device_manager.cpp 13KB
metadata_output.cpp 13KB
events_monitor.cpp 12KB
hcapture_session_stub.cpp 12KB
camera_capture.cpp 11KB
mode_manager_napi.cpp 11KB
hstream_common.cpp 11KB
deferred_photo_proxy_napi.cpp 10KB
camera_manager.cpp 10KB
audio_encoder.cpp 10KB
camera_device.cpp 10KB
avcodec_task_manager.cpp 9KB
camera_setting_param_napi.cpp 9KB
night_session_napi.cpp 9KB
deferred_photo_proc_session.cpp 9KB
photo_napi.cpp 9KB
deferred_photo_controller.cpp 9KB
metadata_object_napi.cpp 9KB
camera_fwk_metadata_utils.cpp 9KB
camera_info.cpp 9KB
camera_pre_launch_config_napi.cpp 9KB
metadata_common_utils.cpp 9KB
slow_motion_session.cpp 8KB
deferred_photo_processing_session.cpp 8KB
session_coordinator.cpp 8KB
video_session.cpp 8KB
camera_size_napi.cpp 8KB
deferred_photo_processor.cpp 7KB
hstream_repeat_proxy.cpp 7KB
scan_session.cpp 7KB
stream_capture_stub_fuzzer.cpp 7KB
hcamera_device_proxy.cpp 7KB
secure_camera_session_napi.cpp 7KB
hstream_capture_proxy.cpp 7KB
buffer_pool.cpp 7KB
hcamera_device_stub.cpp 6KB
moving_photo_video_cache.cpp 6KB
night_session.cpp 6KB
stream_repeat_stub_fuzzer.cpp 6KB
background_strategy.cpp 6KB
photo_session.cpp 6KB
共 721 条
- 1
- 2
- 3
- 4
- 5
- 6
- 8
资源评论
沐知全栈开发
- 粉丝: 5815
- 资源: 5218
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- Python爬虫实战案例教程.pdf
- 路径规划算法仿真 A星算法 传统A*(Astar)算法+改进后的A*算法 Matlab代码 可以固定栅格地图与起点终点 可以进行定量比较 改进: ①提升搜索效率(引入权重系数) ②冗余拐角优化(可显
- 【Python期末/课程设计】大学生体能考核成绩管理系统(PyCharm项目/Tkinter界面/MySQL数据库)
- C#-asp.net学生信息管理系统源代码 基于ASP.NET和sql server开发的简单学生信息管理系统、成绩管理系统,实现了学生管理、课程管理、成绩管理、班级管理、教师管理、用户管理等基本增
- 2-Excel工作圈小工具V2024
- STM32+AD7124+热电偶方案+Pt100冷端补偿解析工程源码,源码包含Pt100、NTC热敏、热电偶处理驱动源码, 支持热电偶类型T、J、E、N、K、B、如果用于别的R、S 8种类型,并有Pt
- 《第一行代码-Android(第3版)》随书源代码
- 2-网工专用Win平台网络测试小工具
- 基于springboot的课程答疑系统源码(java毕业设计完整源码+LW).zip
- 三菱PLC控制东芝4轴机器人程序,有完整的PLC程序带注释,结构清楚,信捷触摸屏程序,电气图纸,东芝机械手程序,适合你学习应用,附赠东芝机器人编程软件,可以模拟运行
- 基于springboot的师生共评的作业管理系统设计与实现源码(java毕业设计完整源码+LW).zip
- 计算机网络教程实验软件工具等
- 基于B2B平台的医疗病历交互系统源码(java毕业设计完整源码+LW).zip
- ANPC仿真SVPWM中点平衡 ANPC仿真模型,有源中点钳位三电平逆变器,基于MATLAB Simulink建模仿真 具备三种ANPC调制方法,包含中点平衡SVPWM控制算法 两种ANPC常用调
- 基于springboot的购物推荐网站的设计与实现源码(java毕业设计完整源码+LW).zip
- 基于springboot的高校学科竞赛平台源码(java毕业设计完整源码+LW).zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功