summaryrefslogtreecommitdiffstats
path: root/sub_cc.c
diff options
context:
space:
mode:
Diffstat (limited to 'sub_cc.c')
-rw-r--r--sub_cc.c48
1 files changed, 24 insertions, 24 deletions
diff --git a/sub_cc.c b/sub_cc.c
index 3a420ed6d9..7df87ef49a 100644
--- a/sub_cc.c
+++ b/sub_cc.c
@@ -2,11 +2,11 @@
* decoder for Closed Captions
*
* This decoder relies on MPlayer's OSD to display subtitles.
- * Be warned that the decoding is somewhat preliminary, though it basically works.
- *
- * Most notably, only the text information is decoded as of now, discarding color,
- * background and position info (see source below).
- *
+ * Be warned that decoding is somewhat preliminary, though it basically works.
+ *
+ * Most notably, only the text information is decoded as of now, discarding
+ * color, background and position info (see source below).
+ *
* by Matteo Giani
*
* uses source from the xine closed captions decoder
@@ -90,8 +90,8 @@ static void scroll_buffer(subtitle* buf)
buf->lines--;
}
}
-
-
+
+
void subcc_init(void)
{
int i;
@@ -108,7 +108,7 @@ void subcc_init(void)
static void append_char(char c)
{
if(!bb->lines) {bb->lines++; cursor_pos=0;}
- if(bb->text[bb->lines - 1]==NULL)
+ if(bb->text[bb->lines - 1]==NULL)
{
bb->text[bb->lines - 1]=malloc(CC_MAX_LINE_LENGTH);
memset(bb->text[bb->lines - 1],0,CC_MAX_LINE_LENGTH);
@@ -126,7 +126,7 @@ static void append_char(char c)
}
}
}
- else
+ else
{
if(cursor_pos==CC_MAX_LINE_LENGTH-1)
{
@@ -157,7 +157,7 @@ static void display_buffer(subtitle * buf)
static void cc_decode_EIA608(unsigned short int data)
{
-
+
static unsigned short int lastcode=0x0000;
unsigned char c1 = data & 0x7f;
unsigned char c2 = (data >> 8) & 0x7f;
@@ -180,13 +180,13 @@ static void cc_decode_EIA608(unsigned short int data)
switch(c1)
{
case 0x10: break; // ext attribute
- case 0x11:
- if((c2 & 0x30)==0x30)
+ case 0x11:
+ if((c2 & 0x30)==0x30)
{
//printf("[debug]:Special char (ignored)\n");
/*cc_decode_special_char()*/;
}
- else if (c2 & 0x20)
+ else if (c2 & 0x20)
{
//printf("[debug]: midrow_attr (ignored)\n");
/*cc_decode_midrow_attr()*/;
@@ -223,8 +223,8 @@ static void cc_decode_EIA608(unsigned short int data)
}
}
}
- }
- lastcode=data;
+ }
+ lastcode=data;
}
static void subcc_decode(unsigned char *inputbuffer, unsigned int inputlength)
@@ -247,13 +247,13 @@ static void subcc_decode(unsigned char *inputbuffer, unsigned int inputlength)
* 0x00 is padding, followed by 2 more 0x00.
*
* 0x01 always seems to appear at the beginning, always seems to
- * be followed by 0xf8, 8-bit number.
+ * be followed by 0xf8, 8-bit number.
* The lower 7 bits of this 8-bit number seem to denote the
* number of code triplets that follow.
- * The most significant bit denotes whether the Line 21 field 1
+ * The most significant bit denotes whether the Line 21 field 1
* captioning information is at odd or even triplet offsets from this
* beginning triplet. 1 denotes odd offsets, 0 denotes even offsets.
- *
+ *
* Most captions are encoded with odd offsets, so this is what we
* will assume.
*
@@ -276,18 +276,18 @@ static void subcc_decode(unsigned char *inputbuffer, unsigned int inputlength)
#endif
break;
}
-
+
data1 = *(current+1);
data2 = *(current + 2);
current++; curbytes++;
-
+
switch (cc_code) {
case 0xfe:
/* expect 2 byte encoding (perhaps CC3, CC4?) */
/* ignore for time being */
skip = 2;
break;
-
+
case 0xff:
/* expect EIA-608 CC1/CC2 encoding */
// FIXME check parity!
@@ -296,12 +296,12 @@ static void subcc_decode(unsigned char *inputbuffer, unsigned int inputlength)
cc_decode_EIA608(data1 | (data2 << 8));
skip = 5;
break;
-
+
case 0x00:
/* This seems to be just padding */
skip = 2;
break;
-
+
case 0x01:
odd_offset = data2 & 0x80;
if (odd_offset)
@@ -309,7 +309,7 @@ static void subcc_decode(unsigned char *inputbuffer, unsigned int inputlength)
else
skip = 5;
break;
-
+
default:
//#ifdef LOG_DEBUG
fprintf(stderr, "Unknown CC encoding: %x\n", cc_code);