MCPcopy Create free account
hub / github.com/alibaba/CicadaPlayer / main

Function main

framework/data_source/data_source_test.cpp:94–232  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

92
93
94int main(int argc, const char **argv)
95{
96 log_enable_color(1);
97// if (argc < 3) {
98// printf("Usage: %s fileName outPutPath\n", argv[0]);
99// return -1;
100// }
101 std::string url = BiDataSource::createUrl(
102 "/Users/moqi/work/xx/apsaraPlayer/CicadaPlayer/platform/Apple/source/cmake-build-debug/mediaPlayer.out/framework.out/aliyunmedia.mp4",
103 "http://player.alicdn.com/video/aliyunmedia.mp4", 146057805);
104 int ret;
105 mainCont *pHandle = static_cast<mainCont *>(malloc(sizeof(mainCont)));
106 pHandle->pDownloader = dataSourcePrototype::create(url);
107 pHandle->isEOS = false;
108 IDataSource::SourceConfig config{};
109 config.low_speed_time = 5;
110 config.low_speed_limit = 1;
111 config.connect_time = 5;
112 pHandle->pDownloader->Set_config(config);
113 config.connect_time = 0;
114 pHandle->pDownloader->Get_config(config);
115 AF_LOGD("config.connect_time is %d\n", config.connect_time);
116 std::string location("location");
117 ret = pHandle->pDownloader->Open(0);
118
119 if (ret < 0) {
120 AF_LOGE("open error!");
121 goto fail;
122 }
123
124// printf("location is %s\n", pHandle->pDownloader->Get_option(location).c_str());
125// pHandle->fileSize = pHandle->pDownloader->Seek(0, SEEK_SIZE);
126// printf("fileSize is %lld\n", pHandle->fileSize);
127// {
128// int ret = 0;
129// dataSourceIO *du = new dataSourceIO(pHandle->pDownloader);
130// char *buffer = static_cast<char *>(malloc(1024));
131// memset(buffer, 0, 1024);
132// while (du->get_line(buffer, 1024) > 0)
133// printf("get_line %s \n", buffer);
134// du->seek(0, SEEK_SET);
135// while (du->get_line(buffer, 1024) > 0)
136// printf("get_line %s \n", buffer);
137//
138// delete du;
139// free(buffer);
140// }
141// return 0;
142 argv[2] = "xx.flv";
143 unlink(argv[2]);
144 pHandle->outFd = open(argv[2], O_CREAT | O_WRONLY, 0666);
145
146 if (pHandle->outFd < 0) {
147 printf("open %s error \n", argv[2]);
148 goto fail;
149 }
150
151 pthread_t read_thread_id;

Callers

nothing calls this directly

Calls 9

log_enable_colorFunction · 0.85
tty_set_noblockFunction · 0.85
af_usleepFunction · 0.85
tty_resetFunction · 0.85
Set_configMethod · 0.80
Get_configMethod · 0.80
OpenMethod · 0.45
InterruptMethod · 0.45
CloseMethod · 0.45

Tested by

no test coverage detected