| 92 | |
| 93 | |
| 94 | int 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; |
nothing calls this directly
no test coverage detected