summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesper Larsen <knorr.jesper@gmail.com>2014-02-08 13:08:02 +0100
committerSebastian Dröge <sebastian@centricular.com>2014-02-08 16:59:47 +0100
commit972f7ea71f078648b0a895d07a1d1f16490eb3fa (patch)
treeb9d25f371264dfad0743812693636fde6e3a6e58
parent3e6c1967c9bc9a61354c79176b3b467b267be45a (diff)
mpegts: Fix some packetizing bugs
- Length of NIT stream descriptors was not detected correct - Reserved bits was not set according to EN 300 468, ISO/IEC 13818-1 - Also set output data size if the section was previously packetized https://bugzilla.gnome.org/show_bug.cgi?id=723892
-rw-r--r--gst-libs/gst/mpegts/gst-dvb-section.c4
-rw-r--r--gst-libs/gst/mpegts/gstmpegtssection.c13
2 files changed, 13 insertions, 4 deletions
diff --git a/gst-libs/gst/mpegts/gst-dvb-section.c b/gst-libs/gst/mpegts/gst-dvb-section.c
index cd0a493f0..652cf1dce 100644
--- a/gst-libs/gst/mpegts/gst-dvb-section.c
+++ b/gst-libs/gst/mpegts/gst-dvb-section.c
@@ -685,7 +685,7 @@ _packetize_nit (GstMpegTsSection * section)
loop_length += 6;
if (stream->descriptors) {
for (j = 0; j < stream->descriptors->len; j++) {
- descriptor = g_ptr_array_index (stream->descriptors, i);
+ descriptor = g_ptr_array_index (stream->descriptors, j);
loop_length += descriptor->length + 2;
}
}
@@ -734,7 +734,7 @@ _packetize_nit (GstMpegTsSection * section)
_packetize_descriptor_array (stream->descriptors, &data);
/* Go back and update the descriptor length */
- GST_WRITE_UINT16_BE (pos, data - pos - 2);
+ GST_WRITE_UINT16_BE (pos, (data - pos - 2) | 0xF000);
}
}
diff --git a/gst-libs/gst/mpegts/gstmpegtssection.c b/gst-libs/gst/mpegts/gstmpegtssection.c
index 1c95c0149..6b17ec09d 100644
--- a/gst-libs/gst/mpegts/gstmpegtssection.c
+++ b/gst-libs/gst/mpegts/gstmpegtssection.c
@@ -1087,7 +1087,14 @@ _packetize_common_section (GstMpegTsSection * section, gsize length)
/* section_syntax_indicator - 1 bit
reserved - 3 bit
section_length - 12 bit uimsbf */
- GST_WRITE_UINT16_BE (data, (section->section_length - 3) | 0x7000);
+ if (section->section_type == (GST_MPEGTS_SECTION_PAT ||
+ GST_MPEGTS_SECTION_PMT ||
+ GST_MPEGTS_SECTION_CAT || GST_MPEGTS_SECTION_TSDT)) {
+ /* Tables from ISO/IEC 13818-1 has a '0' bit
+ * after the section_syntax_indicator */
+ GST_WRITE_UINT16_BE (data, (section->section_length - 3) | 0x3000);
+ } else
+ GST_WRITE_UINT16_BE (data, (section->section_length - 3) | 0x7000);
if (!section->short_section)
*data |= 0x80;
@@ -1206,8 +1213,10 @@ gst_mpegts_section_packetize (GstMpegTsSection * section, gsize * output_size)
g_return_val_if_fail (section->packetizer != NULL, NULL);
/* Section data has already been packetized */
- if (section->data)
+ if (section->data) {
+ *output_size = section->section_length;
return section->data;
+ }
if (!section->packetizer (section))
return NULL;