Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
d8804905
Commit
d8804905
authored
Jan 16, 2012
by
Clément Bœsch
Committed by
Clément Bœsch
Feb 02, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mpeg12enc: use new public timecode API.
parent
f65600d5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
13 deletions
+17
-13
mpeg12enc.c
libavcodec/mpeg12enc.c
+14
-11
mpegvideo.h
libavcodec/mpegvideo.h
+3
-2
No files found.
libavcodec/mpeg12enc.c
View file @
d8804905
...
...
@@ -33,10 +33,10 @@
#include "mpeg12.h"
#include "mpeg12data.h"
#include "bytestream.h"
#include "timecode.h"
#include "libavutil/log.h"
#include "libavutil/opt.h"
#include "libavutil/avassert.h"
#include "libavutil/timecode.h"
static
const
uint8_t
inv_non_linear_qscale
[
13
]
=
{
0
,
2
,
4
,
6
,
8
,
...
...
@@ -167,17 +167,20 @@ static av_cold int encode_init(AVCodecContext *avctx)
}
}
s
->
drop_frame_timecode
=
s
->
tc
.
drop
=
s
->
drop_frame_timecode
||
!!
(
avctx
->
flags2
&
CODEC_FLAG2_DROP_FRAME_TIMECODE
);
s
->
drop_frame_timecode
=
s
->
drop_frame_timecode
||
!!
(
avctx
->
flags2
&
CODEC_FLAG2_DROP_FRAME_TIMECODE
);
if
(
s
->
drop_frame_timecode
)
s
->
tc
.
flags
|=
AV_TIMECODE_FLAG_DROPFRAME
;
if
(
s
->
drop_frame_timecode
&&
s
->
frame_rate_index
!=
4
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Drop frame time code only allowed with 1001/30000 fps
\n
"
);
return
-
1
;
}
if
(
s
->
tc
.
str
)
{
s
->
tc
.
rate
=
avpriv_frame_rate_tab
[
s
->
frame_rate_index
];
if
(
avpriv_init_smpte_timecode
(
s
,
&
s
->
tc
)
<
0
)
return
-
1
;
s
->
drop_frame_timecode
=
s
->
tc
.
drop
;
if
(
s
->
tc_opt_str
)
{
AVRational
rate
=
avpriv_frame_rate_tab
[
s
->
frame_rate_index
];
int
ret
=
av_timecode_init_from_string
(
&
s
->
tc
,
rate
,
s
->
tc_opt_str
,
s
);
if
(
ret
<
0
)
return
ret
;
s
->
drop_frame_timecode
=
!!
(
s
->
tc
.
flags
&
AV_TIMECODE_FLAG_DROPFRAME
);
s
->
avctx
->
timecode_frame_start
=
s
->
tc
.
start
;
}
else
{
s
->
avctx
->
timecode_frame_start
=
0
;
// default is -1
...
...
@@ -295,9 +298,9 @@ static void mpeg1_encode_sequence_header(MpegEncContext *s)
time_code
=
s
->
current_picture_ptr
->
f
.
coded_picture_number
+
s
->
avctx
->
timecode_frame_start
;
s
->
gop_picture_number
=
s
->
current_picture_ptr
->
f
.
coded_picture_number
;
av_assert0
(
s
->
drop_frame_timecode
==
s
->
tc
.
drop
);
if
(
s
->
tc
.
drop
)
time_code
=
av
priv_framenum_to_drop_timecode
(
time_code
);
av_assert0
(
s
->
drop_frame_timecode
==
!!
(
s
->
tc
.
flags
&
AV_TIMECODE_FLAG_DROPFRAME
)
);
if
(
s
->
drop_frame_timecode
)
time_code
=
av
_timecode_adjust_ntsc_framenum
(
time_code
);
put_bits
(
&
s
->
pb
,
5
,
(
uint32_t
)((
time_code
/
(
fps
*
3600
))
%
24
));
put_bits
(
&
s
->
pb
,
6
,
(
uint32_t
)((
time_code
/
(
fps
*
60
))
%
60
));
put_bits
(
&
s
->
pb
,
1
,
1
);
...
...
@@ -928,7 +931,7 @@ static void mpeg1_encode_block(MpegEncContext *s,
#define OFFSET(x) offsetof(MpegEncContext, x)
#define VE AV_OPT_FLAG_ENCODING_PARAM | AV_OPT_FLAG_VIDEO_PARAM
#define COMMON_OPTS\
{
TIMECODE_OPT(MpegEncContext,
\
{
AV_TIMECODE_OPTION(MpegEncContext, tc_opt_str,
\
AV_OPT_FLAG_ENCODING_PARAM | AV_OPT_FLAG_VIDEO_PARAM)},\
{ "intra_vlc", "Use MPEG-2 intra VLC table.", OFFSET(intra_vlc_format), AV_OPT_TYPE_INT, { 0 }, 0, 1, VE },\
{ "drop_frame_timecode", "Timecode is in drop frame format.", OFFSET(drop_frame_timecode), AV_OPT_TYPE_INT, { 0 }, 0, 1, VE}, \
...
...
libavcodec/mpegvideo.h
View file @
d8804905
...
...
@@ -36,7 +36,7 @@
#include "parser.h"
#include "mpeg12data.h"
#include "rl.h"
#include "timecode.h"
#include "
libavutil/
timecode.h"
#define FRAME_SKIPPED 100 ///< return value for header parsers if frame is not coded
...
...
@@ -649,7 +649,8 @@ typedef struct MpegEncContext {
/* RTP specific */
int
rtp_mode
;
struct
ff_timecode
tc
;
char
*
tc_opt_str
;
///< timecode option string
AVTimecode
tc
;
///< timecode context
uint8_t
*
ptr_lastgob
;
int
swap_uv
;
//vcr2 codec is an MPEG-2 variant with U and V swapped
...
...
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