AliyunPlayer  v5.2.0
Aliyun Player API Reference Manual for Windows Platforms
AVDConfig.h
1 //
2 // AVDConfig.h
3 //
4 // Created by kongjian.kongian on 2020/06/04.
5 //
6 
7 #ifndef AVDConfig_h
8 #define AVDConfig_h
9 
10 #include <corecrt_malloc.h>
11 #include <string.h>
12 
13 namespace alivc_player {
14 
15  typedef struct _AVDConfig {
19  int timeoutMs;
20 
25 
29  char *referer;
30 
34  char *userAgent;
35 
39  char *httpProxy;
40 
41  _AVDConfig()
42  {
43  referer = nullptr;
44  userAgent = nullptr;
45  httpProxy = nullptr;
46  timeoutMs = 15000;
47  connnectTimoutMs = 5000;
48  }
49 
50  _AVDConfig(const _AVDConfig &config)
51  {
52  referer = nullptr;
53  userAgent = nullptr;
54  httpProxy = nullptr;
55 
56  if (config.referer) {
57  referer = strdup(config.referer);
58  }
59  if (config.userAgent) {
60  userAgent = strdup(config.userAgent);
61  }
62  if (config.httpProxy) {
63  httpProxy = strdup(config.httpProxy);
64  }
65 
66  timeoutMs = config.timeoutMs;
68  }
69 
70  _AVDConfig operator=(const _AVDConfig &config)
71  {
72  if (config.referer) {
73  if (referer) {
74  free(referer);
75  }
76  referer = strdup(config.referer);
77  }
78  if (config.userAgent) {
79  if (userAgent) {
80  free(userAgent);
81  }
82  userAgent = strdup(config.userAgent);
83  }
84  if (config.httpProxy) {
85  if (httpProxy) {
86  free(httpProxy);
87  }
88  httpProxy = strdup(config.httpProxy);
89  }
90 
91  timeoutMs = config.timeoutMs;
92  connnectTimoutMs = config.connnectTimoutMs;
93 
94  return *this;
95  }
96 
97  ~_AVDConfig()
98  {
99  if (referer) {
100  free(referer);
101  }
102  if (userAgent) {
103  free(userAgent);
104  }
105  if (httpProxy) {
106  free(httpProxy);
107  }
108  }
109 
110  } AVDConfig;
111 };// namespace alivc_player
112 
113 #endif /* AVDConfig_h */
alivc_player::_AVDConfig::userAgent
char * userAgent
User Agent.
Definition: AVDConfig.h:34
alivc_player::_AVDConfig::connnectTimoutMs
int connnectTimoutMs
Maximum connection timeout time. Default: 5000 milliseconds.
Definition: AVDConfig.h:24
alivc_player::_AVDConfig::timeoutMs
int timeoutMs
Maximum timeout time. Default: 15000 milliseconds.
Definition: AVDConfig.h:19
alivc_player::_AVDConfig
Definition: AVDConfig.h:15
alivc_player::_AVDConfig::httpProxy
char * httpProxy
HTTP proxy.
Definition: AVDConfig.h:39
alivc_player::_AVDConfig::referer
char * referer
Request referer.
Definition: AVDConfig.h:29