Changeset 104

Show
Ignore:
Timestamp:
21/03/05 14:38:56 (4 years ago)
Author:
massiot
Message:

* src/descriptor: Descriptor 0x52 decoding and generation
* examples/decode_pmt.c: More verbose output
Patch courtesy of Andrew John Hughes.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/AUTHORS

    r101 r104  
    2222D: most DVB descriptors 
    2323 
     24N: Andrew John Hughes 
     25E: gnu_andrew@member.fsf.org 
     26D: descriptor 0x52 
     27D: decode_pmt verbose output 
     28 
    2429N: Tristan Leteurtre 
    2530E: tristan.leteurtre@anevia.com 
  • trunk/examples/Makefile.am

    r59 r104  
    77 
    88decode_pmt_SOURCES = decode_pmt.c 
    9 decode_pmt_LDFLAGS = -L../src -ldvbpsi 
     9decode_pmt_LDFLAGS = -L../src -ldvbpsi -lm 
    1010 
    1111decode_sdt_SOURCES = decode_sdt.c 
  • trunk/examples/decode_pat.c

    r88 r104  
    33 *---------------------------------------------------------------------------- 
    44 * (c)2001-2002 VideoLAN 
    5  * $Id: decode_pat.c,v 1.3 2002/10/07 14:15:14 sam Exp
     5 * $Id
    66 * 
    77 * Authors: Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr> 
  • trunk/examples/decode_pmt.c

    r88 r104  
    33 *---------------------------------------------------------------------------- 
    44 * (c)2001-2002 VideoLAN 
    5  * $Id: decode_pmt.c,v 1.3 2002/10/07 14:15:14 sam Exp
     5 * $Id
    66 * 
    77 * Authors: Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr> 
     
    3232#include <unistd.h> 
    3333#include <fcntl.h> 
     34#include <math.h> 
    3435 
    3536#if defined(HAVE_INTTYPES_H) 
     
    4546#include "../src/descriptor.h" 
    4647#include "../src/tables/pmt.h" 
     48#include "../src/descriptors/dr.h" 
    4749#else 
    4850#include <dvbpsi/dvbpsi.h> 
     
    5052#include <dvbpsi/descriptor.h> 
    5153#include <dvbpsi/pmt.h> 
     54#include <dvbpsi/dr.h> 
    5255#endif 
    5356 
     57#define SYSTEM_CLOCK_DR 0x0B 
     58#define MAX_BITRATE_DR 0x0E 
     59#define STREAM_IDENTIFIER_DR 0x52 
     60#define SUBTITLING_DR 0x59 
    5461 
    5562/***************************************************************************** 
     
    7885} 
    7986 
     87/***************************************************************************** 
     88 * GetTypeName 
     89 *****************************************************************************/ 
     90char* GetTypeName(uint8_t type) 
     91{ 
     92  switch (type) 
     93    { 
     94    case 0x00: 
     95      return "Reserved"; 
     96    case 0x01: 
     97      return "ISO/IEC 11172 Video"; 
     98    case 0x02: 
     99      return "ISO/IEC 13818-2 Video"; 
     100    case 0x03: 
     101      return "ISO/IEC 11172 Audio"; 
     102    case 0x04: 
     103      return "ISO/IEC 13818-3 Audio"; 
     104    case 0x05: 
     105      return "ISO/IEC 13818-1 Private Section"; 
     106    case 0x06: 
     107      return "ISO/IEC 13818-1 Private PES data packets"; 
     108    case 0x07: 
     109      return "ISO/IEC 13522 MHEG"; 
     110    case 0x08: 
     111      return "ISO/IEC 13818-1 Annex A DSM CC"; 
     112    case 0x09: 
     113      return "H222.1"; 
     114    case 0x0A: 
     115      return "ISO/IEC 13818-6 type A"; 
     116    case 0x0B: 
     117      return "ISO/IEC 13818-6 type B"; 
     118    case 0x0C: 
     119      return "ISO/IEC 13818-6 type C"; 
     120    case 0x0D: 
     121      return "ISO/IEC 13818-6 type D"; 
     122    case 0x0E: 
     123      return "ISO/IEC 13818-1 auxillary"; 
     124    default: 
     125      if (type < 0x80) 
     126        return "ISO/IEC 13818-1 reserved"; 
     127      else 
     128        return "User Private"; 
     129    } 
     130} 
     131 
     132/***************************************************************************** 
     133 * DumpMaxBitrateDescriptor 
     134 *****************************************************************************/ 
     135void DumpMaxBitrateDescriptor(dvbpsi_max_bitrate_dr_t* bitrate_descriptor) 
     136{ 
     137  printf("Bitrate: %d\n", bitrate_descriptor->i_max_bitrate); 
     138} 
     139 
     140/***************************************************************************** 
     141 * DumpSystemClockDescriptor 
     142 *****************************************************************************/ 
     143void DumpSystemClockDescriptor(dvbpsi_system_clock_dr_t* p_clock_descriptor) 
     144{ 
     145  printf("External clock: %s, Accuracy: %E\n", 
     146         p_clock_descriptor->b_external_clock_ref ? "Yes" : "No", 
     147         p_clock_descriptor->i_clock_accuracy_integer * 
     148         pow(10, p_clock_descriptor->i_clock_accuracy_exponent)); 
     149} 
     150 
     151/***************************************************************************** 
     152 * DumpStreamIdentifierDescriptor 
     153 *****************************************************************************/ 
     154void DumpStreamIdentifierDescriptor(dvbpsi_stream_identifier_dr_t* p_si_descriptor) 
     155{ 
     156  printf("Component tag: %d\n", 
     157         p_si_descriptor->i_component_tag); 
     158} 
     159 
     160/***************************************************************************** 
     161 * DumpSubtitleDescriptor 
     162 *****************************************************************************/ 
     163void DumpSubtitleDescriptor(dvbpsi_subtitling_dr_t* p_subtitle_descriptor) 
     164{ 
     165  int a; 
     166 
     167  printf("%d subtitles,\n", p_subtitle_descriptor->i_subtitles_number); 
     168  for (a = 0; a < p_subtitle_descriptor->i_subtitles_number; ++a) 
     169    { 
     170      printf("       | %d - lang: %c%c%c, type: %d, cpid: %d, apid: %d\n", a, 
     171             p_subtitle_descriptor->p_subtitle[a].i_iso6392_language_code[0], 
     172             p_subtitle_descriptor->p_subtitle[a].i_iso6392_language_code[1], 
     173             p_subtitle_descriptor->p_subtitle[a].i_iso6392_language_code[2], 
     174             p_subtitle_descriptor->p_subtitle[a].i_subtitling_type, 
     175             p_subtitle_descriptor->p_subtitle[a].i_composition_page_id, 
     176             p_subtitle_descriptor->p_subtitle[a].i_ancillary_page_id); 
     177    } 
     178} 
    80179 
    81180/***************************************************************************** 
     
    84183void DumpDescriptors(const char* str, dvbpsi_descriptor_t* p_descriptor) 
    85184{ 
     185  int i; 
     186 
    86187  while(p_descriptor) 
    87188  { 
    88     int i; 
    89     printf("%s 0x%02x : \"", str, p_descriptor->i_tag); 
    90     for(i = 0; i < p_descriptor->i_length; i++) 
    91       printf("%c", p_descriptor->p_data[i]); 
    92     printf("\"\n"); 
     189    printf("%s 0x%02x : ", str, p_descriptor->i_tag); 
     190    switch (p_descriptor->i_tag) 
     191      { 
     192      case SYSTEM_CLOCK_DR: 
     193        DumpSystemClockDescriptor(dvbpsi_DecodeSystemClockDr(p_descriptor)); 
     194        break; 
     195      case MAX_BITRATE_DR: 
     196        DumpMaxBitrateDescriptor(dvbpsi_DecodeMaxBitrateDr(p_descriptor)); 
     197        break; 
     198      case STREAM_IDENTIFIER_DR: 
     199        DumpStreamIdentifierDescriptor(dvbpsi_DecodeStreamIdentifierDr(p_descriptor)); 
     200        break; 
     201      case SUBTITLING_DR: 
     202        DumpSubtitleDescriptor(dvbpsi_DecodeSubtitlingDr(p_descriptor)); 
     203        break; 
     204      default: 
     205        printf("\""); 
     206        for(i = 0; i < p_descriptor->i_length; i++) 
     207          printf("%c", p_descriptor->p_data[i]); 
     208        printf("\"\n"); 
     209      } 
    93210    p_descriptor = p_descriptor->p_next; 
    94211  } 
     
    114231  while(p_es) 
    115232  { 
    116     printf("    | 0x%02x @ 0x%x (%d)\n", 
    117            p_es->i_type, p_es->i_pid, p_es->i_pid); 
     233    printf("    | 0x%02x (%s) @ 0x%x (%d)\n", 
     234           p_es->i_type, GetTypeName(p_es->i_type), 
     235           p_es->i_pid, p_es->i_pid); 
    118236    DumpDescriptors("    |  ]", p_es->p_first_descriptor); 
    119237    p_es = p_es->p_next; 
  • trunk/src/Makefile.am

    r95 r104  
    3333                     descriptors/dr_47.h \ 
    3434                     descriptors/dr_48.h \ 
     35                     descriptors/dr_52.h \ 
    3536                     descriptors/dr_55.h \ 
    3637                     descriptors/dr_56.h \ 
     
    5556                  descriptors/dr_47.c \ 
    5657                  descriptors/dr_48.c \ 
     58                  descriptors/dr_52.c \ 
    5759                  descriptors/dr_55.c \ 
    5860                  descriptors/dr_56.c \ 
  • trunk/src/descriptors/dr.h

    r95 r104  
    5050#include "dr_47.h" 
    5151#include "dr_48.h" 
     52#include "dr_52.h" 
    5253#include "dr_55.h" 
    5354#include "dr_56.h"