📄 sender.c
字号:
return NULL; } memcpy((fdt_inst_payload + (unsigned int)position), tmp_line, strlen(tmp_line)); position += strlen(tmp_line); } if(fdt->encoding != NULL) { memset(tmp_line, 0, MAX_PATH); sprintf(tmp_line, "\n\tContent-Encoding=\"%s\"", fdt->encoding); size += strlen(tmp_line); /* Reallocate memory for fdt_inst_payload */ if(!(fdt_inst_payload = (char*)realloc(fdt_inst_payload, ((unsigned int)size * sizeof(char))))) {#ifdef WIN32 printf("Could not (re)alloc memory for fdt_inst_payload, size: %I64u!\n", size);#else printf("Could not (re)alloc memory for fdt_inst_payload, size: %llu!\n", size);#endif return NULL; } memcpy((fdt_inst_payload + (unsigned int)position), tmp_line, strlen(tmp_line)); position += strlen(tmp_line); } #ifdef FDT_INST_FEC_OTI_COMMON if(s->use_fec_oti_ext_hdr == 0) { /**** FEC-OTI parameters ****/ memset(tmp_line, 0, MAX_PATH); sprintf(tmp_line, "\n\tFEC-OTI-FEC-Encoding-ID=\"%u\"", fdt->fec_enc_id); size += strlen(tmp_line); /* Reallocate memory for fdt_inst_payload */ if(!(fdt_inst_payload = (char*)realloc(fdt_inst_payload, ((unsigned int)size * sizeof(char))))) {#ifdef WIN32 printf("Could not (re)alloc memory for fdt_inst_payload, size: %I64u!\n", size);#else printf("Could not (re)alloc memory for fdt_inst_payload, size: %llu!\n", size);#endif return NULL; } memcpy((fdt_inst_payload + (unsigned int)position), tmp_line, strlen(tmp_line)); position += strlen(tmp_line); if(fdt->fec_enc_id > 127) { memset(tmp_line, 0, MAX_PATH); sprintf(tmp_line, "\n\tFEC-OTI-FEC-Instance-ID=\"%u\"", fdt->fec_inst_id); size += strlen(tmp_line); /* Reallocate memory for fdt_inst_payload */ if(!(fdt_inst_payload = (char*)realloc(fdt_inst_payload, ((unsigned int)size * sizeof(char))))) {#ifdef WIN32 printf("Could not (re)alloc memory for fdt_inst_payload, size: %I64u!\n", size);#else printf("Could not (re)alloc memory for fdt_inst_payload, size: %llu!\n", size);#endif return NULL; } memcpy((fdt_inst_payload + (unsigned int)position), tmp_line, strlen(tmp_line)); position += strlen(tmp_line); } memset(tmp_line, 0, MAX_PATH); sprintf(tmp_line, "\n\tFEC-OTI-Maximum-Source-Block-Length=\"%u\"", fdt->max_sb_len); size += strlen(tmp_line); /* Reallocate memory for fdt_inst_payload */ if(!(fdt_inst_payload = (char*)realloc(fdt_inst_payload, ((unsigned int)size * sizeof(char))))) {#ifdef WIN32 printf("Could not (re)alloc memory for fdt_inst_payload, size: %I64u!\n", size);#else printf("Could not (re)alloc memory for fdt_inst_payload, size: %llu!\n", size);#endif return NULL; } memcpy((fdt_inst_payload + (unsigned int)position), tmp_line, strlen(tmp_line)); position += strlen(tmp_line); memset(tmp_line, 0, MAX_PATH); sprintf(tmp_line, "\n\tFEC-OTI-Encoding-Symbol-Length=\"%u\"", fdt->es_len); size += strlen(tmp_line); /* Reallocate memory for fdt_inst_payload */ if(!(fdt_inst_payload = (char*)realloc(fdt_inst_payload, ((unsigned int)size * sizeof(char))))) {#ifdef WIN32 printf("Could not (re)alloc memory for fdt_inst_payload, size: %I64u!\n", size);#else printf("Could not (re)alloc memory for fdt_inst_payload, size: %llu!\n", size);#endif return NULL; } memcpy((fdt_inst_payload + (unsigned int)position), tmp_line, strlen(tmp_line)); position += strlen(tmp_line); if(fdt->fec_enc_id == SB_SYS_FEC_ENC_ID) { memset(tmp_line, 0, MAX_PATH); sprintf(tmp_line, "\n\tFEC-OTI-Max-Number-of-Encoding-Symbols=\"%u\"", fdt->max_nb_of_es); size += strlen(tmp_line); /* Reallocate memory for fdt_inst_payload */ if(!(fdt_inst_payload = (char*)realloc(fdt_inst_payload, ((unsigned int)size * sizeof(char))))) {#ifdef WIN32 printf("Could not (re)alloc memory for fdt_inst_payload, size: %I64u!\n", size);#else printf("Could not (re)alloc memory for fdt_inst_payload, size: %llu!\n", size);#endif return NULL; } memcpy((fdt_inst_payload + (unsigned int)position), tmp_line, strlen(tmp_line)); position += strlen(tmp_line); } }#endif memset(tmp_line, 0, MAX_PATH); sprintf(tmp_line, ">\n"); size += strlen(tmp_line); /* Reallocate memory for fdt_inst_payload */ if(!(fdt_inst_payload = (char*)realloc(fdt_inst_payload, ((unsigned int)size * sizeof(char))))) {#ifdef WIN32 printf("Could not (re)alloc memory for fdt_inst_payload, size: %I64u!\n", size);#else printf("Could not (re)alloc memory for fdt_inst_payload, size: %llu!\n", size);#endif return NULL; } memcpy((fdt_inst_payload + (unsigned int)position), tmp_line, strlen(tmp_line)); position += strlen(tmp_line); for(i = 0; i < nb_of_files; i++) { if(tmp_file == NULL) { break; } memset(tmp_line, 0, MAX_PATH); #ifdef WIN32 sprintf(tmp_line, "\t<File TOI=\"%I64u\"", tmp_file->toi);#else sprintf(tmp_line, "\t<File TOI=\"%llu\"", tmp_file->toi);#endif size += strlen(tmp_line); /* Reallocate memory for fdt_inst_payload */ if(!(fdt_inst_payload = (char*)realloc(fdt_inst_payload, ((unsigned int)size * sizeof(char))))) {#ifdef WIN32 printf("Could not (re)alloc memory for fdt_inst_payload, size: %I64u!\n", size);#else printf("Could not (re)alloc memory for fdt_inst_payload, size: %llu!\n", size);#endif return NULL; } memcpy((fdt_inst_payload + (unsigned int)position), tmp_line, strlen(tmp_line)); position += strlen(tmp_line); memset(tmp_line, 0, MAX_PATH); sprintf(tmp_line, "\n\t\tContent-Location=\"%s\"", tmp_file->location); size += strlen(tmp_line); /* Reallocate memory for fdt_inst_payload */ if(!(fdt_inst_payload = (char*)realloc(fdt_inst_payload, ((unsigned int)size * sizeof(char))))) {#ifdef WIN32 printf("Could not (re)alloc memory for fdt_inst_payload, size: %I64u!\n", size);#else printf("Could not (re)alloc memory for fdt_inst_payload, size: %llu!\n", size);#endif return NULL; } memcpy((fdt_inst_payload + (unsigned int)position), tmp_line, strlen(tmp_line)); position += strlen(tmp_line); memset(tmp_line, 0, MAX_PATH);#ifdef WIN32 sprintf(tmp_line, "\n\t\tContent-Length=\"%I64u\"", tmp_file->file_len);#else sprintf(tmp_line, "\n\t\tContent-Length=\"%llu\"", tmp_file->file_len);#endif size += strlen(tmp_line); /* Reallocate memory for fdt_inst_payload */ if(!(fdt_inst_payload = (char*)realloc(fdt_inst_payload, ((unsigned int)size * sizeof(char))))) {#ifdef WIN32 printf("Could not (re)alloc memory for fdt_inst_payload, size: %I64u!\n", size);#else printf("Could not (re)alloc memory for fdt_inst_payload, size: %llu!\n", size);#endif return NULL; } memcpy((fdt_inst_payload + (unsigned int)position), tmp_line, strlen(tmp_line)); position += strlen(tmp_line); print_help = 0; if(tmp_file->type != NULL) { if(fdt->type != NULL) { if(strcmp(tmp_file->type, fdt->type) != 0) { print_help = 1; } } else { print_help = 1; } } if(print_help) { memset(tmp_line, 0, MAX_PATH); sprintf(tmp_line, "\n\t\tContent-Type=\"%s\"", tmp_file->type); size += strlen(tmp_line); /* Reallocate memory for fdt_inst_payload */ if(!(fdt_inst_payload = (char*)realloc(fdt_inst_payload, ((unsigned int)size * sizeof(char))))) {#ifdef WIN32 printf("Could not (re)alloc memory for fdt_inst_payload, size: %I64u!\n", size);#else printf("Could not (re)alloc memory for fdt_inst_payload, size: %llu!\n", size);#endif return NULL; } memcpy((fdt_inst_payload + (unsigned int)position), tmp_line, strlen(tmp_line)); position += strlen(tmp_line); } if(tmp_file->md5 != NULL) { memset(tmp_line, 0, MAX_PATH); sprintf(tmp_line, "\n\t\tContent-MD5=\"%s\"", tmp_file->md5); size += strlen(tmp_line); /* Reallocate memory for fdt_inst_payload */ if(!(fdt_inst_payload = (char*)realloc(fdt_inst_payload, ((unsigned int)size * sizeof(char))))) {#ifdef WIN32 printf("Could not (re)alloc memory for fdt_inst_payload, size: %I64u!\n", size);#else printf("Could not (re)alloc memory for fdt_inst_payload, size: %llu!\n", size);#endif return NULL; } memcpy((fdt_inst_payload + (unsigned int)position), tmp_line, strlen(tmp_line)); position += strlen(tmp_line); } print_help = 0; if(tmp_file->encoding != NULL) { if(fdt->encoding != NULL) { if(strcmp(tmp_file->encoding, fdt->encoding) != 0) { print_help = 1; } } else { print_help = 1; } } if(print_help) { memset(tmp_line, 0, MAX_PATH); sprintf(tmp_line, "\n\t\tContent-Encoding=\"%s\"", tmp_file->encoding); size += strlen(tmp_line); /* Reallocate memory for fdt_inst_payload */ if(!(fdt_inst_payload = (char*)realloc(fdt_inst_payload, ((unsigned int)size * sizeof(char))))) {#ifdef WIN32 printf("Could not (re)alloc memory for fdt_inst_payload, size: %I64u!\n", size);#else printf("Could not (re)alloc memory for fdt_inst_payload, size: %llu!\n", size);#endif return NULL; } memcpy((fdt_inst_payload + (unsigned int)position), tmp_line, strlen(tmp_line)); position += strlen(tmp_line); } if(tmp_file->encoding != NULL || fdt->encoding != NULL) { memset(tmp_line, 0, MAX_PATH); #ifdef WIN32 sprintf(tmp_line, "\n\t\tTransfer-Length=\"%I64u\"", tmp_file->toi_len); #else sprintf(tmp_line, "\n\t\tTransfer-Length=\"%llu\"", tmp_file->toi_len); #endif size += strlen(tmp_line); /* Reallocate memory for fdt_inst_payload */ if(!(fdt_inst_payload = (char*)realloc(fdt_inst_payload, ((unsigned int)size * sizeof(char))))) { #ifdef WIN32 printf("Could not (re)alloc memory for fdt_inst_payload, size: %I64u!\n", size); #else printf("Could not (re)alloc memory for fdt_inst_payload, size: %llu!\n", size); #endif return NULL; } memcpy((fdt_inst_payload + (unsigned int)position), tmp_line, strlen(tmp_line)); position += strlen(tmp_line); } if(s->use_fec_oti_ext_hdr == 0) { /**** FEC-OTI parameters ****/#ifdef FDT_INST_FEC_OTI_FILE memset(tmp_line, 0, MAX_PATH); sprintf(tmp_line, "\n\t\tFEC-OTI-FEC-Encoding-ID=\"%u\"", tmp_file->fec_encoding_id); size += strlen(tmp_line); /* Reallocate memory for fdt_inst_payload */ if(!(fdt_inst_payload = (char*)realloc(fdt_inst_payload, ((unsigned int)size * sizeof(char))))) {#ifdef WIN32 printf("Could not (re)alloc memory for fdt_inst_payload, size: %I64u!\n", size);#else printf("Could not (re)alloc memory for fdt_inst_payload, size: %llu!\n", size);#endif return NULL; } memcpy((fdt_inst_payload + (unsigned int)position), tmp_line, strlen(tmp_line)); position += strlen(tmp_line); if(tmp_file->fec_encoding_id > 127) { memset(tmp_line, 0, MAX_PATH); sprintf(tmp_line, "\n\t\tFEC-OTI-FEC-Instance-ID=\"%u\"", tmp_file->fec_instance_id); size += strlen(tmp_line); /* Reallocate memory for fdt_inst_payload */ if(!(fdt_inst_payload = (char*)realloc(fdt_inst_payload, ((unsigned int)size * sizeof(char))))) {#ifdef WIN32 printf("Could not (re)alloc memory for fdt_inst_payload, size: %I64u!\n", size);#else printf("Could not (re)alloc memory for fdt_inst_payload, size: %llu!\n", size);#endif return NULL; } memcpy((fdt_inst_payload + (unsigned int)position), tmp_line, strlen(tmp_line)); position += strlen(tmp_line); } memset(tmp_line, 0, MAX_PATH); sprintf(tmp_line, "\n\t\tFEC-OTI-Maximum-Source-Block-Length=\"%u\"", tmp_file->max_source_block_length); size += strlen(tmp_line); /* Reallocate memory for fdt_inst_payload */ if(!(fdt_inst_payload = (char*)realloc(fdt_inst_payload, ((unsigned int)size * sizeof(char))))) {#ifdef WIN32 printf("Could not (re)alloc memory for fdt_inst_payload, size: %I64u!\n", size);#else printf("Could not (re)alloc memory for fdt_inst_payload, size: %llu!\n", size);#endif return NULL; } memcpy((fdt_inst_payload + (unsigned int)position), tmp_line, strlen(tmp_line)); position += strlen(tmp_line); memset(tmp_line, 0, MAX_PATH); sprintf(tmp_line, "\n\t\tFEC-OTI-Encoding-Symbol-Length=\"%u\"", tmp_file->encoding_symbol_length); size += strlen(tmp_line); /* Reallocate memory for fdt_inst_payload */ if(!(fdt_inst_payload = (char*)realloc(fdt_inst_payload, ((unsigned int)size * sizeof(char))))) {#ifdef WIN32 printf("Could not (re)alloc memory for fdt_inst_payload, size: %I64u!\n", size);#else printf("Could not (re)alloc memory for fdt_inst_payload, size: %llu!\n", size);#endif return NULL; } memcpy((fdt_inst_payload + (unsigned int)position), tmp_line, strlen(tmp_line)); position += strlen(tmp_line); if(tmp_file->fec_encoding_id == SB_SYS_FEC_ENC_ID) { memset(tmp_line, 0, MAX_PATH); sprintf(tmp_line, "\n\t\tFEC-OTI-Max-Number-of-Encoding-Symbols=\"%u\"", tmp_file->max_nb_of_encoding_symbols); size += strlen(tmp_line); /* Reallocate memory for fdt_inst_payload */ if(!(fdt_inst_payload = (char*)realloc(fdt_inst_payload, ((unsigned int)size * sizeof(char))))) {#ifdef WIN32 printf("Could not (re)alloc memory for fdt_inst_payload, size: %I64u!\n", size);#else printf("Could not (re)alloc memory for fdt_inst_payload, size: %llu!\n", size);#endif return NULL; } memcpy((fdt_inst_payload + (unsigned int)position), tmp_line, strlen(tmp_line)); position += strlen(tmp_line); }#elif defined(FDT_INST_FEC_OTI_COMMON) if(tmp_file->fec_enc_id != fdt->fec_enc_id) { memset(tmp_line, 0, MAX_PATH); sprintf(tmp_line, "\n\t\tFEC-OTI-FEC-Encoding-ID=\"%u\"", tmp_file->fec_enc_id); size += strlen(tmp_line); /* Reallocate memory for fdt_inst_payload */ if(!(fdt_inst_payload = (char*)realloc(fdt_inst_payload, ((unsigned int)size * sizeof(char))))) {#ifdef WIN32 printf("Could not (re)alloc memory for fdt_inst_payload, size: %I64u!\n", size);#else printf("Could not (re)alloc memory for fdt_inst_payload, size: %llu!\n", size);#endif return NULL; } memcpy((fdt_inst_payload + (unsigned int)position), tmp_line, strlen(tmp_line)); position += strlen(tmp_line); } if(tmp_file->fec_enc_id > 127) { if(tmp_file->fec_inst_id != fdt->fec_inst_id) { memset(tmp_line, 0, MAX_PATH); sprintf(tmp_line, "\n\t\tFEC-OTI-FEC-Instance-ID=\"%u\"", tmp_file->fec_inst_id); size += strlen(tmp_line); /* Reallocate memory for fdt_inst_payload */ if(!(fdt_inst_payload = (char*)realloc(fdt_inst_payload, ((unsigned int)size * sizeof(char))))) {#ifdef WIN32 printf("Could not (re)alloc memory for fdt_inst_payload, size: %I64u!\n", size);#else printf("Could not (re)alloc memory for fdt_inst_payload, size: %llu!\n", size);#endif return NULL; } memcpy((fdt_inst_payload + (unsigned int)position), tmp_line, strlen(tmp_line)); position += strlen(tmp_line); } } if(tmp_file->max_sb_len != fdt->max_sb_len) { memset(tmp_line, 0, MAX_PATH); sprintf(tmp_line, "\n\t\tFEC-OTI-Maximum-Source-Block-Length=\"%u\"", tmp_file->max_sb_len); size += strlen(tmp_line); /* Reallocate memory for fdt_inst_payload */ if(!(fdt_inst_payload = (char*)realloc(fdt_inst_payload, ((unsigned int)size * sizeof(char))))) {#ifdef WIN32 printf("Could not (re)alloc memory for fdt_inst_payload, size: %I64u!\n", size);#else printf("Could not (re)alloc memory for fdt_inst_payload, size: %llu!\n", size);#endif return NULL; } memcpy((fdt_inst_payload + (unsigned int)position), tmp_line, strlen(tmp_line)); position += strlen(tmp_line); } if(tmp_file->es_len != fdt->es_len) { memset(tmp_line, 0, MAX_PATH); sprintf(tmp_line, "\n\t\tFEC-OTI-Encoding-Symbol-Length=\"%u\"", tmp_file->es_len); size += strlen(tmp_line); /* Reallocate memory for fdt_inst_payload */ if(!(fdt_inst_payload = (char*)realloc(fdt_inst_payload, ((unsigned int)size * sizeof(char))))) {#ifdef WIN32 printf("Could not (re)alloc memory for fdt_inst_payload, size: %I64u!\n", size);#else printf("Could not (re)alloc memory for fdt_inst_payload, size: %llu!\n", size);#endif return NULL; } memcpy((fdt_inst_payload + (unsigned int)position), tmp_line, strlen(tmp_line)); position += strlen(tmp_line); } if(tmp_file->fec_enc_id == SB_SYS_FEC_ENC_ID) { if(tmp_file->max_nb_of_es != fdt->max_nb_of_es) { memset(tmp_line, 0, MAX_PATH); sprintf(tmp_line, "\n\t\tFEC-OTI-Max-Number-of-Encoding-Symbols=\"%u\"", tmp_file->max_nb_of_es); size += strlen(tmp_line); /* Reallocate memory for fdt_inst_payload */ if(!(fdt_inst_payload = (char*)realloc(fdt_inst_payload, ((unsigned int)size * sizeof(char))))) {#ifdef WIN32 printf("Could not (re)alloc memory for fdt_inst_payload, size: %I64u!\n", size);#else printf("Could not (re)alloc memory for fdt_inst_payload, size: %llu!\n", size);#endif return NULL; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -