#include "m3u8d.h" /* Code generated by cmd/cgo; DO NOT EDIT. */ /* package command-line-arguments */ #line 1 "cgo-builtin-export-prolog" #include #ifndef GO_CGO_EXPORT_PROLOGUE_H #define GO_CGO_EXPORT_PROLOGUE_H #ifndef GO_CGO_GOSTRING_TYPEDEF typedef struct { const char *p; ptrdiff_t n; } _GoString_; #endif #endif /* Start of preamble from import "C" comments. */ /* End of preamble from import "C" comments. */ /* Start of boilerplate cgo prologue. */ #line 1 "cgo-gcc-export-header-prolog" #ifndef GO_CGO_PROLOGUE_H #define GO_CGO_PROLOGUE_H typedef signed char GoInt8; typedef unsigned char GoUint8; typedef short GoInt16; typedef unsigned short GoUint16; typedef int GoInt32; typedef unsigned int GoUint32; typedef long long GoInt64; typedef unsigned long long GoUint64; typedef GoInt64 GoInt; typedef GoUint64 GoUint; typedef size_t GoUintptr; typedef float GoFloat32; typedef double GoFloat64; #ifdef _MSC_VER #include typedef _Fcomplex GoComplex64; typedef _Dcomplex GoComplex128; #else typedef float _Complex GoComplex64; typedef double _Complex GoComplex128; #endif /* static assertion to make sure the file is being used on architecture at least with matching size of GoInt. */ typedef char _check_for_64_bit_pointer_matching_GoInt[sizeof(void*)==64/8 ? 1:-1]; #ifndef GO_CGO_GOSTRING_TYPEDEF typedef _GoString_ GoString; #endif typedef void *GoMap; typedef void *GoChan; typedef struct { void *t; void *v; } GoInterface; typedef struct { void *data; GoInt len; GoInt cap; } GoSlice; #endif /* End of boilerplate cgo prologue. */ #ifdef __cplusplus extern "C" { #endif extern __declspec(dllexport) void Go2cppFn_RunDownload(char* in, int inLen, char** out, int* outLen); extern __declspec(dllexport) void Go2cppFn_CloseOldEnv(char* in, int inLen, char** out, int* outLen); extern __declspec(dllexport) void Go2cppFn_GetProgress(char* in, int inLen, char** out, int* outLen); extern __declspec(dllexport) void Go2cppFn_GetWd(char* in, int inLen, char** out, int* outLen); extern __declspec(dllexport) void Go2cppFn_ParseCurlStr(char* in, int inLen, char** out, int* outLen); extern __declspec(dllexport) void Go2cppFn_RunDownload_Req_ToCurlStr(char* in, int inLen, char** out, int* outLen); extern __declspec(dllexport) void Go2cppFn_GetFileNameFromUrl(char* in, int inLen, char** out, int* outLen); extern __declspec(dllexport) void Go2cppFn_MergeTsDir(char* in, int inLen, char** out, int* outLen); extern __declspec(dllexport) void Go2cppFn_MergeStop(char* in, int inLen, char** out, int* outLen); extern __declspec(dllexport) void Go2cppFn_MergeGetProgressPercent(char* in, int inLen, char** out, int* outLen); #ifdef __cplusplus } #endif RunDownload_Resp RunDownload(RunDownload_Req in0){ std::string in; { { uint32_t tmp36 = in0.M3u8Url.length(); char tmp37[4]; tmp37[0] = (uint32_t(tmp36) >> 24) & 0xFF; tmp37[1] = (uint32_t(tmp36) >> 16) & 0xFF; tmp37[2] = (uint32_t(tmp36) >> 8) & 0xFF; tmp37[3] = (uint32_t(tmp36) >> 0) & 0xFF; in.append(tmp37, 4); in.append(in0.M3u8Url); } in.append((char*)(&in0.Insecure), 1); { uint32_t tmp38 = in0.SaveDir.length(); char tmp39[4]; tmp39[0] = (uint32_t(tmp38) >> 24) & 0xFF; tmp39[1] = (uint32_t(tmp38) >> 16) & 0xFF; tmp39[2] = (uint32_t(tmp38) >> 8) & 0xFF; tmp39[3] = (uint32_t(tmp38) >> 0) & 0xFF; in.append(tmp39, 4); in.append(in0.SaveDir); } { uint32_t tmp40 = in0.FileName.length(); char tmp41[4]; tmp41[0] = (uint32_t(tmp40) >> 24) & 0xFF; tmp41[1] = (uint32_t(tmp40) >> 16) & 0xFF; tmp41[2] = (uint32_t(tmp40) >> 8) & 0xFF; tmp41[3] = (uint32_t(tmp40) >> 0) & 0xFF; in.append(tmp41, 4); in.append(in0.FileName); } { char tmp42[4]; tmp42[0] = (uint32_t(in0.SkipTsCountFromHead) >> 24) & 0xFF; tmp42[1] = (uint32_t(in0.SkipTsCountFromHead) >> 16) & 0xFF; tmp42[2] = (uint32_t(in0.SkipTsCountFromHead) >> 8) & 0xFF; tmp42[3] = (uint32_t(in0.SkipTsCountFromHead) >> 0) & 0xFF; in.append(tmp42, 4); } { uint32_t tmp43 = in0.SetProxy.length(); char tmp44[4]; tmp44[0] = (uint32_t(tmp43) >> 24) & 0xFF; tmp44[1] = (uint32_t(tmp43) >> 16) & 0xFF; tmp44[2] = (uint32_t(tmp43) >> 8) & 0xFF; tmp44[3] = (uint32_t(tmp43) >> 0) & 0xFF; in.append(tmp44, 4); in.append(in0.SetProxy); } { uint32_t tmp45 = in0.HeaderMap.size(); char tmp46[4]; tmp46[0] = (uint32_t(tmp45) >> 24) & 0xFF; tmp46[1] = (uint32_t(tmp45) >> 16) & 0xFF; tmp46[2] = (uint32_t(tmp45) >> 8) & 0xFF; tmp46[3] = (uint32_t(tmp45) >> 0) & 0xFF; in.append(tmp46, 4); for(std::map>::iterator tmp47 = in0.HeaderMap.begin(); tmp47 != in0.HeaderMap.end(); ++tmp47) { { uint32_t tmp48 = tmp47->first.length(); char tmp49[4]; tmp49[0] = (uint32_t(tmp48) >> 24) & 0xFF; tmp49[1] = (uint32_t(tmp48) >> 16) & 0xFF; tmp49[2] = (uint32_t(tmp48) >> 8) & 0xFF; tmp49[3] = (uint32_t(tmp48) >> 0) & 0xFF; in.append(tmp49, 4); in.append(tmp47->first); } { uint32_t tmp50 = tmp47->second.size(); char tmp51[4]; tmp51[0] = (uint32_t(tmp50) >> 24) & 0xFF; tmp51[1] = (uint32_t(tmp50) >> 16) & 0xFF; tmp51[2] = (uint32_t(tmp50) >> 8) & 0xFF; tmp51[3] = (uint32_t(tmp50) >> 0) & 0xFF; in.append(tmp51, 4); for (uint32_t tmp52=0; tmp52 < tmp50; ++tmp52) { { uint32_t tmp53 = tmp47->second[tmp52].length(); char tmp54[4]; tmp54[0] = (uint32_t(tmp53) >> 24) & 0xFF; tmp54[1] = (uint32_t(tmp53) >> 16) & 0xFF; tmp54[2] = (uint32_t(tmp53) >> 8) & 0xFF; tmp54[3] = (uint32_t(tmp53) >> 0) & 0xFF; in.append(tmp54, 4); in.append(tmp47->second[tmp52]); } } } } } in.append((char*)(&in0.SkipRemoveTs), 1); in.append((char*)(&in0.ProgressBarShow), 1); { char tmp55[4]; tmp55[0] = (uint32_t(in0.ThreadCount) >> 24) & 0xFF; tmp55[1] = (uint32_t(in0.ThreadCount) >> 16) & 0xFF; tmp55[2] = (uint32_t(in0.ThreadCount) >> 8) & 0xFF; tmp55[3] = (uint32_t(in0.ThreadCount) >> 0) & 0xFF; in.append(tmp55, 4); } } char *out = NULL; int outLen = 0; Go2cppFn_RunDownload((char *)in.data(), in.length(), &out, &outLen); RunDownload_Resp retValue; int outIdx = 0; { { uint32_t tmp56 = 0; uint32_t tmp57 = uint32_t(uint8_t(out[outIdx+0]) << 24); uint32_t tmp58 = uint32_t(uint8_t(out[outIdx+1]) << 16); uint32_t tmp59 = uint32_t(uint8_t(out[outIdx+2]) << 8); uint32_t tmp60 = uint32_t(uint8_t(out[outIdx+3]) << 0); tmp56 = tmp57 | tmp58 | tmp59 | tmp60; outIdx+=4; retValue.ErrMsg = std::string(out+outIdx, out+outIdx+tmp56); outIdx+=tmp56; } retValue.IsSkipped = (bool) out[outIdx]; outIdx++; retValue.IsCancel = (bool) out[outIdx]; outIdx++; { uint32_t tmp61 = 0; uint32_t tmp62 = uint32_t(uint8_t(out[outIdx+0]) << 24); uint32_t tmp63 = uint32_t(uint8_t(out[outIdx+1]) << 16); uint32_t tmp64 = uint32_t(uint8_t(out[outIdx+2]) << 8); uint32_t tmp65 = uint32_t(uint8_t(out[outIdx+3]) << 0); tmp61 = tmp62 | tmp63 | tmp64 | tmp65; outIdx+=4; retValue.SaveFileTo = std::string(out+outIdx, out+outIdx+tmp61); outIdx+=tmp61; } } if (out != NULL) { free(out); } return retValue; } void CloseOldEnv(){ std::string in; char *out = NULL; int outLen = 0; Go2cppFn_CloseOldEnv((char *)in.data(), in.length(), &out, &outLen); if (out != NULL) { free(out); } } GetProgress_Resp GetProgress(){ std::string in; char *out = NULL; int outLen = 0; Go2cppFn_GetProgress((char *)in.data(), in.length(), &out, &outLen); GetProgress_Resp retValue; int outIdx = 0; { { uint32_t tmp4 = uint32_t(uint8_t(out[outIdx+0]) << 24); uint32_t tmp5 = uint32_t(uint8_t(out[outIdx+1]) << 16); uint32_t tmp6 = uint32_t(uint8_t(out[outIdx+2]) << 8); uint32_t tmp7 = uint32_t(uint8_t(out[outIdx+3]) << 0); retValue.Percent = tmp4 | tmp5 | tmp6 | tmp7; outIdx+=4; } { uint32_t tmp8 = 0; uint32_t tmp9 = uint32_t(uint8_t(out[outIdx+0]) << 24); uint32_t tmp10 = uint32_t(uint8_t(out[outIdx+1]) << 16); uint32_t tmp11 = uint32_t(uint8_t(out[outIdx+2]) << 8); uint32_t tmp12 = uint32_t(uint8_t(out[outIdx+3]) << 0); tmp8 = tmp9 | tmp10 | tmp11 | tmp12; outIdx+=4; retValue.Title = std::string(out+outIdx, out+outIdx+tmp8); outIdx+=tmp8; } { uint32_t tmp13 = 0; uint32_t tmp14 = uint32_t(uint8_t(out[outIdx+0]) << 24); uint32_t tmp15 = uint32_t(uint8_t(out[outIdx+1]) << 16); uint32_t tmp16 = uint32_t(uint8_t(out[outIdx+2]) << 8); uint32_t tmp17 = uint32_t(uint8_t(out[outIdx+3]) << 0); tmp13 = tmp14 | tmp15 | tmp16 | tmp17; outIdx+=4; retValue.StatusBar = std::string(out+outIdx, out+outIdx+tmp13); outIdx+=tmp13; } } if (out != NULL) { free(out); } return retValue; } std::string GetWd(){ std::string in; char *out = NULL; int outLen = 0; Go2cppFn_GetWd((char *)in.data(), in.length(), &out, &outLen); std::string retValue; int outIdx = 0; { uint32_t tmp2 = 0; uint32_t tmp3 = uint32_t(uint8_t(out[outIdx+0]) << 24); uint32_t tmp4 = uint32_t(uint8_t(out[outIdx+1]) << 16); uint32_t tmp5 = uint32_t(uint8_t(out[outIdx+2]) << 8); uint32_t tmp6 = uint32_t(uint8_t(out[outIdx+3]) << 0); tmp2 = tmp3 | tmp4 | tmp5 | tmp6; outIdx+=4; retValue = std::string(out+outIdx, out+outIdx+tmp2); outIdx+=tmp2; } if (out != NULL) { free(out); } return retValue; } ParseCurl_Resp ParseCurlStr(std::string in0){ std::string in; { uint32_t tmp21 = in0.length(); char tmp22[4]; tmp22[0] = (uint32_t(tmp21) >> 24) & 0xFF; tmp22[1] = (uint32_t(tmp21) >> 16) & 0xFF; tmp22[2] = (uint32_t(tmp21) >> 8) & 0xFF; tmp22[3] = (uint32_t(tmp21) >> 0) & 0xFF; in.append(tmp22, 4); in.append(in0); } char *out = NULL; int outLen = 0; Go2cppFn_ParseCurlStr((char *)in.data(), in.length(), &out, &outLen); ParseCurl_Resp retValue; int outIdx = 0; { { uint32_t tmp23 = 0; uint32_t tmp24 = uint32_t(uint8_t(out[outIdx+0]) << 24); uint32_t tmp25 = uint32_t(uint8_t(out[outIdx+1]) << 16); uint32_t tmp26 = uint32_t(uint8_t(out[outIdx+2]) << 8); uint32_t tmp27 = uint32_t(uint8_t(out[outIdx+3]) << 0); tmp23 = tmp24 | tmp25 | tmp26 | tmp27; outIdx+=4; retValue.ErrMsg = std::string(out+outIdx, out+outIdx+tmp23); outIdx+=tmp23; } { { uint32_t tmp28 = 0; uint32_t tmp29 = uint32_t(uint8_t(out[outIdx+0]) << 24); uint32_t tmp30 = uint32_t(uint8_t(out[outIdx+1]) << 16); uint32_t tmp31 = uint32_t(uint8_t(out[outIdx+2]) << 8); uint32_t tmp32 = uint32_t(uint8_t(out[outIdx+3]) << 0); tmp28 = tmp29 | tmp30 | tmp31 | tmp32; outIdx+=4; retValue.DownloadReq.M3u8Url = std::string(out+outIdx, out+outIdx+tmp28); outIdx+=tmp28; } retValue.DownloadReq.Insecure = (bool) out[outIdx]; outIdx++; { uint32_t tmp33 = 0; uint32_t tmp34 = uint32_t(uint8_t(out[outIdx+0]) << 24); uint32_t tmp35 = uint32_t(uint8_t(out[outIdx+1]) << 16); uint32_t tmp36 = uint32_t(uint8_t(out[outIdx+2]) << 8); uint32_t tmp37 = uint32_t(uint8_t(out[outIdx+3]) << 0); tmp33 = tmp34 | tmp35 | tmp36 | tmp37; outIdx+=4; retValue.DownloadReq.SaveDir = std::string(out+outIdx, out+outIdx+tmp33); outIdx+=tmp33; } { uint32_t tmp38 = 0; uint32_t tmp39 = uint32_t(uint8_t(out[outIdx+0]) << 24); uint32_t tmp40 = uint32_t(uint8_t(out[outIdx+1]) << 16); uint32_t tmp41 = uint32_t(uint8_t(out[outIdx+2]) << 8); uint32_t tmp42 = uint32_t(uint8_t(out[outIdx+3]) << 0); tmp38 = tmp39 | tmp40 | tmp41 | tmp42; outIdx+=4; retValue.DownloadReq.FileName = std::string(out+outIdx, out+outIdx+tmp38); outIdx+=tmp38; } { uint32_t tmp43 = uint32_t(uint8_t(out[outIdx+0]) << 24); uint32_t tmp44 = uint32_t(uint8_t(out[outIdx+1]) << 16); uint32_t tmp45 = uint32_t(uint8_t(out[outIdx+2]) << 8); uint32_t tmp46 = uint32_t(uint8_t(out[outIdx+3]) << 0); retValue.DownloadReq.SkipTsCountFromHead = tmp43 | tmp44 | tmp45 | tmp46; outIdx+=4; } { uint32_t tmp47 = 0; uint32_t tmp48 = uint32_t(uint8_t(out[outIdx+0]) << 24); uint32_t tmp49 = uint32_t(uint8_t(out[outIdx+1]) << 16); uint32_t tmp50 = uint32_t(uint8_t(out[outIdx+2]) << 8); uint32_t tmp51 = uint32_t(uint8_t(out[outIdx+3]) << 0); tmp47 = tmp48 | tmp49 | tmp50 | tmp51; outIdx+=4; retValue.DownloadReq.SetProxy = std::string(out+outIdx, out+outIdx+tmp47); outIdx+=tmp47; } { uint32_t tmp52 = 0; uint32_t tmp53 = uint32_t(uint8_t(out[outIdx+0]) << 24); uint32_t tmp54 = uint32_t(uint8_t(out[outIdx+1]) << 16); uint32_t tmp55 = uint32_t(uint8_t(out[outIdx+2]) << 8); uint32_t tmp56 = uint32_t(uint8_t(out[outIdx+3]) << 0); tmp52 = tmp53 | tmp54 | tmp55 | tmp56; outIdx+=4; for (uint32_t tmp57 = 0; tmp57 < tmp52; tmp57++) { std::string tmp58; { uint32_t tmp59 = 0; uint32_t tmp60 = uint32_t(uint8_t(out[outIdx+0]) << 24); uint32_t tmp61 = uint32_t(uint8_t(out[outIdx+1]) << 16); uint32_t tmp62 = uint32_t(uint8_t(out[outIdx+2]) << 8); uint32_t tmp63 = uint32_t(uint8_t(out[outIdx+3]) << 0); tmp59 = tmp60 | tmp61 | tmp62 | tmp63; outIdx+=4; tmp58 = std::string(out+outIdx, out+outIdx+tmp59); outIdx+=tmp59; } std::vector tmp64; { uint32_t tmp65 = 0; uint32_t tmp66 = uint32_t(uint8_t(out[outIdx+0]) << 24); uint32_t tmp67 = uint32_t(uint8_t(out[outIdx+1]) << 16); uint32_t tmp68 = uint32_t(uint8_t(out[outIdx+2]) << 8); uint32_t tmp69 = uint32_t(uint8_t(out[outIdx+3]) << 0); tmp65 = tmp66 | tmp67 | tmp68 | tmp69; outIdx+=4; for (uint32_t tmp70 = 0; tmp70 < tmp65; tmp70++) { std::string tmp71; { uint32_t tmp72 = 0; uint32_t tmp73 = uint32_t(uint8_t(out[outIdx+0]) << 24); uint32_t tmp74 = uint32_t(uint8_t(out[outIdx+1]) << 16); uint32_t tmp75 = uint32_t(uint8_t(out[outIdx+2]) << 8); uint32_t tmp76 = uint32_t(uint8_t(out[outIdx+3]) << 0); tmp72 = tmp73 | tmp74 | tmp75 | tmp76; outIdx+=4; tmp71 = std::string(out+outIdx, out+outIdx+tmp72); outIdx+=tmp72; } tmp64.push_back(tmp71); } } retValue.DownloadReq.HeaderMap[tmp58] = tmp64; } } retValue.DownloadReq.SkipRemoveTs = (bool) out[outIdx]; outIdx++; retValue.DownloadReq.ProgressBarShow = (bool) out[outIdx]; outIdx++; { uint32_t tmp77 = uint32_t(uint8_t(out[outIdx+0]) << 24); uint32_t tmp78 = uint32_t(uint8_t(out[outIdx+1]) << 16); uint32_t tmp79 = uint32_t(uint8_t(out[outIdx+2]) << 8); uint32_t tmp80 = uint32_t(uint8_t(out[outIdx+3]) << 0); retValue.DownloadReq.ThreadCount = tmp77 | tmp78 | tmp79 | tmp80; outIdx+=4; } } } if (out != NULL) { free(out); } return retValue; } std::string RunDownload_Req_ToCurlStr(RunDownload_Req in0){ std::string in; { { uint32_t tmp33 = in0.M3u8Url.length(); char tmp34[4]; tmp34[0] = (uint32_t(tmp33) >> 24) & 0xFF; tmp34[1] = (uint32_t(tmp33) >> 16) & 0xFF; tmp34[2] = (uint32_t(tmp33) >> 8) & 0xFF; tmp34[3] = (uint32_t(tmp33) >> 0) & 0xFF; in.append(tmp34, 4); in.append(in0.M3u8Url); } in.append((char*)(&in0.Insecure), 1); { uint32_t tmp35 = in0.SaveDir.length(); char tmp36[4]; tmp36[0] = (uint32_t(tmp35) >> 24) & 0xFF; tmp36[1] = (uint32_t(tmp35) >> 16) & 0xFF; tmp36[2] = (uint32_t(tmp35) >> 8) & 0xFF; tmp36[3] = (uint32_t(tmp35) >> 0) & 0xFF; in.append(tmp36, 4); in.append(in0.SaveDir); } { uint32_t tmp37 = in0.FileName.length(); char tmp38[4]; tmp38[0] = (uint32_t(tmp37) >> 24) & 0xFF; tmp38[1] = (uint32_t(tmp37) >> 16) & 0xFF; tmp38[2] = (uint32_t(tmp37) >> 8) & 0xFF; tmp38[3] = (uint32_t(tmp37) >> 0) & 0xFF; in.append(tmp38, 4); in.append(in0.FileName); } { char tmp39[4]; tmp39[0] = (uint32_t(in0.SkipTsCountFromHead) >> 24) & 0xFF; tmp39[1] = (uint32_t(in0.SkipTsCountFromHead) >> 16) & 0xFF; tmp39[2] = (uint32_t(in0.SkipTsCountFromHead) >> 8) & 0xFF; tmp39[3] = (uint32_t(in0.SkipTsCountFromHead) >> 0) & 0xFF; in.append(tmp39, 4); } { uint32_t tmp40 = in0.SetProxy.length(); char tmp41[4]; tmp41[0] = (uint32_t(tmp40) >> 24) & 0xFF; tmp41[1] = (uint32_t(tmp40) >> 16) & 0xFF; tmp41[2] = (uint32_t(tmp40) >> 8) & 0xFF; tmp41[3] = (uint32_t(tmp40) >> 0) & 0xFF; in.append(tmp41, 4); in.append(in0.SetProxy); } { uint32_t tmp42 = in0.HeaderMap.size(); char tmp43[4]; tmp43[0] = (uint32_t(tmp42) >> 24) & 0xFF; tmp43[1] = (uint32_t(tmp42) >> 16) & 0xFF; tmp43[2] = (uint32_t(tmp42) >> 8) & 0xFF; tmp43[3] = (uint32_t(tmp42) >> 0) & 0xFF; in.append(tmp43, 4); for(std::map>::iterator tmp44 = in0.HeaderMap.begin(); tmp44 != in0.HeaderMap.end(); ++tmp44) { { uint32_t tmp45 = tmp44->first.length(); char tmp46[4]; tmp46[0] = (uint32_t(tmp45) >> 24) & 0xFF; tmp46[1] = (uint32_t(tmp45) >> 16) & 0xFF; tmp46[2] = (uint32_t(tmp45) >> 8) & 0xFF; tmp46[3] = (uint32_t(tmp45) >> 0) & 0xFF; in.append(tmp46, 4); in.append(tmp44->first); } { uint32_t tmp47 = tmp44->second.size(); char tmp48[4]; tmp48[0] = (uint32_t(tmp47) >> 24) & 0xFF; tmp48[1] = (uint32_t(tmp47) >> 16) & 0xFF; tmp48[2] = (uint32_t(tmp47) >> 8) & 0xFF; tmp48[3] = (uint32_t(tmp47) >> 0) & 0xFF; in.append(tmp48, 4); for (uint32_t tmp49=0; tmp49 < tmp47; ++tmp49) { { uint32_t tmp50 = tmp44->second[tmp49].length(); char tmp51[4]; tmp51[0] = (uint32_t(tmp50) >> 24) & 0xFF; tmp51[1] = (uint32_t(tmp50) >> 16) & 0xFF; tmp51[2] = (uint32_t(tmp50) >> 8) & 0xFF; tmp51[3] = (uint32_t(tmp50) >> 0) & 0xFF; in.append(tmp51, 4); in.append(tmp44->second[tmp49]); } } } } } in.append((char*)(&in0.SkipRemoveTs), 1); in.append((char*)(&in0.ProgressBarShow), 1); { char tmp52[4]; tmp52[0] = (uint32_t(in0.ThreadCount) >> 24) & 0xFF; tmp52[1] = (uint32_t(in0.ThreadCount) >> 16) & 0xFF; tmp52[2] = (uint32_t(in0.ThreadCount) >> 8) & 0xFF; tmp52[3] = (uint32_t(in0.ThreadCount) >> 0) & 0xFF; in.append(tmp52, 4); } } char *out = NULL; int outLen = 0; Go2cppFn_RunDownload_Req_ToCurlStr((char *)in.data(), in.length(), &out, &outLen); std::string retValue; int outIdx = 0; { uint32_t tmp53 = 0; uint32_t tmp54 = uint32_t(uint8_t(out[outIdx+0]) << 24); uint32_t tmp55 = uint32_t(uint8_t(out[outIdx+1]) << 16); uint32_t tmp56 = uint32_t(uint8_t(out[outIdx+2]) << 8); uint32_t tmp57 = uint32_t(uint8_t(out[outIdx+3]) << 0); tmp53 = tmp54 | tmp55 | tmp56 | tmp57; outIdx+=4; retValue = std::string(out+outIdx, out+outIdx+tmp53); outIdx+=tmp53; } if (out != NULL) { free(out); } return retValue; } std::string GetFileNameFromUrl(std::string in0){ std::string in; { uint32_t tmp5 = in0.length(); char tmp6[4]; tmp6[0] = (uint32_t(tmp5) >> 24) & 0xFF; tmp6[1] = (uint32_t(tmp5) >> 16) & 0xFF; tmp6[2] = (uint32_t(tmp5) >> 8) & 0xFF; tmp6[3] = (uint32_t(tmp5) >> 0) & 0xFF; in.append(tmp6, 4); in.append(in0); } char *out = NULL; int outLen = 0; Go2cppFn_GetFileNameFromUrl((char *)in.data(), in.length(), &out, &outLen); std::string retValue; int outIdx = 0; { uint32_t tmp7 = 0; uint32_t tmp8 = uint32_t(uint8_t(out[outIdx+0]) << 24); uint32_t tmp9 = uint32_t(uint8_t(out[outIdx+1]) << 16); uint32_t tmp10 = uint32_t(uint8_t(out[outIdx+2]) << 8); uint32_t tmp11 = uint32_t(uint8_t(out[outIdx+3]) << 0); tmp7 = tmp8 | tmp9 | tmp10 | tmp11; outIdx+=4; retValue = std::string(out+outIdx, out+outIdx+tmp7); outIdx+=tmp7; } if (out != NULL) { free(out); } return retValue; } MergeTsDir_Resp MergeTsDir(std::string in0, std::string in1){ std::string in; { uint32_t tmp9 = in0.length(); char tmp10[4]; tmp10[0] = (uint32_t(tmp9) >> 24) & 0xFF; tmp10[1] = (uint32_t(tmp9) >> 16) & 0xFF; tmp10[2] = (uint32_t(tmp9) >> 8) & 0xFF; tmp10[3] = (uint32_t(tmp9) >> 0) & 0xFF; in.append(tmp10, 4); in.append(in0); } { uint32_t tmp11 = in1.length(); char tmp12[4]; tmp12[0] = (uint32_t(tmp11) >> 24) & 0xFF; tmp12[1] = (uint32_t(tmp11) >> 16) & 0xFF; tmp12[2] = (uint32_t(tmp11) >> 8) & 0xFF; tmp12[3] = (uint32_t(tmp11) >> 0) & 0xFF; in.append(tmp12, 4); in.append(in1); } char *out = NULL; int outLen = 0; Go2cppFn_MergeTsDir((char *)in.data(), in.length(), &out, &outLen); MergeTsDir_Resp retValue; int outIdx = 0; { { uint32_t tmp13 = 0; uint32_t tmp14 = uint32_t(uint8_t(out[outIdx+0]) << 24); uint32_t tmp15 = uint32_t(uint8_t(out[outIdx+1]) << 16); uint32_t tmp16 = uint32_t(uint8_t(out[outIdx+2]) << 8); uint32_t tmp17 = uint32_t(uint8_t(out[outIdx+3]) << 0); tmp13 = tmp14 | tmp15 | tmp16 | tmp17; outIdx+=4; retValue.ErrMsg = std::string(out+outIdx, out+outIdx+tmp13); outIdx+=tmp13; } retValue.IsCancel = (bool) out[outIdx]; outIdx++; } if (out != NULL) { free(out); } return retValue; } void MergeStop(){ std::string in; char *out = NULL; int outLen = 0; Go2cppFn_MergeStop((char *)in.data(), in.length(), &out, &outLen); if (out != NULL) { free(out); } } MergeGetProgressPercent_Resp MergeGetProgressPercent(){ std::string in; char *out = NULL; int outLen = 0; Go2cppFn_MergeGetProgressPercent((char *)in.data(), in.length(), &out, &outLen); MergeGetProgressPercent_Resp retValue; int outIdx = 0; { { uint32_t tmp4 = uint32_t(uint8_t(out[outIdx+0]) << 24); uint32_t tmp5 = uint32_t(uint8_t(out[outIdx+1]) << 16); uint32_t tmp6 = uint32_t(uint8_t(out[outIdx+2]) << 8); uint32_t tmp7 = uint32_t(uint8_t(out[outIdx+3]) << 0); retValue.Percent = tmp4 | tmp5 | tmp6 | tmp7; outIdx+=4; } { uint32_t tmp8 = 0; uint32_t tmp9 = uint32_t(uint8_t(out[outIdx+0]) << 24); uint32_t tmp10 = uint32_t(uint8_t(out[outIdx+1]) << 16); uint32_t tmp11 = uint32_t(uint8_t(out[outIdx+2]) << 8); uint32_t tmp12 = uint32_t(uint8_t(out[outIdx+3]) << 0); tmp8 = tmp9 | tmp10 | tmp11 | tmp12; outIdx+=4; retValue.SpeedText = std::string(out+outIdx, out+outIdx+tmp8); outIdx+=tmp8; } retValue.IsRunning = (bool) out[outIdx]; outIdx++; } if (out != NULL) { free(out); } return retValue; } // Qt: #include #include RunOnUiThread::RunOnUiThread(QObject *parent) : QObject(parent), m_done(false) { // 用signal里的Qt::QueuedConnection 将多线程里面的函数转化到ui线程里调用 connect(this, SIGNAL(signal_newFn()), this, SLOT(slot_newFn()), Qt::QueuedConnection); } RunOnUiThread::~RunOnUiThread() { { QMutexLocker lk(&this->m_Mutex); this->m_done = true; this->m_funcList.clear(); } this->m_pool.clear(); this->m_pool.waitForDone(); } void RunOnUiThread::AddRunFnOn_OtherThread(std::function fn) { QMutexLocker lk(&this->m_Mutex); if (this->m_done) { return; } QtConcurrent::run(&this->m_pool, fn); } void RunOnUiThread::slot_newFn() { QVector> fn_vector; { QMutexLocker lk(&this->m_Mutex); if (this->m_funcList.empty() || this->m_done) { return; } fn_vector.swap(this->m_funcList); } for(std::function& fn : fn_vector) { bool v_done = false; { QMutexLocker lk(&this->m_Mutex); v_done = this->m_done; } if (v_done) { // 快速结束 return; } fn(); } } void RunOnUiThread::AddRunFnOn_UiThread(std::function fn) { { QMutexLocker lk(&this->m_Mutex); if (this->m_done) { return; } m_funcList.push_back(fn); } emit this->signal_newFn(); } bool RunOnUiThread::Get_Done() { QMutexLocker lk(&this->m_Mutex); return this->m_done; } #include #include #include #include #include #include #include #include #include QString StringToRGBA(const QString &color); Toast::Toast(QObject *parent) : QObject(parent) { m_myWidget = new QWidget; m_myWidget->setFixedHeight(60); m_label = new QLabel; m_label->setFixedHeight(30); m_label->move(0,0); QFont ft; ft.setPointSize(10); m_label->setFont(ft); m_label->setAlignment(Qt::AlignCenter); m_label->setStyleSheet("color:white"); m_myWidget->setStyleSheet("border: none;background-color:black;border-radius:10px"); QHBoxLayout * la = new QHBoxLayout; la->addWidget(m_label); la->setContentsMargins(0,0,0,0); m_myWidget->setLayout(la); m_myWidget->hide(); m_myWidget->setWindowFlags(Qt::FramelessWindowHint | Qt::Tool | Qt::WindowStaysOnTopHint); m_myWidget->setAttribute(Qt::WA_TranslucentBackground,true); m_timer = new QTimer(); m_timer->setInterval(3000); connect(m_timer,SIGNAL(timeout()),this,SLOT(onTimerStayOut())); } Toast *Toast::Instance() { static Toast instance; return &instance; } void Toast::setText(const QString &color,const QString &bgcolor,const int & mestime,const QString &text){ QApplication::beep(); QFontMetrics fm(m_label->font()); int width = fm.boundingRect(text).width() + 30; m_myWidget->setFixedWidth(width); m_label->setFixedWidth(width); m_label->setText(text); QString style = QString("color:").append(StringToRGBA(color)); m_label->setStyleSheet(style); m_myWidget->setStyleSheet(QString("border: none;border-radius:10px;") .append("background-color:").append(StringToRGBA(bgcolor))); QDesktopWidget *pDesk = QApplication::desktop(); m_myWidget->move((pDesk->width() - m_myWidget->width()) / 2, (pDesk->height() - m_myWidget->height()) / 2); m_myWidget->show(); m_timer->setInterval(mestime); m_timer->stop(); m_timer->start(); } void Toast::SetError(const QString &text,const int & mestime){ setText("FFFFFF","FF0000",mestime,text); } void Toast::SetSuccess(const QString &text,const int & mestime){ setText("000000","00FF00",mestime,text); } void Toast::SetWaring(const QString &text,const int & mestime){ setText("FF0000","FFFF00",mestime,text); } void Toast::SetTips(const QString &text,const int & mestime){ setText("FFFFFF","0080FF",mestime,text); } QString StringToRGBA(const QString &color){ int r = color.mid(0,2).toInt(nullptr,16); int g = color.mid(2,2).toInt(nullptr,16); int b = color.mid(4,2).toInt(nullptr,16); int a = color.length()>=8?color.mid(6,2).toInt(nullptr,16):QString("FF").toInt(nullptr,16); QString style = QString("rgba(").append(QString::number(r)).append(",") .append(QString::number(g)).append(",") .append(QString::number(b)).append(",") .append(QString::number(a)) .append(");"); return style; } void Toast::onTimerStayOut() { m_timer->stop(); m_myWidget->hide(); }