[libdvbpsi-devel] [Git][videolan/libdvbpsi][master] 11 commits: dvbinfo: dump descriptor 0x50

Jean-Paul Saman gitlab at videolan.org
Wed Jul 12 09:56:07 CEST 2017


Jean-Paul Saman pushed to branch master at videolan / libdvbpsi


Commits:
6ed78a23 by Jean-Paul Saman at 2017-02-17T13:02:02+01:00
dvbinfo: dump descriptor 0x50

- - - - -
539473b9 by Jean-Paul Saman at 2017-02-17T13:20:12+01:00
dvbinfo: dump parental rating descriptor

- - - - -
71eac086 by Jean-Paul Saman at 2017-02-17T13:26:35+01:00
dvbinfo: dump teletext descriptor

- - - - -
7ff4682a by Jean-Paul Saman at 2017-02-17T13:39:12+01:00
dvbinfo: improve layout

- - - - -
7e9f4ed3 by Jean-Paul Saman at 2017-06-22T15:04:00+02:00
src/dvbpsi.h: set i_last_section_number when adding a new section to the end of the list

The function dvbpsi_decoder_psi_section_add() never set p_decoder::i_last_section_number when
adding a new section at the end of the list. This was left to the decoder implementations. However
the correct action would have been to set p_decoder::i_last_section_number in dvbpsi_decoder_psi_section_add().

- - - - -
d6556776 by Jean-Paul Saman at 2017-06-23T14:54:08+02:00
src/demux.c: fix CID #164718

- - - - -
5a112301 by Jean-Paul Saman at 2017-06-23T15:06:05+02:00
src/chain.h: improved documentation

- - - - -
4c7bcee8 by Jean-Paul Saman at 2017-06-23T15:09:56+02:00
src/demux: functions dvbpsi_*DemuxSubDecoder() are no longer implemented, but are merely empty stubs

- - - - -
2b95c49c by Jean-Paul Saman at 2017-06-23T15:36:44+02:00
SIS: dvbpsi_sis_cmd_splice_schedule_decode() we are already on byte further

- - - - -
37f981c3 by Steven Toth at 2017-07-12T09:43:37+02:00
SCTE35 / CUEI Descriptor parsing bug. Descriptor lengths of one byte fail to parse, instead returning null.

The Spec from 2004 to 2016 shows the descriptor payload has never been
more than a single byte.
See SCTE 35 2016 Page 19 Table 2 (Section 8.2).

Correct the length validation check, and reject any descriptor that
IS NOT one byte long, as per the spec.

Signed-off-by: Jean-Paul Saman <jpsaman at videolan.org>

- - - - -
dfa10bae by Jean-Paul Saman at 2017-07-12T09:47:54+02:00
update NEWS and AUTHORS

- - - - -


8 changed files:

- AUTHORS
- NEWS
- examples/dvbinfo/libdvbpsi.c
- src/chain.h
- src/demux.c
- src/descriptors/custom/dr_8a_scte.c
- src/dvbpsi.c
- src/tables/sis.c


Changes:

=====================================
AUTHORS
=====================================
--- a/AUTHORS
+++ b/AUTHORS
@@ -105,6 +105,11 @@ D: Splice Information Table
 D: Bugfixing
 D: Maintainer
 
+N: Steven Toth
+E: stoth at kernellabs.com
+D: Bugfixing
+D: Descriptor 0x8a
+
 N: Yonathan Yusim
 D: Descriptor 0xa1
 


=====================================
NEWS
=====================================
--- a/NEWS
+++ b/NEWS
@@ -18,7 +18,7 @@ Changes between 1.3.0 and 2.0.0-git:
    - 0x24 Content labelling descriptor
    - 0x65 Scrambling descriptor
    - 0x67 DVB Transport Stream descriptor
- * Fix bugs in descriptors: 0x41, 0x44, 0x4a, 0x4b, 0x53, 0x54, 0x55, 0x56, 0x59, 0xa0
+ * Fix bugs in descriptors: 0x41, 0x44, 0x4a, 0x4b, 0x53, 0x54, 0x55, 0x56, 0x59, 0x8a, 0xa0
  * Fix bugs in table: CA, EIT, NIT
  * Work on SIS table and splice commands.
  * More descriptor tests


=====================================
examples/dvbinfo/libdvbpsi.c
=====================================
--- a/examples/dvbinfo/libdvbpsi.c
+++ b/examples/dvbinfo/libdvbpsi.c
@@ -1194,6 +1194,24 @@ static void DumpSystemClockDescriptor(const void *p_descriptor)
 }
 
 /*****************************************************************************
+ * DumpComponentDescriptor
+ *****************************************************************************/
+static void DumpComponentDescriptor(const void *p_descriptor)
+{
+    const dvbpsi_dvb_component_dr_t *p_dvb_component_dr = p_descriptor;
+    printf("\t\tstream content: %d\n", p_dvb_component_dr->i_stream_content);
+    printf("\t\tcomponent type: %d\n", p_dvb_component_dr->i_component_type);
+    printf("\t\tcomponent tag : %d\n", p_dvb_component_dr->i_component_tag);
+    printf("\t\tISO 639 code  : %c%c%c\n", p_dvb_component_dr->i_iso_639_code[0],
+           p_dvb_component_dr->i_iso_639_code[1], p_dvb_component_dr->i_iso_639_code[2]);
+    printf("\t\ttext          :");
+    for (int i = 0; i < p_dvb_component_dr->i_text_length; i++) {
+        printf("%c", p_dvb_component_dr->i_text[i]);
+    }
+    printf("\n");
+}
+
+/*****************************************************************************
  * DumpStreamIdentifierDescriptor
  *****************************************************************************/
 static void DumpStreamIdentifierDescriptor(const void *p_descriptor)
@@ -1376,6 +1394,37 @@ static void DumpContentDescriptor(const void *p_descriptor)
 }
 
 /*****************************************************************************
+ * DumpParentalRatingDescriptor
+ *****************************************************************************/
+static void DumpParentalRatingDescriptor(const void *p_descriptor)
+{
+    const dvbpsi_dvb_parental_rating_dr_t *p_parental_rating_descriptor = p_descriptor;
+    printf("Parental ratings\n");
+    for (int i = 0; i < p_parental_rating_descriptor->i_ratings_number; i++) {;
+        printf("\t\tcountry : %d\n", p_parental_rating_descriptor->p_parental_rating[i].i_country_code);
+        printf("\t\trating  : %d\n", p_parental_rating_descriptor->p_parental_rating[i].i_rating);
+    }
+}
+
+/*****************************************************************************
+ * DumpTeletextDescriptor
+ *****************************************************************************/
+static void DumpTeletextDescriptor(const void *p_descriptor)
+{
+    const dvbpsi_dvb_teletext_dr_t *p_teletext_descriptor = p_descriptor;
+    printf("Teletext pages\n");
+    for (int i = 0; i < p_teletext_descriptor->i_pages_number; i++) {
+        printf("\t\tISO 6392 language code: %c%c%c\n",
+               p_teletext_descriptor->p_pages[i].i_iso6392_language_code[0],
+               p_teletext_descriptor->p_pages[i].i_iso6392_language_code[1],
+               p_teletext_descriptor->p_pages[i].i_iso6392_language_code[2]);
+        printf("\t\tteletext type         : %d\n", p_teletext_descriptor->p_pages[i].i_teletext_type);
+        printf("\t\tteletext magazine     : %d\n", p_teletext_descriptor->p_pages[i].i_teletext_magazine_number);
+        printf("\t\tteletext page         : %d\n", p_teletext_descriptor->p_pages[i].i_teletext_page_number);
+    }
+}
+
+/*****************************************************************************
  * DumpSubtitleDescriptor
  *****************************************************************************/
 static void DumpSubtitleDescriptor(const void *p_descriptor)
@@ -1950,6 +1999,10 @@ static void DumpDescriptor(dvbpsi_descriptor_t *p_descriptor)
             p_decoded = dvbpsi_decode_dvb_tshifted_ev_dr(p_descriptor);
             dump_dr_fn = DumpTimeShiftedEventDescriptor;
             break;
+        case 0x50:
+            p_decoded = dvbpsi_decode_dvb_component_dr(p_descriptor);
+            dump_dr_fn = DumpComponentDescriptor;
+            break;
         case 0x52:
             p_decoded = dvbpsi_decode_dvb_stream_identifier_dr(p_descriptor);
             dump_dr_fn = DumpStreamIdentifierDescriptor;
@@ -1962,6 +2015,14 @@ static void DumpDescriptor(dvbpsi_descriptor_t *p_descriptor)
             p_decoded = dvbpsi_decode_dvb_content_dr(p_descriptor);
             dump_dr_fn = DumpContentDescriptor;
             break;
+        case 0x55:
+            p_decoded = dvbpsi_decode_dvb_parental_rating_dr(p_descriptor);
+            dump_dr_fn = DumpParentalRatingDescriptor;
+            break;
+        case 0x56:
+            p_decoded = dvbpsi_decode_dvb_teletext_dr(p_descriptor);
+            dump_dr_fn = DumpTeletextDescriptor;
+            break;
         case 0x59:
             p_decoded = dvbpsi_decode_dvb_subtitling_dr(p_descriptor);
             dump_dr_fn = DumpSubtitleDescriptor;
@@ -1972,7 +2033,7 @@ static void DumpDescriptor(dvbpsi_descriptor_t *p_descriptor)
             break;
     }
 
-    if(dump_dr_fn && p_decoded)
+    if (dump_dr_fn && p_decoded)
     {
         /* call the dump function if we could decode the descriptor. */
         dump_dr_fn(p_decoded);


=====================================
src/chain.h
=====================================
--- a/src/chain.h
+++ b/src/chain.h
@@ -39,12 +39,12 @@
  * -----------------------------------------------------------------------------------
  * - dvbpsi_AttachDemux                     | @see dvbpsi_demux_chain_new            -
  * - dvbpsi_DetachDemux                     | @see dvbpsi_demux_chain_delete         -
- * - dvbpsi_Demux                           |                                        -
+ * - dvbpsi_Demux                           | no replacement                         -
  * - dvbpsi_demuxGetSubDecoder              | @see dvbpsi_decoder_chain_get          -
- * - dvbpsi_NewDemuxSubDecoder              |                                        -
- * - dvbpsi_AttachDemuxSubDecoder           |                                        -
- * - dvbspi_DetachDemuxSubDecoder           |                                        -
- * ------------------------------------------------------------------------------------
+ * - dvbpsi_NewDemuxSubDecoder              | no replacement                         -
+ * - dvbpsi_AttachDemuxSubDecoder           | no replacement                         -
+ * - dvbspi_DetachDemuxSubDecoder           | no replacement                         -
+ * -----------------------------------------------------------------------------------
  *
  * Note that for dvbpsi_Demux(), dvbpsi_NewDemuxSubDecoder(), dvbpsi_AttachDemuxSubDecoder(),
  * and dvbspi_DetachDemuxSubDecoder() no replacement API is available. These functions are


=====================================
src/demux.c
=====================================
--- a/src/demux.c
+++ b/src/demux.c
@@ -112,9 +112,7 @@ dvbpsi_demux_subdec_t *dvbpsi_NewDemuxSubDecoder(const uint8_t i_table_id,
                                                  dvbpsi_demux_gather_cb_t pf_gather,
                                                  dvbpsi_decoder_t *p_decoder)
 {
-    (void) i_table_id; (void) i_extension;
-    (void *) pf_detach, (void *) pf_gather;
-    (void *) p_decoder;
+    assert(0);
     return NULL;
 }
 
@@ -126,8 +124,6 @@ dvbpsi_demux_subdec_t *dvbpsi_NewDemuxSubDecoder(const uint8_t i_table_id,
 void dvbpsi_DeleteDemuxSubDecoder(dvbpsi_demux_subdec_t *p_subdec)
 {
     assert(0);
-    if (!p_subdec)
-        return;
 }
 
 /*****************************************************************************
@@ -135,16 +131,7 @@ void dvbpsi_DeleteDemuxSubDecoder(dvbpsi_demux_subdec_t *p_subdec)
  *****************************************************************************/
 void dvbpsi_AttachDemuxSubDecoder(dvbpsi_demux_t *p_demux, dvbpsi_demux_subdec_t *p_subdec)
 {
-    assert(p_demux);
-    assert(p_subdec);
-
-    if (!p_demux || !p_subdec)
-        abort();
-
-    dvbpsi_t *p_dvbpsi = (dvbpsi_t *)p_demux;
-    dvbpsi_decoder_t *p_dec = (dvbpsi_decoder_t *)p_subdec;
-    if (!dvbpsi_decoder_chain_add(p_dvbpsi, p_dec))
-        abort();
+    assert(0);
 }
 
 /*****************************************************************************
@@ -152,14 +139,5 @@ void dvbpsi_AttachDemuxSubDecoder(dvbpsi_demux_t *p_demux, dvbpsi_demux_subdec_t
  *****************************************************************************/
 void dvbpsi_DetachDemuxSubDecoder(dvbpsi_demux_t *p_demux, dvbpsi_demux_subdec_t *p_subdec)
 {
-    assert(p_demux);
-    assert(p_subdec);
-
-    if (!p_demux || !p_subdec)
-        abort();
-
-    dvbpsi_t *p_dvbpsi = (dvbpsi_t *)p_demux;
-    dvbpsi_decoder_t *p_dec = (dvbpsi_decoder_t *)p_subdec;
-    if (!dvbpsi_decoder_chain_remove(p_dvbpsi, p_dec))
-        abort();
+    assert(0);
 }


=====================================
src/descriptors/custom/dr_8a_scte.c
=====================================
--- a/src/descriptors/custom/dr_8a_scte.c
+++ b/src/descriptors/custom/dr_8a_scte.c
@@ -53,7 +53,7 @@ dvbpsi_scte_cuei_dr_t * dvbpsi_decode_scte_cuei_dr(dvbpsi_descriptor_t * p_descr
     if (dvbpsi_IsDescriptorDecoded(p_descriptor))
         return p_descriptor->p_decoded;
 
-    if (p_descriptor->i_length == 0x01)
+    if (p_descriptor->i_length != 0x01)
         return NULL;
 
     /* Allocate memory */


=====================================
src/dvbpsi.c
=====================================
--- a/src/dvbpsi.c
+++ b/src/dvbpsi.c
@@ -218,6 +218,7 @@ bool dvbpsi_decoder_psi_section_add(dvbpsi_decoder_t *p_decoder, dvbpsi_psi_sect
     /* Add to end of list */
     if (p_prev->i_number < p_section->i_number)
     {
+        p_decoder->i_last_section_number = p_section->i_number;
         p_prev->p_next = p_section;
         p_section->p_next = NULL;
     }


=====================================
src/tables/sis.c
=====================================
--- a/src/tables/sis.c
+++ b/src/tables/sis.c
@@ -578,7 +578,7 @@ static dvbpsi_sis_cmd_splice_schedule_t *
     p_cmd->i_splice_count = p_data[pos++];
 
     dvbpsi_sis_splice_event_t *p_last = p_cmd->p_splice_event;
-    for (uint8_t i = 0; i < p_cmd->i_splice_count; i++) {
+    for (uint8_t i = pos; i < p_cmd->i_splice_count; i++) {
         dvbpsi_sis_splice_event_t *p_event;
         p_event = (dvbpsi_sis_splice_event_t *)calloc(1, sizeof(dvbpsi_sis_splice_event_t));
         if (!p_event) {



View it on GitLab: https://code.videolan.org/videolan/libdvbpsi/compare/10e546bc5bc91c2dda54d80a0faaefdf75339099...dfa10bae7c6171cd608311f7ad2bcb01e0f739d8

---
View it on GitLab: https://code.videolan.org/videolan/libdvbpsi/compare/10e546bc5bc91c2dda54d80a0faaefdf75339099...dfa10bae7c6171cd608311f7ad2bcb01e0f739d8
You're receiving this email because of your account on code.videolan.org.


More information about the libdvbpsi-devel mailing list