1.修改app名字,湖北video
2.修改获取h264文件列表,是否使用tfcard加这个参数
| | |
| | | minSdk 21 |
| | | targetSdk 35 |
| | | versionCode 1 |
| | | versionName "1.0" |
| | | versionName "1.0.0" |
| | | |
| | | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" |
| | | } |
| | |
| | | * @param endTime 结束时间(格式:YYMMDDHHmmss,BCD编码的6字节字符串) |
| | | * @return 资源列表(根据JT/T 1076-2016表23定义) |
| | | */ |
| | | List<ResourceInfo> getResourceList(String startTime, String endTime); |
| | | List<ResourceInfo> getResourceList(String startTime, String endTime,boolean useTFCard); |
| | | |
| | | /** |
| | | * 设置水印信息 |
| | |
| | | private H264FileTransmitter h264FileTransmitter; // H264文件传输器 |
| | | private String outputFileDirectory; // H264文件输出目录 |
| | | private WatermarkInfo currentWatermarkInfo; // 当前水印信息 |
| | | private boolean currentUseTFCard = true; // 当前是否使用TF卡配置 |
| | | private static final int H264_FILE_RETENTION_DAYS = 1; // 可根据需求调整为3或5天 |
| | | |
| | | // 多进程支持:第二个摄像头的服务连接 |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<ResourceInfo> getResourceList(String startTime, String endTime) throws RemoteException { |
| | | return H264EncodeService.this.getResourceList(startTime, endTime); |
| | | public List<ResourceInfo> getResourceList(String startTime, String endTime,boolean useTFCard) throws RemoteException { |
| | | return H264EncodeService.this.getResourceList(startTime, endTime,useTFCard); |
| | | } |
| | | |
| | | @Override |
| | |
| | | int framerate = config != null && config.framerate > 0 ? config.framerate : DEFAULT_FRAME_RATE; |
| | | h264Encoder.setEncoderParams(width, height, framerate, DEFAULT_BITRATE); |
| | | |
| | | // 保存当前useTFCard配置 |
| | | // currentUseTFCard = config.useTFCard; |
| | | |
| | | |
| | | // 获取输出文件目录(根据useTFCard配置) |
| | | String outputDir = getOutputFileDirectory(config.useTFCard); |
| | |
| | | * @param endTime 结束时间(格式:YYMMDDHHmmss) |
| | | * @return 资源列表 |
| | | */ |
| | | private List<ResourceInfo> getResourceList(String startTime, String endTime) { |
| | | Timber.d("getResourceList called, startTime: %s, endTime: %s, useTFCard: %b", startTime, endTime, currentUseTFCard); |
| | | private List<ResourceInfo> getResourceList(String startTime, String endTime,boolean useTFCard) { |
| | | Timber.d("getResourceList called, startTime: %s, endTime: %s, useTFCard: %b", startTime, endTime, useTFCard); |
| | | |
| | | List<ResourceInfo> resourceList = new ArrayList<>(); |
| | | |
| | |
| | | return resourceList; |
| | | } |
| | | |
| | | if (currentUseTFCard) { |
| | | if (useTFCard) { |
| | | // 使用TF卡:扫描TF卡上的h264文件夹,根据日期范围过滤 |
| | | String storagePath = FileUtil.getStoragePath(this, true); |
| | | if (storagePath == null || storagePath.trim().isEmpty()) { |
| | |
| | | private H264FileTransmitter h264FileTransmitter; // H264文件传输器 |
| | | private String outputFileDirectory; // H264文件输出目录 |
| | | private WatermarkInfo currentWatermarkInfo; // 当前水印信息 |
| | | private boolean currentUseTFCard = false; // 当前是否使用TF卡配置 |
| | | |
| | | |
| | | // 默认编码参数 |
| | | private static final int DEFAULT_WIDTH = 640; |
| | | private static final int DEFAULT_HEIGHT = 480; |
| | |
| | | public int controlEncode(int action, String jsonConfig) throws RemoteException { |
| | | return H264EncodeService2.this.controlEncode(action, jsonConfig); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<ResourceInfo> getResourceList(String startTime, String endTime) throws RemoteException { |
| | | return H264EncodeService2.this.getResourceList(startTime, endTime); |
| | | public List<ResourceInfo> getResourceList(String startTime, String endTime,boolean useTFCard) throws RemoteException { |
| | | return H264EncodeService2.this.getResourceList(startTime, endTime,useTFCard); |
| | | } |
| | | |
| | | @Override |
| | |
| | | // 设置 Context(用于清理 TF 卡文件) |
| | | h264Encoder.setContext(this); |
| | | |
| | | // 保存当前useTFCard配置 |
| | | currentUseTFCard = config != null && config.useTFCard; |
| | | |
| | | // 设置编码参数(使用配置中的参数) |
| | | // 设置编码参数(使用配置中的参数) |
| | | int width = config != null && config.width > 0 ? config.width : DEFAULT_WIDTH; |
| | | int height = config != null && config.height > 0 ? config.height : DEFAULT_HEIGHT; |
| | |
| | | // 设置 Context(用于清理 TF 卡文件) |
| | | h264Encoder.setContext(this); |
| | | |
| | | // 保存当前useTFCard配置 |
| | | currentUseTFCard = config != null && config.useTFCard; |
| | | |
| | | |
| | | // 设置编码参数(使用配置中的参数) |
| | | int width = config != null && config.width > 0 ? config.width : DEFAULT_WIDTH; |
| | |
| | | /** |
| | | * 获取资源列表(根据JT/T 1076-2016表23定义) |
| | | */ |
| | | private List<ResourceInfo> getResourceList(String startTime, String endTime) { |
| | | Timber.d("getResourceList called (camera2), startTime: %s, endTime: %s, useTFCard: %b", startTime, endTime, currentUseTFCard); |
| | | private List<ResourceInfo> getResourceList(String startTime, String endTime,boolean useTFCard) { |
| | | Timber.d("getResourceList called (camera2), startTime: %s, endTime: %s, useTFCard: %b", startTime, endTime, useTFCard); |
| | | |
| | | List<ResourceInfo> resourceList = new ArrayList<>(); |
| | | |
| | |
| | | return resourceList; |
| | | } |
| | | |
| | | if (currentUseTFCard) { |
| | | if (useTFCard) { |
| | | // 使用TF卡:扫描TF卡上的h264文件夹,根据日期范围过滤 |
| | | String storagePath = FileUtil.getStoragePath(this, true); |
| | | if (storagePath == null || storagePath.trim().isEmpty()) { |
| | |
| | | * @param endTime 结束时间(格式:YYMMDDHHmmss,例如:240101235959) |
| | | * @return 资源列表,如果失败返回null |
| | | */ |
| | | public List<ResourceInfo> getResourceList(String startTime, String endTime) { |
| | | public List<ResourceInfo> getResourceList(String startTime, String endTime,boolean useTFCard) { |
| | | if (!isServiceBound()) { |
| | | Log.e(TAG, "Service is not bound"); |
| | | return null; |
| | | } |
| | | |
| | | try { |
| | | List<ResourceInfo> result = service.getResourceList(startTime, endTime); |
| | | List<ResourceInfo> result = service.getResourceList(startTime, endTime,useTFCard); |
| | | Log.d(TAG, "getResourceList returned " + (result != null ? result.size() : 0) + " resources"); |
| | | return result; |
| | | } catch (RemoteException e) { |
| | |
| | | <resources> |
| | | <string name="app_name">My Application</string> |
| | | <string name="app_name">HuBeiVideo</string> |
| | | </resources> |