// int program_map_section_write(program_map_section_t *pms, uint8_t *buf, size_t buf_size); int program_map_section_print(program_map_section_t *pms, char *str, size_t str_len) { if (pms == NULL || str == NULL || str_len < 2 || tslib_loglevel < TSLIB_LOG_LEVEL_INFO) return 0; int bytes = 0; LOG_INFO("Program Map Section"); bytes += SKIT_LOG_UINT(str + bytes, 1, pms->table_id, str_len - bytes); bytes += SKIT_LOG_UINT(str + bytes, 1, pms->section_syntax_indicator, str_len - bytes); bytes += SKIT_LOG_UINT(str + bytes, 1, pms->section_length, str_len - bytes); bytes += SKIT_LOG_UINT(str + bytes, 1, pms->program_number, str_len - bytes); bytes += SKIT_LOG_UINT(str + bytes, 1, pms->version_number, str_len - bytes); bytes += SKIT_LOG_UINT(str + bytes, 1, pms->current_next_indicator, str_len - bytes); bytes += SKIT_LOG_UINT(str + bytes, 1, pms->section_number, str_len - bytes); bytes += SKIT_LOG_UINT(str + bytes, 1, pms->last_section_number, str_len - bytes); bytes += SKIT_LOG_UINT_HEX(str + bytes, 1, pms->PCR_PID, str_len - bytes); bytes += SKIT_LOG_UINT(str + bytes, 1, pms->program_info_length, str_len - bytes); bytes += print_descriptor_loop(pms->descriptors, 2, str + bytes, str_len - bytes); bytes += print_es_info_loop(pms->es_info, 2, str + bytes, str_len - bytes); bytes += SKIT_LOG_UINT_HEX(str + bytes, 1, pms->CRC_32, str_len - bytes); return bytes; }
int descriptor_print(const descriptor_t *desc, int level, char* str, size_t str_len) { if (desc == NULL || str == NULL || str_len < 2 || tslib_loglevel < TSLIB_LOG_LEVEL_INFO) return 0; int bytes = 0; // test only, replace with function pointer if (desc->tag == ISO_639_LANGUAGE_DESCRIPTOR) return language_descriptor_print(desc, level, str, str_len); bytes += SKIT_LOG_UINT( str + bytes, level, desc->tag, str_len - bytes ); bytes += SKIT_LOG_UINT( str + bytes, level, desc->length, str_len - bytes); return bytes; }
int es_info_print(elementary_stream_info_t *es, int level, char *str, size_t str_len) { if (es == NULL || str == NULL || str_len < 2 || tslib_loglevel < TSLIB_LOG_LEVEL_INFO) return 0; int bytes = 0; bytes += SKIT_LOG_UINT_VERBOSE(str + bytes, level, es->stream_type, stream_desc(es->stream_type), str_len - bytes); bytes += SKIT_LOG_UINT_HEX(str + bytes, level, es->elementary_PID, str_len - bytes); bytes += SKIT_LOG_UINT(str + bytes, level, es->ES_info_length, str_len - bytes); bytes += print_descriptor_loop(es->descriptors, level + 1, str + bytes, str_len - bytes); return bytes; }
int language_descriptor_print(const descriptor_t *desc, int level, char* str, size_t str_len) { int bytes = 0; if (desc == NULL) return 0; if (desc->tag != ISO_639_LANGUAGE_DESCRIPTOR) return 0; language_descriptor_t *ld = (language_descriptor_t*) desc; bytes += SKIT_LOG_UINT_VERBOSE( str + bytes, level, desc->tag, "ISO_639_language_descriptor", str_len - bytes ); bytes += SKIT_LOG_UINT( str + bytes, level, desc->length, str_len - bytes); if (ld->_num_languages > 0) { for (int i = 0; i < ld->_num_languages; i++) { bytes += SKIT_LOG_STR( str + bytes, level, ld->languages[i].ISO_639_language_code, str_len - bytes); bytes += SKIT_LOG_UINT( str + bytes, level, ld->languages[i].audio_type, str_len - bytes); } } return bytes; }
//int program_association_section_write(program_association_section_t *pat, bs_t *bs); int program_association_section_print(const program_association_section_t *pas, char* str, size_t str_len) { if (pas == NULL || str == NULL || str_len < 2 || tslib_loglevel < TSLIB_LOG_LEVEL_INFO) return 0; int bytes = 0; LOG_INFO("Program Association Section"); bytes += SKIT_LOG_UINT (str + bytes, 0, pas->table_id, str_len); bytes += SKIT_LOG_UINT (str + bytes, 0, pas->section_syntax_indicator, str_len - bytes); bytes += SKIT_LOG_UINT (str + bytes, 0, pas->section_length, str_len - bytes); bytes += SKIT_LOG_UINT_HEX (str + bytes, 0, pas->transport_stream_id , str_len - bytes); bytes += SKIT_LOG_UINT (str + bytes, 0, pas->version_number, str_len - bytes); bytes += SKIT_LOG_UINT (str + bytes, 0, pas->current_next_indicator, str_len - bytes); bytes += SKIT_LOG_UINT (str + bytes, 0, pas->section_number, str_len - bytes); bytes += SKIT_LOG_UINT (str + bytes, 0, pas->last_section_number, str_len - bytes); for (int i = 0; i < pas->_num_programs; i++) { bytes += SKIT_LOG_UINT (str + bytes, 1, pas->programs[i].program_number, str_len - bytes); bytes += SKIT_LOG_UINT_HEX (str + bytes, 1, pas->programs[i].program_map_PID, str_len - bytes); } bytes += SKIT_LOG_UINT_HEX (str + bytes, 0, pas->CRC_32 , str_len - bytes); return bytes; }
//int conditional_access_section_write(conditional_access_section_t *pat, bs_t *bs); int conditional_access_section_print(const conditional_access_section_t *cas, char *str, size_t str_len) { if (cas == NULL || str == NULL || str_len < 2 || tslib_loglevel < TSLIB_LOG_LEVEL_INFO) return 0; int bytes = 0; LOG_INFO("Conditional Access Section"); bytes += SKIT_LOG_UINT(str + bytes, 0, cas->table_id, str_len); bytes += SKIT_LOG_UINT(str + bytes, 0, cas->section_syntax_indicator, str_len - bytes); bytes += SKIT_LOG_UINT(str + bytes, 0, cas->section_length, str_len - bytes); bytes += SKIT_LOG_UINT(str + bytes, 0, cas->version_number, str_len - bytes); bytes += SKIT_LOG_UINT(str + bytes, 0, cas->current_next_indicator, str_len - bytes); bytes += SKIT_LOG_UINT(str + bytes, 0, cas->section_number, str_len - bytes); bytes += SKIT_LOG_UINT(str + bytes, 0, cas->last_section_number, str_len - bytes); bytes += print_descriptor_loop(cas->descriptors, 2, str + bytes, str_len - bytes); bytes += SKIT_LOG_UINT_HEX(str + bytes, 0, cas->CRC_32, str_len - bytes); return bytes; }