fix bug in radiotext decoder
[enigma2.git] / lib / dvb / radiotext.cpp
index 0ac7175142f2de8f1232adf8ea87a4579eaea446..c165907cd095764b0a7d9d0391c5989ed5a6af58 100644 (file)
@@ -82,6 +82,7 @@ void eDVBRadioTextParser::processPESPacket(__u8 *data, int len)
                int channel = mode == 3 ? 1 : 2;
                int id = (data[pos + 1] >> 3) & 1;
                int emphasis_bit = data[pos + 3] & 3;
+               int protection_bit = data[pos + 1] & 1;
                int rate = -1;
                int sample_freq = -1;
                int layer = -1;
@@ -112,16 +113,17 @@ void eDVBRadioTextParser::processPESPacket(__u8 *data, int len)
 
                pos += frame_size;
 
+#if 0
+//             eDebug("protection_bit ? %d", protection_bit);
+//             int offs = protection_bit ? pos - 1 : pos - 3;
+//             if (data[offs] != 0xFD)
+//                     offs += 2;
+//             eDebug("%02x %02x %02x %02x %02x", data[offs-2], data[offs-1], data[offs], data[offs+1], data[offs+2]);
+#else
                int offs = pos - 1;
-               if (data[offs] != 0xFD)
-               {
-                       offs -= 2;
-                       if (data[offs] != 0xFD)
-                               return;
-                       else
-                               eDebug("match 2");
-               }
-               else
+#endif
+
+               if (data[offs] == 0xFD)
                {
                        int ancillary_len = 1 + data[offs - 1];
                        offs -= ancillary_len;