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
51fb933d
Commit
51fb933d
authored
Jul 06, 2011
by
Clément Bœsch
Committed by
Clément Bœsch
Aug 10, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
timecode: move dropframe code and doxycomment it.
This is based on the original work by Baptiste Coudurier.
parent
52314545
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
7 deletions
+19
-7
mpeg12enc.c
libavcodec/mpeg12enc.c
+2
-7
timecode.c
libavcodec/timecode.c
+9
-0
timecode.h
libavcodec/timecode.h
+8
-0
No files found.
libavcodec/mpeg12enc.c
View file @
51fb933d
...
...
@@ -299,13 +299,8 @@ 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
;
if
(
s
->
tc
.
drop
)
{
/* only works for NTSC 29.97 */
int
d
=
time_code
/
17982
;
int
m
=
time_code
%
17982
;
//if (m < 2) m += 2; /* not needed since -2,-1 / 1798 in C returns 0 */
time_code
+=
18
*
d
+
2
*
((
m
-
2
)
/
1798
);
}
if
(
s
->
tc
.
drop
)
time_code
=
ff_framenum_to_drop_timecode
(
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
);
...
...
libavcodec/timecode.c
View file @
51fb933d
...
...
@@ -28,6 +28,15 @@
#include "timecode.h"
#include "libavutil/log.h"
int
ff_framenum_to_drop_timecode
(
int
frame_num
)
{
/* only works for NTSC 29.97 */
int
d
=
frame_num
/
17982
;
int
m
=
frame_num
%
17982
;
//if (m < 2) m += 2; /* not needed since -2,-1 / 1798 in C returns 0 */
return
frame_num
+
18
*
d
+
2
*
((
m
-
2
)
/
1798
);
}
int
ff_init_smtpe_timecode
(
void
*
avcl
,
struct
ff_timecode
*
tc
)
{
int
hh
,
mm
,
ss
,
ff
,
fps
;
...
...
libavcodec/timecode.h
View file @
51fb933d
...
...
@@ -43,6 +43,14 @@ struct ff_timecode {
AVRational
rate
;
///< Frame rate in rationnal form
};
/**
* @brief Adjust frame number for NTSC drop frame time code
* @param frame_num Actual frame number to adjust
* @return Adjusted frame number
* @warning Adjustment is only valid in NTSC 29.97
*/
int
ff_framenum_to_drop_timecode
(
int
frame_num
);
/**
* Parse SMTPE 12M time representation (hh:mm:ss[:;.]ff). str and rate fields
* from tc struct must be set.
...
...
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