vdr-1.5.11 & subtitling problems

Message ID 47323461.3030901@gmx.de
State New
Headers

Commit Message

Reinhard Nissl Nov. 7, 2007, 9:55 p.m. UTC
  Hi,

Klaus Schmidinger schrieb:

> Thanks to Reinhard for finding this one.

And the attached patch should fix the incorrectly assembled subtitle PES
packets, which led to triggering pre 1.3.19 Dolby Digital compatibility
mode.

When TS packet's payload looked like that:

a)		00 00 01 bd 1d 7b 85 80 05
b)	27 cb cd b8 8b 20 00 0f ...

The bytes 85 80 and 05 were written to the PES packet as found was 9
after processing TS packet a) which was correct. But for the next TS
packet b), found was still 9 which caused writing the bytes 85 80 and 05
again to the PES packet.

So instead of writing

00 00 01 bd __ __ 85 80 05 27 cb cd b8 8b 20 01 00 00 20 00 0f ...
                                          ^^
the following was written:

00 00 01 bd __ __ 85 80 05 85 80 05 27 cb cd b8 8b 20 01 00 00 20 00 0f
                                          ^^

As a result PlayPES() didn't find the supported SubStreamId 20 but cd
which activated compatibility mode.

Bye.
  

Patch

--- ../vdr-1.5.10-orig/remux.c	2007-09-22 14:08:22.000000000 +0200
+++ remux.c	2007-11-07 22:25:17.000000000 +0100
@@ -1748,14 +2193,15 @@  void cTS2PES::instant_repack(const uint8
        case AUDIO_STREAM_S ... AUDIO_STREAM_E:
        case VIDEO_STREAM_S ... VIDEO_STREAM_E:
        case PRIVATE_STREAM1:
-
-            if (mpeg == 2 && found == 9) {
+            /* make sure to not write the data twice by looking at count */
+            if (mpeg == 2 && found == 9 && count < found) {
                write_ipack(&flag1, 1);
                write_ipack(&flag2, 1);
                write_ipack(&hlength, 1);
                }
 
-            if (mpeg == 1 && found == mpeg1_required) {
+            /* make sure to not write the data twice by looking at count */
+            if (mpeg == 1 && found == mpeg1_required && count < found) {
                write_ipack(&flag1, 1);
                if (mpeg1_required > 7) {
                   write_ipack(&flag2, 1);