summaryrefslogtreecommitdiff
path: root/libavcodec/mpeg12enc.c
diff options
context:
space:
mode:
authorClément Bœsch <clement.boesch@smartjog.com>2011-07-06 14:55:06 +0200
committerClément Bœsch <ubitux@gmail.com>2011-08-10 16:00:32 +0200
commit51fb933dd0dda5f581d7489b32b8446767d33b97 (patch)
tree158d09eb2a5471973bb13332d2d45a47c793fdf5 /libavcodec/mpeg12enc.c
parent5231454560e972033ec773b350dfe0e1380a04ae (diff)
timecode: move dropframe code and doxycomment it.
This is based on the original work by Baptiste Coudurier.
Diffstat (limited to 'libavcodec/mpeg12enc.c')
-rw-r--r--libavcodec/mpeg12enc.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
index c9fa41b65d..b3ed3675a6 100644
--- a/libavcodec/mpeg12enc.c
+++ b/libavcodec/mpeg12enc.c
@@ -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);