source: svn/newcon3bcm2_21bu/dst/dlib/src/si/DLIB_PSI_Debug.c

Last change on this file was 76, checked in by megakiss, 10 years ago

1W 대기전력을 만족시키기 위하여 POWEROFF시 튜너를 Standby 상태로 함

  • Property svn:executable set to *
File size: 44.8 KB
Line 
1/*
2        DLIB_PSI_Debug.c
3
4        PSI/PSIP table logging functions.
5
6        Digital STREAM Technology, Inc.
7*/
8
9
10#include "DHL_OSAL.h"
11
12#include "DLIB_PSI.h"
13#include "DLIB_PSI_Parser.h"
14#include "DLIB_PSIP.h"
15#include "DLIB_PSIP_Parser.h"
16#include "DLIB_PSI_Utils.h"
17
18
19#if DLIB_PSI_API_DEBUG
20
21#define FORMATWARNING(str) {err = DHL_FAIL;}
22#define FORMATWARNING2(s1,s2) {err = DHL_FAIL;}
23#define FORMATWARNINGD(s1,d1) {err = DHL_FAIL;}
24
25
26
27
28#if COMMENT
29____Strings____(){}
30#endif
31
32
33const char *DLIB_StreamTypeString(UINT8 stream_type)
34{
35        static char buf[24];
36        switch(stream_type) {
37                case 0x00: return "reserved (0)";
38                case 0x01: return "MPEG 1 video";
39                case 0x02: return "MPEG 2 video or MPEG 1 constrained parameter video";
40                case 0x03: return "MPEG 1 audio";
41                case 0x04: return "MPEG 2 audio";
42                case 0x05: return "MPEG 2 private section";
43                case 0x06: return "MPEG 2 PES packets containing private data";
44                case 0x07: return "ISO/IEC 13522 MHEG";
45                case 0x08: return "Annex A-DSM CC";
46                case 0x09: return "ITU-T Rec. H.222.1";
47                case 0x0A: return "ISO/IEC 13818-6 (DSM CC) type A";
48                case 0x0B: return "ISO/IEC 13818-6 (DSM CC) type B";
49                case 0x0C: return "ISO/IEC 13818-6 (DSM CC) type C";
50                case 0x0D: return "ISO/IEC 13818-6 (DSM CC) type D";
51                case 0x0E: return "MPEG 2 auxiliary";
52                case 0x0F: return "AAC audio with ADTS";
53                case 0x11: return "AAC audio with LATM";
54                case 0x1B: return "H.264 video";
55                case 0x80: return "DigiCypher II Video";
56                case 0x81: return "AC-3 Audio";
57                default:
58                        if (stream_type <= 0x7F)
59                                sprintf(buf, "MPEG 2 reserved (0x%02X)", stream_type);
60                        else
61                                sprintf(buf, "User Private (0x%02X)", stream_type);
62                        return buf;
63        }
64}
65
66
67const char *DLIB_ServiceTypeString(service_type_k s)
68{
69        static const char buf[24];
70        switch (s) {
71                case    st_analog_television:
72                        return "analog_television";
73                case    st_ATSC_digital_television:
74                        return "ATSC_digital_television";
75                case    st_ATSC_audio_only:
76                        return "ATSC_audio_only";
77                case    st_ATSC_data_broadcast_service:
78                        return "ATSC_data_broadcast_service";
79                case    st_ATSC_software_download_service:
80                        return "ATSC_software_download_service";
81                case    st_ATSC_small_screen_service:
82                        return "ATSC_small_screen_service";
83                case    st_ATSC_parameterized_service:
84                        return "ATSC_parameterized_service";
85                default:
86                        sprintf((char *)buf, "0x%02x Reserved", s);
87                        return buf;
88        }
89}
90
91
92const char *DLIB_EtmLocationString(ETM_location_k e)
93{
94        switch (e) {
95                case    ETM_none:
96                        return "No ETM";
97                case    ETM_in_this_PTC:
98                        return "ETM in PTC carrying this PSIP";
99                case    ETM_in_channel_TSID_PTC:
100                        return "ETM in PTC specified by channel_TSID";
101                default:
102                        return "Reserved for future ATSC use";
103        }
104}
105
106
107
108#if COMMENT
109____PSI____(){}
110#endif
111
112
113
114void PrintDescriptors(int descriptorLength, const UINT8 *descriptors, char *indent)
115{
116        INT32 i,j;
117        INT32 numDescriptors;
118        const UINT8 *p;
119        INT32 type;
120        INT32 len, len3;
121        DHL_RESULT err = DHL_OK;
122
123        if (descriptorLength == 0 || descriptors == NULL) {
124                DHL_OS_Printf("%sNo descriptors\n",indent);
125                return;
126        }
127        DLIB_PSI_MemDump((UINT8 *)descriptors, descriptorLength, 1, 6);
128
129        len = descriptorLength;
130        p = descriptors;
131        numDescriptors = 0;
132        while (len > 0) {
133                if (len < 2) {
134                        FORMATWARNING2(indent, "Junk at end of descriptor list");
135                        break;
136                }
137                len3 = p[1];
138                len = len - (len3 + 2);
139                if (len < 0) {
140                        FORMATWARNING2(indent, "Descriptor extends beyond descriptor list");
141                        break;
142                }
143                p += len3 + 2;
144                numDescriptors++;
145        }
146        DHL_OS_Printf("%s%d descriptor%s:\n",indent, numDescriptors, numDescriptors==1 ? "":"s");
147        p = descriptors;
148        for (i = 0; i < numDescriptors; ++i) {
149                type = p[0];
150                len = p[1]+2;
151                switch(type) {
152                        case 0x00: DHL_OS_Printf("%s  MPEG-reserved(0)\n",                                                      indent);break;
153                        case 0x01: DHL_OS_Printf("%s  MPEG-reserved(1)\n",                                                      indent);break;
154                        case 0x02: DHL_OS_Printf("%s  MPEG-video_stream_descriptor\n",                          indent);break;
155                        case 0x03: DHL_OS_Printf("%s  MPEG-audio_stream_descriptor\n",                          indent);break;
156                        case 0x04: DHL_OS_Printf("%s  MPEG-hierarchy_descriptor\n",                                     indent);break;
157                        case 0x05: DHL_OS_Printf("%s  MPEG-registration_descriptor\n",                          indent);break;
158                        case 0x06: DHL_OS_Printf("%s  MPEG-data_stream_alignment_descriptor\n",         indent);break;
159                        case 0x07: DHL_OS_Printf("%s  MPEG-target_background_grid_descriptor\n",                indent);break;
160                        case 0x08: DHL_OS_Printf("%s  MPEG-video_window_descriptor\n",                          indent);break;
161                        case 0x09: DHL_OS_Printf("%s  MPEG-CA_descriptor\n",                                                    indent);break;
162                        case 0x0A: DHL_OS_Printf("%s  MPEG-ISO_639_language_descriptor\n",                      indent);break;
163                        case 0x0B: DHL_OS_Printf("%s  MPEG-system_clock_descriptor\n",                          indent);break;
164                        case 0x0C: DHL_OS_Printf("%s  MPEG-multiplex_buffer_utilization_descriptor\n",indent);break;
165                        case 0x0D: DHL_OS_Printf("%s  MPEG-copyright_descriptor\n",                                     indent);break;
166                        case 0x0E: DHL_OS_Printf("%s  MPEG-maximum_bitrate_descriptor\n",                       indent);break;
167                        case 0x0F: DHL_OS_Printf("%s  MPEG-private_data_indicator_descriptor\n",                indent);break;
168                        case 0x10: DHL_OS_Printf("%s  MPEG-smoothing_buffer_descriptor\n",                      indent);break;
169                        case 0x11: DHL_OS_Printf("%s  MPEG-STD_descriptor\n",                                           indent);break;
170                        case 0x12: DHL_OS_Printf("%s  MPEG-IBP descriptor\n",                                           indent);break;
171                       
172
173                        case 0x80: DHL_OS_Printf("%s  ATSC-Stuffing Descriptor\n",                                      indent);break;
174                        case 0x81: DHL_OS_Printf("%s  ATSC-AC-3_Audio_stream_descriptor\n",                     indent);break;
175                        case 0x85: DHL_OS_Printf("%s  ATSC-Program Identifier descriptor\n",                    indent);break;
176                        case 0x86: DHL_OS_Printf("%s  ATSC-Caption Service descriptor\n",                       indent);break;
177                        case 0x87: DHL_OS_Printf("%s  ATSC-Content Advisory descriptor\n",                      indent);break;
178                        case 0xA0: DHL_OS_Printf("%s  ATSC-Extended Channel Name descriptor\n",         indent);break;
179                        case 0xA1: DHL_OS_Printf("%s  ATSC-Service Location descriptor\n",                      indent);break;
180                        case 0xA2: DHL_OS_Printf("%s  ATSC-Time-Shifted Service descriptor\n",          indent);break;
181                        case 0xA3: DHL_OS_Printf("%s  ATSC-Component Name descriptor\n",                                indent);break;
182
183
184                        default:
185                                if (type >= 64) {
186                                        DHL_OS_Printf("%s  ITU-T Rec. H.222.0 | ISO/IEC 13818-1 Reserved (%d)\n",indent, type);
187                                }
188                                else {
189                                        DHL_OS_Printf("%s  user private (%d)\n",indent, type);
190                                }
191                }
192                DHL_OS_Printf("   %s",indent);
193                for (j = 0; j < len; ++j) {
194                        DHL_OS_Printf(" %02X", (int) p[j]);
195                }
196                DHL_OS_Printf("\n");
197                p += len;
198        }
199
200        if (err)
201                err = err;
202}
203
204void PrintVideoStreamDescriptor(VideoStreamDescriptor *d, char *indent) 
205{
206        DHL_OS_Printf("%sVideo Stream Descriptor\n",indent);
207        DHL_OS_Printf("%s  multiple_frame_rate_flag=%d\n",indent,(int)d->multiple_frame_rate_flag);
208        DHL_OS_Printf("%s  frame_rate_code=%d (",indent,d->frame_rate_code);
209        if (d->multiple_frame_rate_flag) {
210                switch(d->frame_rate_code) {
211                        case FRAMERATE_23_976:  DHL_OS_Printf("23.976");                                        break;
212                        case FRAMERATE_24:              DHL_OS_Printf("24, 23.976");                            break;
213                        case FRAMERATE_25:              DHL_OS_Printf("25");                                            break;
214                        case FRAMERATE_29_97:   DHL_OS_Printf("29.97, 23.976");                 break;
215                        case FRAMERATE_30:              DHL_OS_Printf("30, 23.976, 24, 29.97"); break;
216                        case FRAMERATE_50:              DHL_OS_Printf("50, 25");                                        break;
217                        case FRAMERATE_59_94:   DHL_OS_Printf("59.94, 23.976, 29.97");  break;
218                        case FRAMERATE_60:              DHL_OS_Printf("60, 23.976, 24, 29.97, 30, 59.94"); break;
219                        default:                                DHL_OS_Printf("reserved");                              break;
220                }
221        }
222        else {
223                switch(d->frame_rate_code) {
224                        case FRAMERATE_23_976:  DHL_OS_Printf("23.976");                                        break;
225                        case FRAMERATE_24:              DHL_OS_Printf("24");                                            break;
226                        case FRAMERATE_25:              DHL_OS_Printf("25");                                            break;
227                        case FRAMERATE_29_97:   DHL_OS_Printf("29.97");                                 break;
228                        case FRAMERATE_30:              DHL_OS_Printf("30");                                            break;
229                        case FRAMERATE_50:              DHL_OS_Printf("50");                                            break;
230                        case FRAMERATE_59_94:   DHL_OS_Printf("59.94");                                 break;
231                        case FRAMERATE_60:              DHL_OS_Printf("60");                                            break;
232                        default:                                DHL_OS_Printf("reserved");                              break;
233                }
234        }
235        DHL_OS_Printf(")\n");
236        DHL_OS_Printf("%s  MPEG_1_only_flag=%d\n",indent, (int)d->MPEG_1_only_flag);
237        DHL_OS_Printf("%s  constrained_parameter_flag=%d\n",indent, (int)d->constrained_parameter_flag);
238        DHL_OS_Printf("%s  still_picture_flag=%d\n",indent, (int)d->still_picture_flag);
239        if (d->MPEG_1_only_flag == 0) {
240                DHL_OS_Printf("%s  profile_and_level_indication=%d=0x%02X=",indent,
241                     (int)d->profile_and_level_indication,(int)d->profile_and_level_indication);
242                if (d->profile_and_level_indication & 0x80) {
243                        switch(d->profile_and_level_indication) {
244                                case 0x8E: DHL_OS_Printf("Multi-view profile @ Low level"); break;
245                                case 0x8D: DHL_OS_Printf("Multi-view profile @ Main level"); break;
246                                case 0x8B: DHL_OS_Printf("Multi-view profile @ High 1440 level"); break;
247                                case 0x8A: DHL_OS_Printf("Multi-view profile @ High level"); break;
248                                case 0x85: DHL_OS_Printf("4:2:2 profile @ Main level"); break;
249                                case 0x82: DHL_OS_Printf("4:2:2 profile @ High level"); break;
250                                default:
251                                        DHL_OS_Printf("Reserved (escape) profile and level"); break;
252                        }
253                }
254                else {
255                        switch((d->profile_and_level_indication >> 4) & 7) {
256                                case 1: DHL_OS_Printf("High");          break;
257                                case 2: DHL_OS_Printf("Spacially Scalable"); break;
258                                case 3: DHL_OS_Printf("SNR Scalable"); break;
259                                case 4: DHL_OS_Printf("Main");          break;
260                                case 5: DHL_OS_Printf("Simple");        break;
261                                default:DHL_OS_Printf("reserved");      break;
262                        }
263                        DHL_OS_Printf(" profile @ ");
264                        switch(d->profile_and_level_indication & 15) {
265                                case 4: DHL_OS_Printf("High");          break;
266                                case 6: DHL_OS_Printf("High 1440");     break;
267                                case 8: DHL_OS_Printf("Main");          break;
268                                case 10:DHL_OS_Printf("Low");           break;
269                        }
270                        DHL_OS_Printf(" level");
271                }
272                DHL_OS_Printf("\n");
273
274                DHL_OS_Printf("%s  chroma_format = %d =",indent,d->chroma_format);
275                switch((MPEG_CHROMA_FORMAT)(d->chroma_format)) {
276                        case CHROMA_4_2_0:      DHL_OS_Printf("4:2:0"); break;
277                        case CHROMA_4_2_2:      DHL_OS_Printf("4:2:2"); break;
278                        case CHROMA_4_4_4:      DHL_OS_Printf("4:4:4"); break;
279                        default:                        DHL_OS_Printf("reserved");break;
280                }
281                DHL_OS_Printf("\n");
282
283                DHL_OS_Printf("%s  frame_rate_extension_flag=%d\n",indent, (int)d->frame_rate_extension_flag); 
284        } 
285}
286
287
288void PrintPAT(const MPEG_PAT *pat)
289{
290        int i;
291        if (!pat) {
292                DHL_OS_Printf("NULL Program Association Table\n");
293                return;
294        }
295        DHL_OS_Printf("Program Association Table (PAT) PID 0\n");
296        DHL_OS_Printf("  transport_stream_id = %d = 0x%04X\n",
297                 (int) pat->transport_stream_id, (int) pat->transport_stream_id);
298        DHL_OS_Printf("  version_number = %d = 0x%02X\n",
299                 (int) pat->version_number, (int) pat->version_number);
300        DHL_OS_Printf("  current_next_indicator = %d = %s\n",
301                 (int) pat->current_next_indicator, pat->current_next_indicator ? "current" : "next");
302        if (!pat->isWholePAT) {
303                DHL_OS_Printf("Partial PAT section_number = %d; last_section_number=%d\n",
304                     (int) pat->section_number,(int) pat->last_section_number);
305        }
306        if (pat->networkPIDPresent) {
307                DHL_OS_Printf("  network_PID = %d = 0x%04X\n",
308                     (int) pat->network_PID, (int) pat->network_PID);
309        }
310        else {
311                DHL_OS_Printf("  network_PID not specified\n");
312        }
313        DHL_OS_Printf("  %d program%s\n",(int)pat->numPrograms,pat->numPrograms==1?"":"s");
314        for (i = 0; i < pat->numPrograms; ++i) {
315                DHL_OS_Printf("    program #%d: program_map_PID = %d = 0x%04X\n",
316                     (int) pat->programs[i].program_number,
317                     (int) pat->programs[i].program_map_PID, (int) pat->programs[i].program_map_PID);
318        }
319}
320
321void PrintPMT(const MPEG_PMT *pmt)
322{
323        int i;
324        const MPEG_PMT_stream *stream;
325        if (!pmt) {
326                DHL_OS_Printf("NULL Program Mapping Table\n");
327                return;
328        }
329        DHL_OS_Printf("Program Mapping Table (PMT) PID %d = 0x%04X\n", (int)pmt->PID, (int)pmt->PID);
330        DHL_OS_Printf("  program_number = %d = 0x%04X\n",
331                 (int) pmt->program_number, (int) pmt->program_number);
332        DHL_OS_Printf("  version_number = %d = 0x%02X\n",
333                 (int) pmt->version_number, (int) pmt->version_number);
334        DHL_OS_Printf("  current_next_indicator = %d = %s\n",
335                 (int) pmt->current_next_indicator, pmt->current_next_indicator ? "current" : "next");
336        DHL_OS_Printf("  PCR_PID = %d = 0x%04X\n",
337                 (int) pmt->PCR_PID, (int) pmt->PCR_PID);
338        PrintDescriptors(pmt->descriptor_length, pmt->descriptors, "  ");
339        DHL_OS_Printf("  %d stream%s\n",pmt->numStreams,pmt->numStreams == 1 ? "" : "s");
340        for (i = 0, stream = pmt->streams; i < pmt->numStreams; ++i, ++stream) {
341                DHL_OS_Printf("    stream_type = 0x%08X = %s\n",(int)stream->stream_type,DLIB_StreamTypeString(stream->stream_type));
342                DHL_OS_Printf("      elementary_PID = %d = 0x%04X\n",
343                     (int) stream->elementary_PID, (int) stream->elementary_PID);
344                PrintDescriptors(stream->descriptor_length,stream->descriptors,"      ");
345                if (stream->videoStreamDescriptor) {
346                        PrintVideoStreamDescriptor(stream->videoStreamDescriptor,"        ");
347                }
348        /* ARIB only
349                if (stream->videoDecodeControlDescriptor.valid) {
350                        PrintVideoDecodeControlDescriptor(&stream->videoDecodeControlDescriptor,"        ");
351                }
352        */
353        }
354}
355
356
357
358
359
360#if COMMENT
361____PSIP____(){}
362#endif
363
364
365/********************************************************************
366 *
367 * ATSC_debug.c - Debug routines for testing ATSC stuff.
368 *
369 * Copyright 1997-2002 TeraLogic, Inc.
370 * All Rights Reserved
371 *
372 * $Id: //suprahd/releases/suprahd_239/suprahd_zTVApp660_239/drivers/si/ATSC/ATSC_debug.c#1 $
373 * $Revision: #1 $
374 * $DateTime: 2006/06/05 14:53:58 $
375 * $Change: 45890 $
376 * $Author: catherine.lee $
377 *
378 ********************************************************************/
379
380
381/*=========================================================================
382void PrintMultipleString (UINT8 *buffer, UINT16 len)
383
384typedef struct msSegment {
385        compress_type_k         compression_type;
386        text_mode_k                     mode;
387        UINT8                           number_bytes;
388        UINT8*                  compress_string_byte;
389} msSegment_t, *msSegmentPtr_t;
390
391typedef struct msString {
392        UINT32                  ISO639_language_code;
393        UINT8                           number_segments;
394        msSegmentPtr_t          segment;               
395} msString_t, *msStringPtr_t;
396
397typedef struct multipleString {
398        UINT8                           number_strings;
399        msStringPtr_t           msString;               
400} multipleString_t, *multipleStringPtr_t;
401=========================================================================*/
402#define STR_SIZE        256
403void PrintMultipleString (UINT8 *buffer, UINT16 len)
404{
405        multipleStringPtr_t     mStringPtr;
406        INT32                           i,j,k;
407        UINT8                           mode;
408        UINT32                  langcode;
409        char                            string[STR_SIZE];
410        DHL_RESULT                      err;
411
412
413        if (buffer == NULL) {
414                goto PrintMultipleStringExit;
415        }
416
417        /* Parse the MultipleString */
418        err = ParseMultipleString(buffer, len, &mStringPtr);
419        if (err != DHL_OK) {
420                goto PrintMultipleStringExit;
421        }
422
423        DHL_OS_Printf("\t------ Multiple String  ------\n");
424        if (mStringPtr == NULL) {
425                DHL_OS_Printf("[None]\n");
426                goto PrintMultipleStringExit;
427        }
428
429        DHL_OS_Printf("\tnumber_strings:  %d\n", (int) mStringPtr->number_strings);
430        for (i=0; i<mStringPtr->number_strings; i++) {
431                DHL_OS_Printf("\tmsString[%d]:\n", i);
432                langcode = mStringPtr->msString[i].ISO639_language_code;
433                DHL_OS_Printf("\t\tISO639_language_code:    0x%08X (%c%c%c)\n",langcode,
434                        (int)(langcode >> 16), (int)(langcode >> 8), (int)(langcode));
435                DHL_OS_Printf("\t\tnumber_segments:         %d\n", (int) mStringPtr->msString[i].number_segments);
436                for (j=0; j<mStringPtr->msString[i].number_segments; j++) {
437                        DHL_OS_Printf("\t\tsegment[%d]:\n", j);
438                        DHL_OS_Printf("\t\t\tcompression_type:    ");
439                        switch (mStringPtr->msString[i].segment[j].compression_type) {
440                                case cm_None:
441                                        DHL_OS_Printf("No Compression\n");
442                                        break;
443                                case cm_Huffman_C4C5:
444                                        DHL_OS_Printf("Huffman Table C4/C5\n");
445                                        break;
446                                case cm_Huffman_C6C7:
447                                        DHL_OS_Printf("Huffman Table C6/C7\n");
448                                        break;
449                        }
450                        mode = mStringPtr->msString[i].segment[j].mode;
451                        if (mode < 0x3F) { 
452                                DHL_OS_Printf("\t\t\tmode:                ISO10646-1 Page 0x%02X\n", (int) mode);
453                        }
454                        else if (mode == 0x3F) {
455                                DHL_OS_Printf("\t\t\tmode:                16-bit ISO10646-1\n");
456                        }
457                        else if (mode >= 0xE0 && mode <= 0xFE) {
458                                DHL_OS_Printf("\t\t\tmode:                User private\n");
459                        }
460                        DHL_OS_Printf("\t\t\tnumber_bytes:        %d\n",(int) mStringPtr->msString[i].segment[j].number_bytes);
461                        DHL_OS_Printf("\t\t\tcompress_string_byte:");
462                        for (k=0; k<mStringPtr->msString[i].segment[j].number_bytes; k++) {
463                                DHL_OS_Printf("0x%02X ", (int) mStringPtr->msString[i].segment[j].compress_string_byte[k]);
464                        }
465                        DHL_OS_Printf("\n");
466
467                        switch (mStringPtr->msString[i].segment[j].compression_type) {
468                                case cm_None:
469                                        DHL_OS_Printf("\t\t\tdecoded string:      ");
470                                        for (k=0; k<mStringPtr->msString[i].segment[j].number_bytes; k++) {
471                                                DHL_OS_Printf("%c",(int)mStringPtr->msString[i].segment[j].compress_string_byte[k]);
472                                        }
473                                        DHL_OS_Printf("\n");
474                                        break;
475
476                                case cm_Huffman_C4C5:
477                                case cm_Huffman_C6C7:
478                                        DecodeHuffmanString(mStringPtr->msString[i].segment[j].compress_string_byte,
479                                                                        mStringPtr->msString[i].segment[j].number_bytes,
480                                                                        mStringPtr->msString[i].segment[j].compression_type,
481                                                                        string,
482                                                                        STR_SIZE);
483
484                                        DHL_OS_Printf("\t\t\tdecoded string:      %s\n",string);
485                                        break;
486                        }
487                }
488        }
489
490        FreeMultipleString(mStringPtr);
491
492PrintMultipleStringExit:
493        return;
494}
495
496
497
498
499/*=========================================================================
500void PrintAc3AudioStreamDescriptor (ac3AudioStreamDescriptorPtr_t descrip)
501
502typedef struct ac3AudioStreamDescriptor {
503        sample_rate_code_k      sample_rate_code;
504        UINT8                           bsid;
505        bit_rate_code_k         bit_rate_code;
506        surround_mode_k         surround_mode;
507        bit_stream_mode_k               bsmod;
508        num_channels_k          num_channels;
509        BOOLEAN                 full_svc;
510        BOOLEAN                 additional_elements1;
511        language_code_k         langcod;
512        language_code_k         langcod2;       
513        BOOLEAN                 additional_elements2;
514        union {
515                UINT8                   mainid;         
516                UINT8                   asvcflags;
517        } bsmod_ext;
518        UINT8                           textlen;               
519        text_code_k                     text_code;
520        UINT8*                  text;
521} ac3AudioStreamDescriptor_t, *ac3AudioStreamDescriptorPtr_t;
522=========================================================================*/
523void PrintAc3AudioStreamDescriptor (ac3AudioStreamDescriptorPtr_t descrip)
524{
525        INT32                   i;
526
527
528        DHL_OS_Printf("ac3_audio_stream_descriptor\n");
529        DHL_OS_Printf("sample_rate_code:           0x%01X\n", descrip->sample_rate_code);
530        DHL_OS_Printf("bsid:                       0x%02X\n", (int) descrip->bsid);
531        DHL_OS_Printf("bit_rate_code:              0x%02X\n", descrip->bit_rate_code);
532        DHL_OS_Printf("surround_mode:              0x%01X\n", descrip->surround_mode);
533        DHL_OS_Printf("bsmod:                      0x%01X\n", descrip->bsmod);
534        DHL_OS_Printf("num_channels:               0x%01X\n", descrip->num_channels);
535        DHL_OS_Printf("full_svc:                   0x%01X\n", (int) descrip->full_svc);
536        if (descrip->additional_elements1 == TRUE) {
537                DHL_OS_Printf("langcod:                    0x%04X\n", descrip->langcod);
538                if (descrip->num_channels == 0) {
539                        DHL_OS_Printf("langcod2:                   0x%04X\n", descrip->langcod2);
540                }
541
542                if (descrip->additional_elements2 == TRUE) {
543                        if (descrip->bsmod < 2) {
544                                DHL_OS_Printf("mainid:                     0x%01X\n", (int) descrip->bsmod_ext.mainid);
545                        }
546                        else {
547                                DHL_OS_Printf("asvcflags:                  0x%02X\n", (int) descrip->bsmod_ext.asvcflags);
548                        }
549
550                        if (descrip->textlen) {
551                                DHL_OS_Printf("textlen:                    %d\n", (int) descrip->textlen);
552                                DHL_OS_Printf("text_code:                  0x%01X\n", descrip->text_code);
553                                DHL_OS_Printf("text: ");
554                                for (i=0; i<descrip->textlen; i++) {
555                                        DHL_OS_Printf("%c", (int) descrip->text[i]);
556                                }
557                                DHL_OS_Printf("\n");
558                        }                               
559                }
560        }
561}
562
563
564/*=========================================================================
565void PrintCaptionServiceDescriptor (captionServiceDescriptorPtr_t descrip)
566
567typedef struct captionService {
568        UINT32                  language;
569        cc_type_k                       cc_type;
570        union {
571                line21_field_k  line21_field;
572                UINT8                   caption_service_number;
573        } cc_id;
574        BOOLEAN                 easy_reader;
575        BOOLEAN                 wide_aspect_ratio;
576} captionService_t, *captionServicePtr_t;
577
578typedef struct captionServiceDescriptor {
579        UINT8                           number_of_services;
580        captionServicePtr_t     service;
581} captionServiceDescriptor_t, *captionServiceDescriptorPtr_t;
582=========================================================================*/
583void PrintCaptionServiceDescriptor (captionServiceDescriptorPtr_t descrip)
584{
585        INT32                   i;
586
587
588        DHL_OS_Printf("caption_service_descriptor\n");
589        DHL_OS_Printf("number_of_services:         %d\n", (int) descrip->number_of_services);
590        for (i=0; i<descrip->number_of_services; i++) {
591                DHL_OS_Printf("service[%d]:\n", i);
592                DHL_OS_Printf("\tlanguage:               0x%08X\n", descrip->service[i].language);
593                DHL_OS_Printf("\tcc_type:                0x%01X\n", descrip->service[i].cc_type);
594                if (descrip->service[i].cc_type == cct_line21) {
595                        DHL_OS_Printf("\tline21_field:           0x%01X\n", descrip->service[i].cc_id.line21_field);
596                }
597                else {
598                        DHL_OS_Printf("\tcaption_service_number: 0x%02X\n", (int) descrip->service[i].cc_id.caption_service_number);
599                }
600                DHL_OS_Printf("\teasy_reader:            0x%01X\n", (int) descrip->service[i].easy_reader);
601                DHL_OS_Printf("\twide_aspect_ratio:      0x%01X\n", (int) descrip->service[i].wide_aspect_ratio);
602        }
603}
604
605
606/*=========================================================================
607void PrintContentAdvisoryDescriptor (contentAdvisoryDescriptorPtr_t descrip)
608
609typedef struct ratingDimension {
610        UINT8                           rating_dimension_j;
611        UINT8                           rating_value;
612} ratingDimension_t, *ratingDimensionPtr_t;
613
614typedef struct ratingRegion {
615        UINT8                           rating_region;
616        UINT8                           rated_dimensions;
617        ratingDimensionPtr_t    dimension;             
618        multipleStringPtr_t     rating_description;
619} ratingRegion_t, *ratingRegionPtr_t;
620 
621typedef struct contentAdvisoryDescriptor {
622        UINT8                           rating_region_count;
623        ratingRegionPtr_t               rating_region; 
624} contentAdvisoryDescriptor_t, *contentAdvisoryDescriptorPtr_t;
625=========================================================================*/
626void PrintContentAdvisoryDescriptor (contentAdvisoryDescriptorPtr_t descrip)
627{
628        INT32                   i,j;
629
630
631        DHL_OS_Printf("content_advisory_descriptor\n");
632        DHL_OS_Printf("rating_region_count:        %d\n", (int) descrip->rating_region_count);
633        for (i=0; i<descrip->rating_region_count; i++) {
634                DHL_OS_Printf("rating_region[%d]:\n", i);
635                DHL_OS_Printf("\trating_region:        0x%02X\n", (int) descrip->rating_region[i].rating_region);
636                DHL_OS_Printf("\trated_dimensions:     %d\n", (int) descrip->rating_region[i].rated_dimensions);
637                for (j=0; j<descrip->rating_region[i].rated_dimensions; j++) {
638                        DHL_OS_Printf("\tdimension[%d]:\n", j);                 
639                        DHL_OS_Printf("\t\trating_dimension_j:   0x%02X\n", (int) descrip->rating_region[i].dimension[j].rating_dimension_j);
640                        DHL_OS_Printf("\t\trating_value:         0x%02X\n", (int) descrip->rating_region[i].dimension[j].rating_value);
641                }
642                PrintMultipleString(descrip->rating_region[i].rating_description, descrip->rating_region[i].rating_description_length);
643        }
644}
645
646
647/*=========================================================================
648void PrintExtendedChannelNameDescriptor (extendedChannelNameDescriptorPtr_t descrip)
649
650typedef struct extendedChannelNameDescriptor {
651        multipleStringPtr_t     long_channel_name;
652} extendedChannelNameDescriptor_t, *extendedChannelNameDescriptorPtr_t;
653=========================================================================*/
654void PrintExtendedChannelNameDescriptor (extendedChannelNameDescriptorPtr_t descrip)
655{
656        DHL_OS_Printf("extended_channel_name_descriptor\n");
657        PrintMultipleString(descrip->long_channel_name, descrip->long_channel_name_length);
658}
659
660
661/*=========================================================================
662void PrintServiceLocationDescriptor (serviceLocationDescriptorPtr_t descrip)
663
664typedef struct slElement {
665        UINT8                           stream_type;
666        UINT16                  elementary_PID;
667        UINT32                  ISO639_language_code;
668} slElement_t, *slElementPtr_t;
669
670typedef struct serviceLocationDescriptor {
671        UINT16                  PCR_PID;
672        UINT8                           number_elements;
673        slElementPtr_t          element;
674} serviceLocationDescriptor_t, *serviceLocationDescriptorPtr_t;
675=========================================================================*/
676void PrintServiceLocationDescriptor (serviceLocationDescriptorPtr_t descrip)
677{
678        INT32                   i;
679        UINT32          langcode;
680
681
682        DHL_OS_Printf("service_location_descriptor\n");
683        DHL_OS_Printf("PCR_PID:                    0x%04X\n", (int) descrip->PCR_PID);
684        DHL_OS_Printf("number_elements:            %d\n", (int) descrip->number_elements);
685        for (i=0; i<descrip->number_elements; i++) {
686                DHL_OS_Printf("element[%d]:\n", i);
687                DHL_OS_Printf("\tstream_type:              0x%02X ", (int) descrip->element[i].stream_type);
688                switch (descrip->element[i].stream_type) {
689                        case 0x02:
690                                DHL_OS_Printf("(MPEG-2 Video)\n");
691                                break;
692                        case 0x81:
693                                DHL_OS_Printf("(Dolby AC-3 Audio)\n");
694                                break;
695                        default:
696                                DHL_OS_Printf("\n");
697                }
698                DHL_OS_Printf("\telementary_PID:           0x%04X\n", (int) descrip->element[i].elementary_PID);
699                langcode = descrip->element[i].ISO639_language_code;
700                DHL_OS_Printf("\tISO639_language_code:     0x%08X (%c%c%c)\n",langcode,
701                        (int)(langcode >> 16), (int)(langcode >> 8), (int)(langcode));
702        }
703}
704
705/*========================================================================
706void PrintSttSection (sttSectionPtr_t sttSectPtr)
707
708typedef struct daylightSavings {
709        UINT8                           DS_status;
710        UINT8                           DS_day_of_month;
711        UINT8                           DS_hour;
712} daylightSavings_t, *daylightSavingsPtr_t;
713
714typedef struct sttSection {
715        INT32                           memId;
716        UINT32                  system_time;
717        UINT8                           GPS_UTC_offset;
718        daylightSavings_t               daylight_savings;
719        UINT16                  descriptor_length;
720        UINT8*                  descriptors;
721} sttSection_t, *sttSectionPtr_t, **sttSectionHdl_t;
722=========================================================================*/
723void PrintSttSection (sttSectionPtr_t sttSectPtr)
724{
725        DHL_OS_Printf("\n------ STT Section ------\n");
726        DHL_OS_Printf("system_time:       0x%08X (%d)\n", sttSectPtr->system_time,sttSectPtr->system_time);
727        DHL_OS_Printf("GPS_UTC_offset:    %d\n", (int)sttSectPtr->GPS_UTC_offset);
728        if (sttSectPtr->daylight_savings.DS_status) {
729                DHL_OS_Printf("DS_status:         In daylight savings time.\n");
730        }
731        else {
732                DHL_OS_Printf("DS_status:         Not in daylight savings time.\n");
733        }
734        DHL_OS_Printf("DS_day_of_month:   %d\n", (int) sttSectPtr->daylight_savings.DS_day_of_month);
735        DHL_OS_Printf("DS_hour:           %d\n", (int) sttSectPtr->daylight_savings.DS_hour);
736        DHL_OS_Printf("descriptor_length: %d\n", (int) sttSectPtr->descriptor_length);
737        DHL_OS_Printf("\n");
738}
739
740
741/*=========================================================================
742void PrintMgtSection (mgtSectionPtr_t mgtSectPtr)
743
744typedef struct mgtTable {
745        table_type_k            table_type;
746        UINT16                  table_type_PID;
747        UINT8                           table_type_version_number;
748        UINT32                  number_bytes;
749        UINT16                  descriptor_length;
750        UINT8*                  descriptors;
751} mgtTable_t, *mgtTablePtr_t;
752
753typedef struct mgtSection {
754        INT32                           memId;         
755        UINT8                           version_number;
756        UINT16                  tables_defined;
757        mgtTablePtr_t           table;         
758        UINT16                  descriptor_length;
759        UINT8*                  descriptors;   
760} mgtSection_t, *mgtSectionPtr_t;
761=========================================================================*/
762void PrintMgtSection (mgtSectionPtr_t mgtSectPtr)
763{
764        INT32                   i;
765        UINT16          table_type;
766
767
768        DHL_OS_Printf("\n------ MGT Section ------\n");
769        DHL_OS_Printf("version_number:    %d\n", (int) mgtSectPtr->version_number);
770        DHL_OS_Printf("tables_defined:    %d\n", (int) mgtSectPtr->tables_defined);
771        for (i=0; i<mgtSectPtr->tables_defined; i++) {
772                DHL_OS_Printf("table[%d]:\n", i);
773                DHL_OS_Printf("\ttable_type:                0x%04X ", mgtSectPtr->table[i].table_type);
774                table_type = mgtSectPtr->table[i].table_type;
775
776                if (table_type == tt_terrestrial_VCT_cni_1) {
777                        DHL_OS_Printf("(Terrestrial VCT with current_next_indicator=1)\n");
778                }
779                else if (table_type == tt_terrestrial_VCT_cni_0) {
780                        DHL_OS_Printf("(Terrestrial VCT with current_next_indicator=0)\n");
781                }
782                else if (table_type == tt_cable_VCT_cni_0) {
783                        DHL_OS_Printf("(Cable VCT with current_next_indicator=0)\n");
784                }
785                else if (table_type == tt_cable_VCT_cni_1) {
786                        DHL_OS_Printf("(Cable VCT with current_next_indicator=1)\n");
787                }
788                else if (table_type == tt_channel_ETT) {
789                        DHL_OS_Printf("(channel ETT)\n");
790                }
791                else if (table_type >= tt_EIT_min && table_type <= tt_EIT_max) {
792                        DHL_OS_Printf("(EIT-%d)\n",table_type-tt_EIT_min);
793                }
794                else if (table_type >= tt_event_ETT_min && table_type <= tt_event_ETT_max) {
795                        DHL_OS_Printf("(ETT-%d)\n",table_type-tt_event_ETT_min);
796                }
797                else if (table_type >= tt_RRT_region_1 && table_type <= tt_RRT_region_255) {
798                        DHL_OS_Printf("(RRT with rating_region %d)\n",table_type-0x0300);
799                }
800                else if (table_type >= 0x0400 && table_type <= 0x0FFF) {
801                        DHL_OS_Printf("(User Private)\n");
802                }
803                else {
804                        DHL_OS_Printf("(Reserved for future ATSC use)\n");
805                }
806                DHL_OS_Printf("\ttable_type_PID:            0x%04X (%d)\n", (int) mgtSectPtr->table[i].table_type_PID, (int) mgtSectPtr->table[i].table_type_PID);
807                DHL_OS_Printf("\ttable_type_version_number: %d\n", (int) mgtSectPtr->table[i].table_type_version_number);
808                DHL_OS_Printf("\tnumber_bytes:              %d\n", mgtSectPtr->table[i].number_bytes);
809                DHL_OS_Printf("\tdescriptor_length:         %d\n", (int) mgtSectPtr->table[i].descriptor_length);
810        }
811        DHL_OS_Printf("descriptor_length:  %d\n", (int) mgtSectPtr->descriptor_length);
812}
813
814
815
816
817/*=========================================================================
818void PrintRrtSection (rrtSectionPtr_t rrtSectPtr)
819
820typedef struct rrtValue {
821        multipleStringPtr_t     abbrev_rating_value;
822        multipleStringPtr_t     rating_value;
823} rrtValue_t, *rrtValuePtr_t;
824       
825typedef struct rrtDimension {
826        multipleStringPtr_t     dimension_name;
827        BOOLEAN                 graduated_scale;
828        UINT8                           values_defined;
829        rrtValuePtr_t           value;         
830} rrtDimension_t, *rrtDimensionPtr_t;
831
832typedef struct rrtSection {
833        INT32                           memId;                 
834        rating_region_k         rating_region;
835        UINT8                           version_number;
836        multipleStringPtr_t     rating_region_name;
837        UINT8                           dimensions_defined;
838        rrtDimensionPtr_t               dimension;             
839        UINT16                  descriptor_length;
840        UINT8*                  descriptors;   
841} rrtSection_t, *rrtSectionPtr_t;
842=========================================================================*/
843void PrintRrtSection (rrtSectionPtr_t rrtSectPtr)
844{
845        INT32                   i,j;
846
847
848        DHL_OS_Printf("\n------ RRT Section ------\n");
849        DHL_OS_Printf("rating_region:          0x%02X (%d)\n",rrtSectPtr->rating_region,rrtSectPtr->rating_region);
850        DHL_OS_Printf("version_number:         %d\n", (int)rrtSectPtr->version_number);
851        PrintMultipleString(rrtSectPtr->rating_region_name, rrtSectPtr->rating_region_name_length);
852        DHL_OS_Printf("dimensions_defined:     %d\n", (int)rrtSectPtr->dimensions_defined);
853        for (i=0; i<rrtSectPtr->dimensions_defined; i++) {
854                DHL_OS_Printf("dimension[%d]:\n", i);
855                PrintMultipleString(rrtSectPtr->dimension[i].dimension_name, rrtSectPtr->dimension[i].dimension_name_length);
856                DHL_OS_Printf("\tgraduated_scale:       0x%01X\n", (int)rrtSectPtr->dimension[i].graduated_scale);
857                DHL_OS_Printf("\tvalues_defined:        0x%01X\n", (int)rrtSectPtr->dimension[i].values_defined);
858                for (j=0; j<rrtSectPtr->dimension[i].values_defined; j++) {
859                        DHL_OS_Printf("\tvalue[%d]:\n", j);
860                        PrintMultipleString(rrtSectPtr->dimension[i].value[j].abbrev_rating_value, rrtSectPtr->dimension[i].value[j].abbrev_rating_value_length);
861                        PrintMultipleString(rrtSectPtr->dimension[i].value[j].rating_value, rrtSectPtr->dimension[i].value[j].rating_value_length);
862                }
863        }               
864
865        DHL_OS_Printf("descriptor_length:      %d\n", (int)rrtSectPtr->descriptor_length);
866}
867
868
869
870/*=========================================================================
871void PrintEitSection (eitSectionPtr_t eitSectPtr)
872
873typedef struct eitEvent {
874        UINT16                  event_id;
875        UINT32                  start_time;
876        ETM_location_k          ETM_location;
877        UINT32                  length_in_seconds;
878        multipleStringPtr_t     title;
879        UINT16                  descriptor_length;
880        UINT8*                  descriptors;   
881} eitEvent_t, *eitEventPtr_t;
882
883typedef struct eitSection {
884        INT32                           memId;         
885        UINT16                  source_id;
886        UINT8                           version_number;
887        UINT8                           section_number;
888        UINT8                           last_section_number;
889        UINT8                           num_events_in_section;
890        eitEventPtr_t           event;         
891} eitSection_t, *eitSectionPtr_t;
892=========================================================================*/
893void PrintEitSection (eitSectionPtr_t eitSectPtr)
894{
895        INT32                           i;
896
897        DHL_OS_Printf("\n------ EIT Section ------\n");
898        DHL_OS_Printf("source_id:              0x%04X (%d)\n",(int)eitSectPtr->source_id,(int)eitSectPtr->source_id);
899        DHL_OS_Printf("version_number:         %d\n", (int)eitSectPtr->version_number);
900        DHL_OS_Printf("section_number:         %d\n", (int)eitSectPtr->section_number);
901        DHL_OS_Printf("last_section_number:    %d\n", (int)eitSectPtr->last_section_number);
902        DHL_OS_Printf("num_events_in_section:  %d\n", (int)eitSectPtr->num_events_in_section);
903        for (i=0; i<eitSectPtr->num_events_in_section; i++) {
904                DHL_OS_Printf("event[%d]:\n", i);
905                DHL_OS_Printf("\tevent_id:              0x%04X\n",(int) eitSectPtr->event[i].event_id);
906                DHL_OS_Printf("\tstart_time:            0x%08X (%d)\n", eitSectPtr->event[i].start_time,eitSectPtr->event[i].start_time);
907                DHL_OS_Printf("\tETM_location:          0x%02X (%s)\n", eitSectPtr->event[i].ETM_location,DLIB_EtmLocationString(eitSectPtr->event[i].ETM_location));
908                DHL_OS_Printf("\tlength_in_seconds:     0x%08X (%d)\n", eitSectPtr->event[i].length_in_seconds,eitSectPtr->event[i].length_in_seconds);
909                PrintMultipleString(eitSectPtr->event[i].title, eitSectPtr->event[i].title_length);
910                DHL_OS_Printf("descriptor_length:       %d\n", (int)eitSectPtr->event[i].descriptor_length);
911
912        }
913}
914
915
916
917/*=========================================================================
918void PrintEttSection (ettSectionPtr_t ettSectPtr)
919
920typedef struct ett {
921        INT32                           memId;
922        UINT8                           version_number;
923        UINT32                  ETM_id;
924        multipleStringPtr_t     extended_text_message;
925} ettSection_t, *ettSectionPtr_t;
926=========================================================================*/
927void PrintEttSection (ettSectionPtr_t ettSectPtr)
928{
929        DHL_OS_Printf("\n------ ETT Section ------\n");
930        DHL_OS_Printf("version_number:         %d\n", (int)ettSectPtr->version_number);
931        DHL_OS_Printf("ETM_id:                 0x%08X (%d)\n", ettSectPtr->ETM_id,ettSectPtr->ETM_id);
932        PrintMultipleString(ettSectPtr->extended_text_message, ettSectPtr->extended_text_message_length);
933}
934
935
936
937/*=========================================================================
938void PrintTvct (tvctPtr_t tvctPtr)
939
940typedef struct tvctChannel {
941        UINT16                  short_name[7];
942        UINT16                  major_channel_number;
943        UINT16                  minor_channel_number;
944        modulation_mode_k               modulation_mode;
945        UINT32                  carrier_frequency;
946        UINT16                  channel_TSID;
947        UINT16                  program_number;
948        ETM_location_k          ETM_location;
949        BOOLEAN                 access_controlled;
950        BOOLEAN                 hidden;
951        BOOLEAN                 show_guide;
952        service_type_k          service_type;
953        UINT16                  source_id;
954        UINT16                  descriptor_length;
955        UINT8*                  descriptors;   
956} tvctChannel_t, *tvctChannelPtr_t;
957
958typedef struct tvct {
959        INT32                           memId;         
960        UINT16                  transport_stream_id;
961        UINT8                           version_number;
962        UINT8                           numChannels;
963        tvctChannelPtr_t                channel;
964        UINT16                  additional_descriptor_length;
965        UINT8*                  additional_descriptors;
966} tvct_t, *tvctPtr_t;
967=========================================================================*/
968void PrintTvct (tvctPtr_t tvctPtr)
969{
970        INT32                           i,j;
971       
972        DHL_OS_Printf("\n------ TVCT  ------\n");
973        DHL_OS_Printf("transport_stream_id:    0x%04X (%d)\n",(int)tvctPtr->transport_stream_id,(int)tvctPtr->transport_stream_id);
974        DHL_OS_Printf("version_number:         %d\n", (int) tvctPtr->version_number);
975        DHL_OS_Printf("numChannels:%d\n", (int) tvctPtr->numChannels);
976        for (i=0; i<tvctPtr->numChannels; i++) {
977                DHL_OS_Printf("channel[%d]:\n", i);
978                DHL_OS_Printf("\tshort_name:                ");
979                for (j=0; (j<7) && (tvctPtr->channel[i].short_name[j] != 0x0000); j++) {
980                        if ((tvctPtr->channel[i].short_name[j] >> 8) == 0x00) {
981                                DHL_OS_Printf("%c",(int)tvctPtr->channel[i].short_name[j]);
982                        }
983                        else {
984                                DHL_OS_Printf("?");
985                        }
986                }
987                DHL_OS_Printf("\n");
988                DHL_OS_Printf("\tmajor_channel_number:      %d\n", (int)tvctPtr->channel[i].major_channel_number);
989                DHL_OS_Printf("\tminor_channel_number:      %d\n", (int)tvctPtr->channel[i].minor_channel_number);
990                DHL_OS_Printf("\tmodulation_mode:           0x%02X ", tvctPtr->channel[i].modulation_mode);
991                switch (tvctPtr->channel[i].modulation_mode) {
992                        case 0x00:
993                                DHL_OS_Printf("(reserved)\n");
994                                break;
995                        case mm_analog:
996                                DHL_OS_Printf("(analog)\n");
997                                break;
998                        case mm_SCTE_mode_1:
999                                DHL_OS_Printf("(mm_SCTE_mode_1)\n");
1000                                break;
1001                        case mm_SCTE_mode_2:
1002                                DHL_OS_Printf("(mm_SCTE_mode_2)\n");
1003                                break;
1004                        case mm_ATSC_8VSB:
1005                                DHL_OS_Printf("(ATSC_8VSB)\n");
1006                                break;
1007                        case mm_ATSC_16VSB:
1008                                DHL_OS_Printf("(ATSC_16VSB)\n");
1009                                break;
1010                        case mm_private_descriptor:
1011                                DHL_OS_Printf("(Modulation defined in private descriptor)\n");
1012                                break;
1013                        default:
1014                                DHL_OS_Printf("(User Private)\n");
1015                                break;
1016                }
1017                DHL_OS_Printf("\tcarrier_frequency:         %f MHz\n", tvctPtr->channel[i].carrier_frequency/1000000.0);
1018                DHL_OS_Printf("\tchannel_TSID:              0x%04X\n", (int)tvctPtr->channel[i].channel_TSID);
1019                DHL_OS_Printf("\tprogram_number:            0x%04X\n", (int)tvctPtr->channel[i].program_number);
1020                DHL_OS_Printf("\tETM_location:              0x%02X (%s)\n", tvctPtr->channel[i].ETM_location,DLIB_EtmLocationString(tvctPtr->channel[i].ETM_location));
1021                DHL_OS_Printf("\taccess_controlled:         0x%01X (%s)\n", (int)tvctPtr->channel[i].access_controlled, tvctPtr->channel[i].access_controlled ? "Yes" : "No");
1022                DHL_OS_Printf("\thidden:                    0x%01X (%s)\n", (int)tvctPtr->channel[i].hidden,tvctPtr->channel[i].hidden ? "Yes" : "No");
1023                DHL_OS_Printf("\tshow_guide:                0x%01X (%s)\n", (int)tvctPtr->channel[i].show_guide, tvctPtr->channel[i].show_guide ? "Yes" : "No");
1024                DHL_OS_Printf("\tservice_type:              0x%02X (%s)\n", tvctPtr->channel[i].service_type,DLIB_ServiceTypeString(tvctPtr->channel[i].service_type));         
1025                DHL_OS_Printf("\tsource_id:                 0x%04X\n", (int)tvctPtr->channel[i].source_id);
1026                DHL_OS_Printf("\tdescriptor_length:         %d\n", (int)tvctPtr->channel[i].descriptor_length);
1027
1028                if (tvctPtr->channel[i].descriptor_length)
1029                        DLIB_PSI_MemDump(tvctPtr->channel[i].descriptors, tvctPtr->channel[i].descriptor_length, 1, 4);
1030        }
1031        DHL_OS_Printf("additional_descriptor_length:    %d\n", (int)tvctPtr->additional_descriptor_length);
1032}
1033
1034
1035
1036
1037/*=========================================================================
1038void PrintCvct (cvctPtr_t cvctPtr)
1039
1040typedef struct cvctChannel {
1041        UINT16                  short_name[7];
1042        UINT16                  major_channel_number;
1043        UINT16                  minor_channel_number;
1044        modulation_mode_k               modulation_mode;
1045        UINT32                  carrier_frequency;
1046        UINT16                  channel_TSID;
1047        UINT16                  program_number;
1048        ETM_location_k          ETM_location;
1049        BOOLEAN                 access_controlled;
1050        BOOLEAN                 hidden;
1051        path_select_k           path_select;
1052        BOOLEAN                 out_of_band;
1053        BOOLEAN                 show_guide;
1054        service_type_k          service_type;
1055        UINT16                  source_id;
1056        UINT16                  descriptor_length;
1057        UINT8*                  descriptors;
1058} cvctChannel_t, *cvctChannelPtr_t;
1059
1060
1061typedef struct cvct {
1062        INT32                           memId;         
1063        UINT16                  transport_stream_id;
1064        UINT8                           version_number;
1065        UINT8                           numChannels;
1066        cvctChannelPtr_t                channel;
1067        UINT16                  additional_descriptor_length;
1068        UINT8*                  additional_descriptors;
1069} cvct_t, *cvctPtr_t;
1070=========================================================================*/
1071void PrintCvct (cvctPtr_t cvctPtr)
1072{
1073        INT32                           i,j;
1074       
1075        DHL_OS_Printf("\n------ CVCT  ------\n");
1076        DHL_OS_Printf("transport_stream_id:    0x%04X (%d)\n",(int)cvctPtr->transport_stream_id,(int)cvctPtr->transport_stream_id);
1077        DHL_OS_Printf("version_number:         %d\n", (int)cvctPtr->version_number);
1078        DHL_OS_Printf("numChannels:%d\n", (int)cvctPtr->numChannels);
1079        for (i=0; i<cvctPtr->numChannels; i++) {
1080                DHL_OS_Printf("channel[%d]:\n", i);
1081                DHL_OS_Printf("\tshort_name:                ");
1082                for (j=0; (j<7) && (cvctPtr->channel[i].short_name[j] != 0x0000); j++) {
1083                        if ((cvctPtr->channel[i].short_name[j] >> 8) == 0x00) {
1084                                DHL_OS_Printf("%c",(int)cvctPtr->channel[i].short_name[j]);
1085                        }
1086                        else {
1087                                DHL_OS_Printf("?");
1088                        }
1089                }
1090                DHL_OS_Printf("\n");
1091                DHL_OS_Printf("\tmajor_channel_number:      %d\n", (int)cvctPtr->channel[i].major_channel_number);
1092                DHL_OS_Printf("\tminor_channel_number:      %d\n", (int)cvctPtr->channel[i].minor_channel_number);
1093                DHL_OS_Printf("\tmodulation_mode:           0x%02X ", cvctPtr->channel[i].modulation_mode);
1094                switch (cvctPtr->channel[i].modulation_mode) {
1095                        case 0x00:
1096                                DHL_OS_Printf("(reserved)\n");
1097                                break;
1098                        case mm_analog:
1099                                DHL_OS_Printf("(analog)\n");
1100                                break;
1101                        case mm_SCTE_mode_1:
1102                                DHL_OS_Printf("(mm_SCTE_mode_1)\n");
1103                                break;
1104                        case mm_SCTE_mode_2:
1105                                DHL_OS_Printf("(mm_SCTE_mode_2)\n");
1106                                break;
1107                        case mm_ATSC_8VSB:
1108                                DHL_OS_Printf("(ATSC_8VSB)\n");
1109                                break;
1110                        case mm_ATSC_16VSB:
1111                                DHL_OS_Printf("(ATSC_16VSB)\n");
1112                                break;
1113                        case mm_private_descriptor:
1114                                DHL_OS_Printf("(Modulation defined in private descriptor)\n");
1115                                break;
1116                        default:
1117                                DHL_OS_Printf("(User Private)\n");
1118                                break;
1119                }
1120                DHL_OS_Printf("\tcarrier_frequency:         %f MHz\n", cvctPtr->channel[i].carrier_frequency/1000000.0);
1121                DHL_OS_Printf("\tchannel_TSID:              0x%04X\n", (int)cvctPtr->channel[i].channel_TSID);
1122                DHL_OS_Printf("\tprogram_number:            0x%04X\n", (int)cvctPtr->channel[i].program_number);
1123                DHL_OS_Printf("\tETM_location:              0x%02X (%s)\n", cvctPtr->channel[i].ETM_location,DLIB_EtmLocationString(cvctPtr->channel[i].ETM_location));
1124                DHL_OS_Printf("\taccess_controlled:         0x%01X (%s)\n", (int)cvctPtr->channel[i].access_controlled, cvctPtr->channel[i].access_controlled ? "Yes" : "No");
1125                DHL_OS_Printf("\thidden:                    0x%01X (%s)\n", (int)cvctPtr->channel[i].hidden,cvctPtr->channel[i].hidden ? "Yes" : "No");
1126                DHL_OS_Printf("\tpath_select:               0x%01X (path %d)\n", cvctPtr->channel[i].path_select,cvctPtr->channel[i].path_select+1);
1127                DHL_OS_Printf("\tout_of_band:               0x%01X (%s)\n", (int)cvctPtr->channel[i].out_of_band, cvctPtr->channel[i].out_of_band ? "Yes" : "No");
1128                DHL_OS_Printf("\tshow_guide:                0x%01X (%s)\n", (int)cvctPtr->channel[i].show_guide, cvctPtr->channel[i].show_guide ? "Yes" : "No");
1129                DHL_OS_Printf("\tservice_type:              0x%02X (%s)\n", cvctPtr->channel[i].service_type,DLIB_ServiceTypeString(cvctPtr->channel[i].service_type));         
1130                DHL_OS_Printf("\tsource_id:                 0x%04X\n", (int)cvctPtr->channel[i].source_id);
1131                DHL_OS_Printf("\tdescriptor_length:         %d\n", (int)cvctPtr->channel[i].descriptor_length);
1132
1133                if (cvctPtr->channel[i].descriptor_length)
1134                        DLIB_PSI_MemDump(cvctPtr->channel[i].descriptors, cvctPtr->channel[i].descriptor_length, 1, 6);
1135        }
1136        DHL_OS_Printf("additional_descriptor_length:  %d\n", (int)cvctPtr->additional_descriptor_length);
1137
1138        if (cvctPtr->additional_descriptor_length)
1139                DLIB_PSI_MemDump(cvctPtr->additional_descriptors, cvctPtr->additional_descriptor_length, 1, 6);
1140}
1141
1142
1143
1144
1145/*=========================================================================
1146void PrintEit (eitPtr_t eitPtr)
1147
1148typedef struct eitEvent {
1149        UINT16                  event_id;
1150        UINT32                  start_time;
1151        ETM_location_k          ETM_location;
1152        UINT32                  length_in_seconds;
1153        multipleStringPtr_t     title;
1154        UINT16                  descriptor_length;
1155        UINT8*                  descriptors;   
1156} eitEvent_t, *eitEventPtr_t;
1157
1158typedef struct eit {
1159        INT32                           memId;         
1160        UINT16                  source_id;
1161        UINT8                           version_number;
1162        UINT8                           numEvents;
1163        eitEventPtr_t           event;         
1164} eit_t, *eitPtr_t;
1165=========================================================================*/
1166void PrintEit (eitPtr_t eitPtr)
1167{
1168        INT32                           i;
1169       
1170        DHL_OS_Printf("\n------ EIT ------\n");
1171        DHL_OS_Printf("source_id:              0x%04X (%d)\n",(int)eitPtr->source_id,(int)eitPtr->source_id);
1172        DHL_OS_Printf("version_number:         %d\n",(int) eitPtr->version_number);
1173        DHL_OS_Printf("numEvents:  %d\n", (int)eitPtr->numEvents);
1174        for (i=0; i<eitPtr->numEvents; i++) {
1175                DHL_OS_Printf("event[%d]:\n", i);
1176                DHL_OS_Printf("\tevent_id:              0x%04X\n", (int)eitPtr->event[i].event_id);
1177                DHL_OS_Printf("\tstart_time:            0x%08X (%d)\n", eitPtr->event[i].start_time,eitPtr->event[i].start_time);
1178                DHL_OS_Printf("\tETM_location:          0x%02X (%s)\n", eitPtr->event[i].ETM_location,DLIB_EtmLocationString(eitPtr->event[i].ETM_location));
1179                DHL_OS_Printf("\tlength_in_seconds:     0x%08X (%d)\n", eitPtr->event[i].length_in_seconds,eitPtr->event[i].length_in_seconds);
1180                PrintMultipleString(eitPtr->event[i].title, eitPtr->event[i].title_length);
1181                DHL_OS_Printf("descriptor_length:       %d\n", (int)eitPtr->event[i].descriptor_length);
1182        }
1183}
1184
1185
1186
1187
1188#endif // DLIB_PSI_API_DEBUG
1189
Note: See TracBrowser for help on using the repository browser.