Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
418f8da8
Commit
418f8da8
authored
Oct 18, 2007
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added support for DVD and ReplayTV CC.
parent
ba0f64f1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
95 additions
and
20 deletions
+95
-20
modules/codec/cc.h
modules/codec/cc.h
+95
-20
No files found.
modules/codec/cc.h
View file @
418f8da8
...
...
@@ -31,6 +31,9 @@ typedef struct
/* Which channel are present */
vlc_bool_t
pb_present
[
4
];
/* */
vlc_bool_t
b_reorder
;
/* CC data per field
* byte[x+0]: field (0/1)
* byte[x+1]: cc data 1
...
...
@@ -59,6 +62,7 @@ static inline void cc_Init( cc_data_t *c )
for
(
i
=
0
;
i
<
4
;
i
++
)
c
->
pb_present
[
i
]
=
VLC_FALSE
;
c
->
i_data
=
0
;
c
->
b_reorder
=
VLC_FALSE
;
}
static
inline
void
cc_Exit
(
cc_data_t
*
c
)
{
...
...
@@ -71,11 +75,19 @@ static inline void cc_Flush( cc_data_t *c )
static
inline
void
cc_Extract
(
cc_data_t
*
c
,
const
uint8_t
*
p_src
,
int
i_src
)
{
static
const
uint8_t
p_cc_ga94
[
4
]
=
{
0x47
,
0x41
,
0x39
,
0x34
};
static
const
uint8_t
p_cc_dvd
[
4
]
=
{
0x43
,
0x43
,
0x01
,
0xf8
};
static
const
uint8_t
p_cc_replaytv4a
[
2
]
=
{
0xbb
,
0x02
};
static
const
uint8_t
p_cc_replaytv4b
[
2
]
=
{
0xcc
,
0x02
};
static
const
uint8_t
p_cc_replaytv5a
[
2
]
=
{
0x99
,
0x02
};
static
const
uint8_t
p_cc_replaytv5b
[
2
]
=
{
0xaa
,
0x02
};
//static const uint8_t p_afd_start[4] = { 0x44, 0x54, 0x47, 0x31 };
if
(
i_src
<
4
)
return
;
if
(
!
memcmp
(
p_cc_ga94
,
p_src
,
4
)
&&
i_src
>=
5
+
1
+
1
+
1
&&
p_src
[
4
]
==
0x03
)
{
/* Extract CC from DVB/ATSC TS */
/* cc_data()
* u1 reserved(1)
* u1 process_cc_data_flag
...
...
@@ -96,9 +108,6 @@ static inline void cc_Extract( cc_data_t *c, const uint8_t *p_src, int i_src )
* 0x00: field 1
* 0x01: field 2
*/
if
(
!
memcmp
(
p_cc_ga94
,
p_src
,
4
)
&&
i_src
>=
5
+
1
+
1
+
1
&&
p_src
[
4
]
==
0x03
)
{
/* Extract CC from DVB/ATSC TS */
const
uint8_t
*
cc
=
&
p_src
[
5
];
const
int
i_count_cc
=
cc
[
0
]
&
0x1f
;
int
i
;
...
...
@@ -132,9 +141,75 @@ static inline void cc_Extract( cc_data_t *c, const uint8_t *p_src, int i_src )
c
->
p_data
[
c
->
i_data
++
]
=
cc
[
1
];
c
->
p_data
[
c
->
i_data
++
]
=
cc
[
2
];
}
c
->
b_reorder
=
VLC_TRUE
;
}
else
if
(
!
memcmp
(
p_cc_dvd
,
p_src
,
4
)
&&
i_src
>
4
+
1
)
{
/* DVD CC */
const
int
b_truncate
=
p_src
[
4
]
&
0x01
;
const
int
i_field_first
=
(
p_src
[
4
]
&
0x80
)
?
0
:
1
;
const
int
i_count_cc2
=
(
p_src
[
4
]
>>
1
)
&
0xf
;
const
uint8_t
*
cc
=
&
p_src
[
5
];
int
i
;
if
(
i_src
<
4
+
1
+
6
*
i_count_cc2
-
(
b_truncate
?
3
:
0
)
)
return
;
for
(
i
=
0
;
i
<
i_count_cc2
;
i
++
)
{
int
j
;
for
(
j
=
0
;
j
<
2
;
j
++
,
cc
+=
3
)
{
const
int
i_field
=
j
==
i_field_first
?
0
:
1
;
int
i_channel
;
if
(
b_truncate
&&
i
==
i_count_cc2
-
1
&&
j
==
1
)
break
;
if
(
cc
[
0
]
!=
0xff
&&
cc
[
0
]
!=
0xfe
)
continue
;
if
(
c
->
i_data
+
3
>
CC_MAX_DATA_SIZE
)
continue
;
i_channel
=
cc_Channel
(
i_field
,
&
cc
[
1
]
);
if
(
i_channel
>=
0
&&
i_channel
<
4
)
c
->
pb_present
[
i_channel
]
=
VLC_TRUE
;
c
->
p_data
[
c
->
i_data
++
]
=
i_field
;
c
->
p_data
[
c
->
i_data
++
]
=
cc
[
1
];
c
->
p_data
[
c
->
i_data
++
]
=
cc
[
2
];
}
}
c
->
b_reorder
=
VLC_FALSE
;
}
else
if
(
i_src
>=
2
+
2
+
2
+
2
&&
(
(
!
memcmp
(
p_cc_replaytv4a
,
&
p_src
[
0
],
2
)
&&
!
memcmp
(
p_cc_replaytv4b
,
&
p_src
[
4
],
2
)
)
||
(
!
memcmp
(
p_cc_replaytv5a
,
&
p_src
[
0
],
2
)
&&
!
memcmp
(
p_cc_replaytv5b
,
&
p_src
[
4
],
2
)
)
)
)
{
/* ReplayTV CC */
const
uint8_t
*
cc
=
&
p_src
[
0
];
int
i
;
if
(
c
->
i_data
+
2
*
3
>
CC_MAX_DATA_SIZE
)
return
;
for
(
i
=
0
;
i
<
2
;
i
++
,
cc
+=
4
)
{
const
int
i_field
=
i
==
0
?
1
:
0
;
int
i_channel
=
cc_Channel
(
i_field
,
&
cc
[
2
]
);
if
(
i_channel
>=
0
&&
i_channel
<
4
)
c
->
pb_present
[
i_channel
]
=
VLC_TRUE
;
c
->
p_data
[
c
->
i_data
++
]
=
i_field
;
c
->
p_data
[
c
->
i_data
++
]
=
cc
[
2
];
c
->
p_data
[
c
->
i_data
++
]
=
cc
[
3
];
}
c
->
b_reorder
=
VLC_FALSE
;
}
else
{
#if 0
#define V(x) ( ( x < 0x20 || x >= 0x7f ) ? '?' : x )
fprintf( stderr, "-------------- unknown user data %2.2x %2.2x %2.2x %2.2x %c%c%c%c\n",
p_src[0], p_src[1], p_src[2], p_src[3],
V(p_src[0]), V(p_src[1]), V(p_src[2]), V(p_src[3]) );
#undef V
#endif
/* TODO DVD CC, ... */
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment