WaterMarkConfig.mm 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. //
  2. // WaterMarkConfig.m
  3. // FunSDKDemo
  4. //
  5. // Created by wujiangbo on 2018/12/19.
  6. // Copyright © 2018 wujiangbo. All rights reserved.
  7. //
  8. #import "WaterMarkConfig.h"
  9. #import "fVideo_OsdLogo.h"
  10. #import "AVEnc_VideoWidget.h"
  11. #import <FunSDK/FunSDK.h>
  12. #import "Header.h"
  13. @implementation WaterMarkConfig
  14. {
  15. fVideo_OsdLogo videoLogo; //雄迈官方水印 建议关闭
  16. AVEnc_VideoWidget widgetCfg;//自定义水印
  17. }
  18. #pragma mark - 获取官方logo设置
  19. - (void)getLogoConfig{
  20. //获取通道
  21. ChannelObject *channel = [[DeviceControl getInstance] getSelectChannel];
  22. [self AddConfig:[CfgParam initWithName:channel.deviceMac andConfig:&widgetCfg andChannel:0 andCfgType:CFG_GET_SET]];
  23. [self AddConfig:[CfgParam initWithName:channel.deviceMac andConfig:&videoLogo andChannel:-1 andCfgType:CFG_GET_SET]];
  24. [self GetConfig];
  25. }
  26. #pragma mark - 保存设置
  27. - (void)setWaterMarkConfig{
  28. //发送保存配置的请求
  29. [self SetConfig];
  30. }
  31. #pragma mark 获取配置回调信息
  32. -(void)OnGetConfig:(CfgParam *)param {
  33. if ([param.name isEqualToString:[NSString stringWithUTF8String:videoLogo.Name()]]) {
  34. if([self.delegate respondsToSelector:@selector(getOsdLogoConfigResult:)]){
  35. [self.delegate getOsdLogoConfigResult:param.errorCode];
  36. }
  37. }
  38. else if ([param.name isEqualToString:[NSString stringWithUTF8String:widgetCfg.Name()]]){
  39. if ([self.delegate respondsToSelector:@selector(getLogoWidgetResult:)]) {
  40. [self.delegate getLogoWidgetResult:param.errorCode];
  41. }
  42. }
  43. }
  44. #pragma mark 保存配置回调信息
  45. - (void)OnSetConfig:(CfgParam *)param {
  46. if ([param.name isEqualToString:[NSString stringWithUTF8String:videoLogo.Name()]]) {
  47. if ([self.delegate respondsToSelector:@selector(setOsdLogoConfigResult:)]) {
  48. [self.delegate setOsdLogoConfigResult:param.errorCode];
  49. }
  50. }
  51. else if ([param.name isEqualToString:[NSString stringWithUTF8String:widgetCfg.Name()]]){
  52. }
  53. }
  54. #pragma mark 读取各项配置的属性值
  55. - (int)getLogoEnable { //自定义水印开关
  56. return widgetCfg.mChannelTitleAttribute.EncodeBlend.Value();
  57. }
  58. - (NSString *)getLogoTitle{ //自定义水印文字
  59. return [NSString stringWithUTF8String:widgetCfg.mChannelTitle.Name.Value()];
  60. }
  61. - (int)getOsdLogoEnable{ //获取官方水印开关状态
  62. return videoLogo.Enable.Value();
  63. }
  64. #pragma - mark 设置各项配置具体的属性值
  65. - (void)setLossEnable:(int)enable { //设置自定义水印开关
  66. widgetCfg.mTimeTitleAttribute.EncodeBlend = enable;
  67. widgetCfg.mTimeTitleAttribute.PreviewBlend = enable;
  68. widgetCfg.mChannelTitleAttribute.EncodeBlend = enable;
  69. widgetCfg.mChannelTitleAttribute.PreviewBlend = enable;
  70. }
  71. - (void)setLogoTitle:(NSString *)title{ //设置自定义水印文字
  72. const char *name = [title UTF8String];
  73. widgetCfg.mChannelTitle.Name = name;
  74. }
  75. - (void)setOsdLogoEnable:(int)enable{ //设置官方水印开关
  76. videoLogo.Enable = enable;
  77. }
  78. @end