[Ffmpeg-cvslog] CVS: ffmpeg/libavformat movenc.c,1.71,1.72
Michael Niedermayer CVS
michael
Sat May 13 20:45:32 CEST 2006
Update of /cvsroot/ffmpeg/ffmpeg/libavformat
In directory mail:/var2/tmp/cvs-serv22462
Modified Files:
movenc.c
Log Message:
simplify
Index: movenc.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/movenc.c,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -d -r1.71 -r1.72
--- movenc.c 13 May 2006 18:01:16 -0000 1.71
+++ movenc.c 13 May 2006 18:45:29 -0000 1.72
@@ -226,54 +226,18 @@
static unsigned int descrLength(unsigned int len)
{
- if (len < 0x00000080)
- return 2 + len;
- else if (len < 0x00004000)
- return 3 + len;
- else if(len < 0x00200000)
- return 4 + len;
- else
- return 5 + len;
+ int i;
+ for(i=1; len>>(7*i); i++);
+ return len + 1 + i;
}
-static void putDescr(ByteIOContext *pb, int tag, int size)
+static void putDescr(ByteIOContext *pb, int tag, unsigned int size)
{
- uint32_t len;
- uint8_t vals[4];
-
- len = size;
- vals[3] = (uint8_t)(len & 0x7f);
- len >>= 7;
- vals[2] = (uint8_t)((len & 0x7f) | 0x80);
- len >>= 7;
- vals[1] = (uint8_t)((len & 0x7f) | 0x80);
- len >>= 7;
- vals[0] = (uint8_t)((len & 0x7f) | 0x80);
-
- put_byte(pb, tag); // DescriptorTag
-
- if (size < 0x00000080)
- {
- put_byte(pb, vals[3]);
- }
- else if (size < 0x00004000)
- {
- put_byte(pb, vals[2]);
- put_byte(pb, vals[3]);
- }
- else if (size < 0x00200000)
- {
- put_byte(pb, vals[1]);
- put_byte(pb, vals[2]);
- put_byte(pb, vals[3]);
- }
- else if (size < 0x10000000)
- {
- put_byte(pb, vals[0]);
- put_byte(pb, vals[1]);
- put_byte(pb, vals[2]);
- put_byte(pb, vals[3]);
- }
+ int i= descrLength(size) - size - 2;
+ put_byte(pb, tag);
+ for(; i>0; i--)
+ put_byte(pb, (size>>(7*i)) | 0x80);
+ put_byte(pb, size & 0x7F);
}
static int mov_write_esds_tag(ByteIOContext *pb, MOVTrack* track) // Basic
More information about the ffmpeg-cvslog
mailing list