Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
ffmpeg
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Stefan Westerfeld
ffmpeg
Commits
6cfa1733
Commit
6cfa1733
authored
Feb 08, 2019
by
Mathieu Duponchelle
Committed by
Michael Niedermayer
Mar 15, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mpeg12enc: Use Closed Captions if available
Signed-off-by:
Michael Niedermayer
<
michael@niedermayer.cc
>
parent
def18ac4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
0 deletions
+37
-0
encoders.texi
doc/encoders.texi
+3
-0
mpeg12enc.c
libavcodec/mpeg12enc.c
+32
-0
mpegvideo.h
libavcodec/mpegvideo.h
+2
-0
No files found.
doc/encoders.texi
View file @
6cfa1733
...
...
@@ -2574,6 +2574,9 @@ Specifies the video_format written into the sequence display extension
indicating the source of the video pictures. The default is @samp{unspecified},
can be @samp{component}, @samp{pal}, @samp{ntsc}, @samp{secam} or @samp{mac}.
For maximum compatibility, use @samp{component}.
@item a53cc @var{boolean}
Import closed captions (which must be ATSC compatible format) into output.
Default is 1 (on).
@end table
@section png
...
...
libavcodec/mpeg12enc.c
View file @
6cfa1733
...
...
@@ -61,6 +61,8 @@ static uint32_t mpeg1_chr_dc_uni[512];
static
uint8_t
mpeg1_index_run
[
2
][
64
];
static
int8_t
mpeg1_max_level
[
2
][
64
];
#define A53_MAX_CC_COUNT 0x1f
static
av_cold
void
init_uni_ac_vlc
(
RLTable
*
rl
,
uint8_t
*
uni_ac_vlc_len
)
{
int
i
;
...
...
@@ -544,6 +546,36 @@ void ff_mpeg1_encode_picture_header(MpegEncContext *s, int picture_number)
}
}
if
(
s
->
codec_id
==
AV_CODEC_ID_MPEG2VIDEO
&&
s
->
a53_cc
)
{
side_data
=
av_frame_get_side_data
(
s
->
current_picture_ptr
->
f
,
AV_FRAME_DATA_A53_CC
);
if
(
side_data
)
{
if
(
side_data
->
size
<=
A53_MAX_CC_COUNT
*
3
&&
side_data
->
size
%
3
==
0
)
{
int
i
=
0
;
put_header
(
s
,
USER_START_CODE
);
put_bits
(
&
s
->
pb
,
8
,
'G'
);
// user_identifier
put_bits
(
&
s
->
pb
,
8
,
'A'
);
put_bits
(
&
s
->
pb
,
8
,
'9'
);
put_bits
(
&
s
->
pb
,
8
,
'4'
);
put_bits
(
&
s
->
pb
,
8
,
3
);
// user_data_type_code
put_bits
(
&
s
->
pb
,
8
,
(
side_data
->
size
/
3
&
A53_MAX_CC_COUNT
)
|
0x40
);
// flags, cc_count
put_bits
(
&
s
->
pb
,
8
,
0xff
);
// em_data
for
(
i
=
0
;
i
<
side_data
->
size
;
i
++
)
put_bits
(
&
s
->
pb
,
8
,
side_data
->
data
[
i
]);
put_bits
(
&
s
->
pb
,
8
,
0xff
);
// marker_bits
}
else
{
av_log
(
s
->
avctx
,
AV_LOG_WARNING
,
"Warning Closed Caption size (%d) can not exceed 93 bytes "
"and must be a multiple of 3
\n
"
,
side_data
->
size
);
}
}
}
s
->
mb_y
=
0
;
ff_mpeg1_encode_slice_header
(
s
);
}
...
...
libavcodec/mpegvideo.h
View file @
6cfa1733
...
...
@@ -455,6 +455,7 @@ typedef struct MpegEncContext {
/* MPEG-2-specific - I wished not to have to support this mess. */
int
progressive_sequence
;
int
mpeg_f_code
[
2
][
2
];
int
a53_cc
;
// picture structure defines are loaded from mpegutils.h
int
picture_structure
;
...
...
@@ -663,6 +664,7 @@ FF_MPV_OPT_CMP_FUNC, \
{"ps", "RTP payload size in bytes", FF_MPV_OFFSET(rtp_payload_size), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS }, \
{"mepc", "Motion estimation bitrate penalty compensation (1.0 = 256)", FF_MPV_OFFSET(me_penalty_compensation), AV_OPT_TYPE_INT, {.i64 = 256 }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS }, \
{"mepre", "pre motion estimation", FF_MPV_OFFSET(me_pre), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS }, \
{"a53cc", "Use A53 Closed Captions (if available)", FF_MPV_OFFSET(a53_cc), AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, FF_MPV_OPT_FLAGS }, \
extern
const
AVOption
ff_mpv_generic_options
[];
...
...
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