changeset 4276:d9c25a41b461 libavformat

fix endianness of time code, and calculate it in fields, according to specs
author bcoudurier
date Fri, 23 Jan 2009 20:03:57 +0000
parents 83918d72fa7d
children a5e558f1a64f
files gxfenc.c
diffstat 1 files changed, 4 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/gxfenc.c	Fri Jan 23 12:17:40 2009 +0000
+++ b/gxfenc.c	Fri Jan 23 20:03:57 2009 +0000
@@ -361,13 +361,11 @@
 static int gxf_write_umf_material_description(ByteIOContext *pb, GXFContext *ctx)
 {
     // XXX drop frame
-    int fps = ctx->sample_rate / 2;
-    int frames = ctx->nb_frames / 2;
     uint32_t timecode =
-        frames % fps             << 24 | // frames
-        frames / fps % 60        << 16 | // seconds
-        frames / fps * 60 % 60   <<  8 | // minutes
-        frames / fps * 3600 % 24 <<  3;  // hours
+        ctx->nb_frames / ctx->sample_rate * 3600 % 24 << 27 | // hours
+        ctx->nb_frames / ctx->sample_rate * 60 % 60   << 16 | // minutes
+        ctx->nb_frames / ctx->sample_rate % 60        <<  8 | // seconds
+        ctx->nb_frames % ctx->sample_rate;                    // fields
 
     put_le32(pb, ctx->flags);
     put_le32(pb, ctx->nb_frames); /* length of the longest track */