Merge commit 'origin/bug_449_fix_wlan_usbstick_recognition'
[enigma2.git] / lib / dvb / subtitle.cpp
index 047e76d..06bb266 100644 (file)
@@ -82,7 +82,7 @@ static int map_4_to_8_bit_table[16];
 int eDVBSubtitleParser::subtitle_process_pixel_data(subtitle_region *region, subtitle_region_object *object, int *linenr, int *linep, __u8 *data)
 {
        int data_type = *data++;
-       static __u8 line[720];
+       static __u8 line[1920];
 
        bitstream bit;
        bit.size=0;
@@ -142,7 +142,7 @@ int eDVBSubtitleParser::subtitle_process_pixel_data(subtitle_region *region, sub
                                map_2_to_4_bit_table[col] :
                                region->depth == subtitle_region::bpp8 ?
                                map_2_to_8_bit_table[col] : col;
-                       while (len && ((*linep) < 720))
+                       while (len && ((*linep) < m_display_size.width()))
                        {
                                line[(*linep)++] = c;
                                len--;
@@ -197,7 +197,7 @@ int eDVBSubtitleParser::subtitle_process_pixel_data(subtitle_region *region, sub
                        }
                        uint8_t c = region->depth == subtitle_region::bpp8 ?
                                map_4_to_8_bit_table[col] : col;
-                       while (len && ((*linep) < 720))
+                       while (len && ((*linep) < m_display_size.width()))
                        {
                                line[(*linep)++] = c;
                                len--;
@@ -231,7 +231,7 @@ int eDVBSubtitleParser::subtitle_process_pixel_data(subtitle_region *region, sub
                                } else
                                        break;
                        }
-                       while (len && ((*linep) < 720))
+                       while (len && ((*linep) < m_display_size.width()))
                        {
                                line[(*linep)++] = col;
                                len--;
@@ -270,7 +270,7 @@ int eDVBSubtitleParser::subtitle_process_pixel_data(subtitle_region *region, sub
                subtitle_process_line(region, object, *linenr, line, *linep);
 /*             {
                        int i;
-                       for (i=0; i<720; ++i)
+                       for (i=0; i<m_display_size.width(); ++i)
                                eDebugNoNewLine("%d ", line[i]);
                        eDebug("");
                } */
@@ -658,7 +658,6 @@ int eDVBSubtitleParser::subtitle_process_segment(__u8 *segment)
                        if (entry_CLUT_flag & 1) // 8bit
                        {
 //                             eDebugNoNewLine("8b");
-                               ASSERT(CLUT_entry_id < 256);
                                clut->entries_8bit[CLUT_entry_id].Y = v_Y;
                                clut->entries_8bit[CLUT_entry_id].Cr = v_Cr;
                                clut->entries_8bit[CLUT_entry_id].Cb = v_Cb;
@@ -668,22 +667,30 @@ int eDVBSubtitleParser::subtitle_process_segment(__u8 *segment)
                        if (entry_CLUT_flag & 2) // 4bit
                        {
 //                             eDebugNoNewLine("4b");
-                               ASSERT(CLUT_entry_id < 16);
-                               clut->entries_4bit[CLUT_entry_id].Y = v_Y;
-                               clut->entries_4bit[CLUT_entry_id].Cr = v_Cr;
-                               clut->entries_4bit[CLUT_entry_id].Cb = v_Cb;
-                               clut->entries_4bit[CLUT_entry_id].T = v_T;
-                               clut->entries_4bit[CLUT_entry_id].valid = 1;
+                               if (CLUT_entry_id < 16)
+                               {
+                                       clut->entries_4bit[CLUT_entry_id].Y = v_Y;
+                                       clut->entries_4bit[CLUT_entry_id].Cr = v_Cr;
+                                       clut->entries_4bit[CLUT_entry_id].Cb = v_Cb;
+                                       clut->entries_4bit[CLUT_entry_id].T = v_T;
+                                       clut->entries_4bit[CLUT_entry_id].valid = 1;
+                               }
+                               else
+                                       eDebug("CLUT entry marked as 4 bit with id %d (>15)", CLUT_entry_id);
                        }
                        if (entry_CLUT_flag & 4) // 2bit
                        {
 //                             eDebugNoNewLine("2b");
-                               ASSERT(CLUT_entry_id < 4);
-                               clut->entries_2bit[CLUT_entry_id].Y = v_Y;
-                               clut->entries_2bit[CLUT_entry_id].Cr = v_Cr;
-                               clut->entries_2bit[CLUT_entry_id].Cb = v_Cb;
-                               clut->entries_2bit[CLUT_entry_id].T = v_T;
-                               clut->entries_2bit[CLUT_entry_id].valid = 1;
+                               if (CLUT_entry_id < 4)
+                               {
+                                       clut->entries_2bit[CLUT_entry_id].Y = v_Y;
+                                       clut->entries_2bit[CLUT_entry_id].Cr = v_Cr;
+                                       clut->entries_2bit[CLUT_entry_id].Cb = v_Cb;
+                                       clut->entries_2bit[CLUT_entry_id].T = v_T;
+                                       clut->entries_2bit[CLUT_entry_id].valid = 1;
+                               }
+                               else
+                                       eDebug("CLUT entry marked as 2 bit with id %d (>3)", CLUT_entry_id);
                        }
 //                     eDebug(" %04x %02x %02x %02x %02x", CLUT_entry_id, v_Y, v_Cb, v_Cr, v_T);
                }