11#ifndef MTS_PRINT_PIDS_LEN
12#define MTS_PRINT_PIDS_LEN (16)
15#ifndef MTS_UNDERFLOW_LIMIT
16#define MTS_UNDERFLOW_LIMIT 188
19#ifndef MTS_WRITE_BUFFER_SIZE
20#define MTS_WRITE_BUFFER_SIZE 2000
24#define ALLOC_MEM_INIT 0
113 const char *
mime() {
return "video/MP2T"; }
117 LOGD(
"MTSDecoderTSDemux::write: %d", (
int)len);
208 LOGD(
"parsing new file");
219 LOGD(
"Number of demux calls: %d", count);
228 LOGW(
"TSD_INVALID_SYNC_BYTE");
231 LOGW(
"TSD_INVALID_CONTEXT");
234 LOGW(
"TSD_INVALID_DATA");
237 LOGW(
"TSD_INVALID_DATA_SIZE");
240 LOGW(
"TSD_INVALID_ARGUMENT");
243 LOGW(
"TSD_INVALID_START_CODE_PREFIX");
246 LOGW(
"TSD_OUT_OF_MEMORY");
249 LOGW(
"TSD_INCOMPLETE_TABLE");
252 LOGW(
"TSD_NOT_A_TABLE_PACKET");
255 LOGW(
"TSD_PARSE_ERROR");
258 LOGW(
"TSD_PID_ALREADY_REGISTERED");
261 LOGW(
"TSD_TSD_MAX_PID_REGS_REACHED");
264 LOGW(
"TSD_PID_NOT_FOUND");
267 LOGW(
"TSD_INVALID_POINTER_FIELD");
292 LOGD(
"====================");
293 LOGD(
"PID %x PES Packet, Size: %zu, stream_id=%u, pts=%lu, dts=%lu", pid,
294 pes->data_bytes_length,
pes->stream_id, (
unsigned long)
pes->pts,
295 (
unsigned long)
pes->dts);
302 if (
logger.isLogging(AudioLogger::Debug)) {
303 logger.print(
" PES data");
307 char n =
pes->data_bytes[
j];
319 if (
eff !=
pes->data_bytes_length) {
324 if (
p_dec !=
nullptr) {
329 if (
eff !=
pes->data_bytes_length) {
348 LOGD(
"====================");
349 LOGD(
"Descriptors - Adaptation Fields");
353 LOGD(
" %d) tag: (0x%04X) %s", i,
des->tag,
355 LOGD(
" length: %d",
des->length);
362 LOGD(
"====================");
364 size_t len =
pat->length;
366 LOGD(
"PAT, Length %d", (
int)
pat->length);
369 LOGD(
"number of progs: %d", (
int)len);
371 for (i = 0; i < len; ++i) {
372 LOGD(
" %d) prog num: 0x%X, pid: 0x%X", (
int)i,
pat->program_number[i],
378 LOGD(
"====================");
381 LOGD(
"PCR PID: 0x%04X",
pmt->pcr_pid);
382 LOGD(
"program info length: %d", (
int)
pmt->program_info_length);
383 LOGD(
"descriptors length: %d", (
int)
pmt->descriptors_length);
386 for (i = 0; i <
pmt->descriptors_length; ++i) {
388 LOGD(
" %d) tag: (0x%04X) %s", (
int)i,
des->tag,
390 LOGD(
" length: %d",
des->length);
394 LOGD(
"program elements length: %d", (
int)
pmt->program_elements_length);
395 for (i = 0; i <
pmt->program_elements_length; ++i) {
397 LOGD(
" -----Program #%d", (
int)i);
398 LOGD(
" stream type: (0x%04X) %s",
prog->stream_type,
400 LOGD(
" elementary pid: 0x%04X",
prog->elementary_pid);
401 LOGD(
" es info length: %d",
prog->es_info_length);
402 LOGD(
" descriptors length: %d", (
int)
prog->descriptors_length);
417 for (
j = 0;
j <
prog->descriptors_length; ++
j) {
419 LOGD(
" %d) tag: (0x%04X) %s", (
int)
j,
des->tag,
421 LOGD(
" length: %d",
des->length);
426 if (
des->tag == 0x97) {
437 if (
prog->stream_type == type) {
467#pragma GCC diagnostic push
468#pragma GCC diagnostic ignored "-Wswitch"
471 return "ITU-T | ISO/IEC Reserved";
473 return "ISO/IEC 11172 Video";
475 return "ITU-T Rec. H.262 | ISO/IEC 13818-2 Video";
477 return "ISO/IEC 11172 Audio";
479 return "ISO/IEC 13818-3 Audio";
481 return "ITU-T Rec. H.222.0 | ISO/IEC 13818-1 private sections";
483 return "ITU-T Rec. H.222.0 | ISO/IEC 13818-1 PES packets containing "
486 return "ISO/IEC 13522 MHEG";
488 return "ITU-T Rec. H.222.0 | ISO/IEC 13818-1 DSM-CC";
490 return "ITU-T Rec. H.222.0 | ISO/IEC 13818-1/11172-1 auxiliary";
492 return "ISO/IEC 13818-6 Multi-protocol Encapsulation";
494 return "ISO/IEC 13818-6 DSM-CC U-N Messages";
496 return "ISO/IEC 13818-6 Stream Descriptors";
498 return "ISO/IEC 13818-6 Sections (any type, including private data)";
500 return "ISO/IEC 13818-1 auxiliary";
502 return "ISO/IEC 13818-7 Audio (AAC) with ADTS transport";
504 return "ISO/IEC 14496-2 Visual";
506 return "ISO/IEC 14496-3 Audio with the LATM transport syntax as "
507 "defined in ISO/IEC 14496-3";
509 return "ISO/IEC 14496-1 SL-packetized stream or FlexMux stream carried "
512 return "ISO/IEC 14496-1 SL-packetized stream or FlexMux stream carried "
513 "in ISO/IEC 14496_sections";
515 return "ISO/IEC 13818-6 DSM-CC Synchronized Download Protocol";
517 return "Metadata carried in PES packets";
519 return "Metadata carried in metadata_sections";
521 return "Metadata carried in ISO/IEC 13818-6 Data Carousel";
523 return "Metadata carried in ISO/IEC 13818-6 Object Carousel";
525 return "Metadata carried in ISO/IEC 13818-6 Synchronized Download "
528 return "IPMP stream (defined in ISO/IEC 13818-11, MPEG-2 IPMP)";
530 return "AVC video stream as defined in ITU-T Rec. H.264 | ISO/IEC "
533 return "ITU-T Rec. H.222.0 | ISO/IEC 13818-1 Reserved";
535 return "ITU-T Rec. H.265 and ISO/IEC 23008-2 (Ultra HD video) in a "
538 return "Chinese Video Standard in a packetized stream";
540 return "DigiCipher® II video | Identical to ITU-T Rec. H.262 | ISO/IEC "
543 return "ATSC A/53 audio [2] | AC-3 audio";
545 return "SCTE Standard Subtitle";
547 return "SCTE Isochronous Data | Reserved";
549 return "ATSC/SCTE reserved";
551 return "ATSC Program Identifier , SCTE Reserved";
553 return "SCTE 35 splice_information_table | [Cueing]";
557 return "DTS HD Audio";
559 return "ATSC Reserved";
561 return "ATSC Reserved";
563 return "DVB stream_type value for Time Slicing / MPE-FEC";
565 return "IETF Unidirectional Link Encapsulation (ULE)";
567 return "VEI stream_type";
569 return "ATSC Reserved";
571 return "ATSC Data Service Table, Network Resources Table";
573 return "ATSC Reserved";
575 return "SCTE [IP Data] | ATSC Reserved";
577 return "ATSC Reserved";
579 return "DCII (DigiCipher®) Text";
581 return "ATSC Reserved";
583 return "ATSC synchronous data stream | [Isochronous Data]";
585 return "SCTE Asynchronous Data";
587 return "ATSC User Private Program Elements";
589 return "VC-1 Elementary Stream per RP227";
591 return "ATSC User Private Program Elements";
595#pragma GCC diagnostic pop
599 if (tag >= 0x24 && tag <= 0x27) {
601 }
else if (tag >= 0x29 && tag <= 0x35) {
603 }
else if (tag >= 0x3A && tag <= 0x3F) {
605 }
else if (tag >= 0x40 && tag <= 0x51) {
607 }
else if (tag >= 0x98 && tag <= 0x9F) {
611#pragma GCC diagnostic push
612#pragma GCC diagnostic ignored "-Wswitch"
617 return "ISO/IEC 13818 Reserved";
619 return "video_stream_descriptor";
621 return "audio_stream_descriptor";
623 return "hierarchy_descriptor";
625 return "registration_descriptor";
627 return "data_stream_alignment_descriptor";
629 return "target_background_grid_descriptor";
631 return "video_window_descriptor";
633 return "CA_descriptor";
635 return "ISO_639_language_descriptor";
637 return "system_clock_descriptor";
639 return "multiplex_buffer_utilization_descriptor";
641 return "copyright_descriptor";
643 return "Maximum_bitrate_descriptor";
645 return "Private_data_indicator_descriptor";
647 return "smoothing_buffer_descriptor";
649 return "STD_descriptor";
651 return "IBP descriptor";
653 return "DSM-CC carousel_identifier_descriptor";
655 return "DSM-CC association_tag_descriptor";
657 return "DSM-CC deferred_association_tags_descriptor";
659 return "ISO/IEC 13818-6 reserved";
661 return "NPT Reference descriptor";
663 return "NPT Endpoint descriptor";
665 return "Stream Mode descriptor";
667 return "Stream Event descriptor";
669 return "MPEG-4_video_descriptor";
671 return "MPEG-4_audio_descriptor";
673 return "IOD_descriptor";
675 return "SL_descriptor";
677 return "FMC_descriptor";
679 return "External_ES_ID_descriptor";
681 return "MuxCode_descriptor";
683 return "FmxBufferSize_descriptor";
685 return "MultiplexBuffer_descriptor";
687 return "Reserved for ISO/IEC 13818-1 use";
689 return "AVC_video_descriptor()";
691 return "Reserved for ISO/IEC 13818-1 use";
693 return "content_labeling_descriptor";
695 return "Metadata_location_descriptor";
697 return "ISO/IEC 13818 Reserved";
699 return "User Private";
701 return "SCTE 35 Stream Identifier Descriptor";
703 return "ACAP-X Application Descriptor";
705 return "ACAP-X Application Location Descriptor";
707 return "ACAP-X Application Boundary Descriptor";
709 return "Stuffing_descriptor";
711 return "AC3_audio_descriptor";
713 return "SCTE Frame_rate_descriptor";
715 return "SCTE Extended_video_descriptor";
717 return "SCTE Component_name_descriptor";
719 return "ATSC program_identifier";
721 return "Caption_service_descriptor";
723 return "Content_advisory_descriptor";
725 return "ATSC CA_descriptor";
727 return "ATSC Descriptor_tag";
729 return "SCTE 35 cue identifier descriptor";
731 return "ATSC/SCTE Reserved";
733 return "TimeStampDescriptor";
735 return "parameterized_service_descriptor() ";
737 return "Interactive Services Filtering Criteria descriptor";
739 return "Interactive Services NRT Services Summary descriptor";
741 return "SCTE Frequency_spec_descriptor";
743 return "SCTE Modulation_params_descriptor";
745 return "SCTE Transport_stream_id_descriptor";
747 return "SCTE Revision detection descriptor";
749 return "SCTE Two part channel number descriptor";
751 return "SCTE Channel properties descriptor";
753 return "SCTE Daylight Savings Time Descriptor";
755 return "SCTE_adaptation_field_data_descriptor()";
757 return "SCTE Reserved";
759 return "extended_channel_name_descriptor";
761 return "ATSC service_location_descriptor";
763 return "time_shifted_service_descriptor";
765 return "component_name_descriptor";
767 return "ATSC data_service_descriptor";
769 return "ATSC PID Count descriptor";
771 return "ATSC Download descriptor";
773 return "ATSC Multiprotocol Encapsulation descriptor";
775 return "ATSC dcc_departing_request_descriptor";
777 return "ATSC dcc_arriving_request_descriptor";
779 return "ATSC rc_descriptor";
781 return "ATSC Genre descriptor";
783 return "SCTE MAC Address List";
785 return "ATSC private information descriptor";
787 return "ATSC compatibility wrapper descriptor";
789 return "ATSC broadcaster policy descriptor";
791 return "ATSC service name descriptor";
793 return "ATSC URI descriptor";
795 return "ATSC enhanced signaling descriptor";
797 return "ATSC M/H string mapping descriptor";
799 return "ATSC Module Link descriptor";
801 return "ATSC CRC32 descriptor";
803 return "ATSC Content Identifier Descriptor";
805 return "ModuleInfoDescriptor";
807 return "ATSC Group Link descriptor";
809 return "ATSC Time Stamp descriptor";
811 return "ScheduleDescriptor";
813 return "Component list descriptor";
815 return "ATSC M/H component descriptor";
817 return "ATSC M/H rights issuer descriptor";
819 return "ATSC M/H current program descriptor";
821 return "ATSC M/H original service identification descriptor";
823 return "protection_descriptor";
825 return "MH_SG_bootstrap_descriptor";
827 return "Service ID descriptor";
829 return "Protocol Version descriptor";
831 return "NRT Service descriptor";
833 return "Capabilities descriptor";
835 return "Icon descriptor";
837 return "Receiver Targeting descriptor";
839 return "Time Slot descriptor";
841 return "Internet Location Descriptor";
843 return "Associated Service descriptor";
845 return "Eye Identification Descriptor tag";
847 return "E-AC-3 descriptor (A/52 Annex G)";
849 return "2D 3D Corresponding Content Descriptor";
851 return "Multimedia EPG Linkage Descriptor";
853 return "etv_application_information_descriptor()";
855 return "etv_media_time_descriptor()";
857 return "etv_stream_event_descriptor()";
859 return "etv_application_descriptor()";
861 return "RBI_signaling_descriptor()";
863 return "etv_application_metadata_descriptor()";
865 return "etv_bif_platform_descriptor()";
867 return "etv_integrated_signaling_descriptor()";
869 return "3d_MPEG2_descriptor()";
871 return "ebp_descriptor()";
873 return "MPEG_AAC_descriptor";
875 return "IC3D_event_info_descriptor";
877 return "MDTV hybrid stereoscopic service descriptor";
879#pragma GCC diagnostic pop
890 desc->data,
desc->data_length, &res)) {
891 LOGD(
"\n format identififer: 0x%08X", res.format_identifier);
898 desc->data,
desc->data_length, &res)) {
901 for (; i < res.language_length; ++i) {
902 LOGD(
" ISO Language Code: 0x%08X, audio type: 0x%02x",
903 res.iso_language_code[i], res.audio_type[i]);
912 desc->data,
desc->data_length, &res)) {
913 LOGD(
" Maximum Bitrate: %d x 50 bytes/second", res.max_bitrate);
917 LOGW(
" Unknown Descriptor: 0x%x ",
desc->tag);
923 void *result =
nullptr;
924#if defined(USE_PSRAM)
926 if (result !=
nullptr)
return result;
929 LOGI(
"malloc(%d) -> %p %s", (
int)size, result,
930 result !=
NULL ?
"OK" :
"ERROR");
935 void *result =
nullptr;
936#if defined(USE_PSRAM)
938 if (result !=
nullptr)
return result;
941 LOGI(
"calloc(%d) -> %p %s", (
int)(
num * size), result,
942 result !=
NULL ?
"OK" :
"ERROR");
947 void *result =
nullptr;
950 if (result !=
nullptr)
return result;
953 LOGI(
"realloc(%d) -> %p %s", (
int)size, result,
954 result !=
NULL ?
"OK" :
"ERROR");
#define LOGW(...)
Definition AudioLoggerIDF.h:29
#define TRACED()
Definition AudioLoggerIDF.h:31
#define LOGI(...)
Definition AudioLoggerIDF.h:28
#define TRACEE()
Definition AudioLoggerIDF.h:34
#define LOGD(...)
Definition AudioLoggerIDF.h:27
#define MTS_WRITE_BUFFER_SIZE
Definition CodecMTS.h:6
#define MTS_PRINT_PIDS_LEN
Definition CodecTSDemux.h:12
#define MTS_UNDERFLOW_LIMIT
Definition CodecTSDemux.h:16