[FFmpeg-devel] [PATCH] move put_v from nutenc.c and make it public in avio.h and aviobuf.c

Michael Chinen mchinen
Thu Jul 1 00:59:34 CEST 2010


On Wed, Jun 30, 2010 at 1:09 PM, Michael Chinen <mchinen at gmail.com> wrote:
> Hi,
> I want to use put_v in utils.c, but it is a private function in
> nutenc.c. ?Seems like it should be moved to avio.h and made public
> with the other ByteIOContext put* funcs.
> I recently committed this to soc but learned it should be put in the devel ML.

modifying patch because updating svn has caused a conflict due to
documentation fixes.  Now against rev 23915.

Index: libavformat/avio.h
===================================================================
--- libavformat/avio.h	(revision 23915)
+++ libavformat/avio.h	(working copy)
@@ -348,8 +348,12 @@
 void put_tag(ByteIOContext *s, const char *tag);

 void put_strz(ByteIOContext *s, const char *buf);
-
+void put_v(ByteIOContext *bc, uint64_t val);
 /**
+ * Get the length in bytes which is needed to store val as v.
+ */
+int get_length(uint64_t val);
+/**
  * fseek() equivalent for ByteIOContext.
  * @return new position or AVERROR.
  */
Index: libavformat/aviobuf.c
===================================================================
--- libavformat/aviobuf.c	(revision 23915)
+++ libavformat/aviobuf.c	(working copy)
@@ -284,6 +284,27 @@
     put_byte(s, val);
 }

+/**
+ * Get the length in bytes which is needed to store val as v.
+ */
+int get_length(uint64_t val){
+    int i=1;
+
+    while(val>>=7)
+        i++;
+
+    return i;
+}
+
+void put_v(ByteIOContext *bc, uint64_t val){
+    int i= get_length(val);
+
+    while(--i>0)
+        put_byte(bc, 128 | (val>>(7*i)));
+
+    put_byte(bc, val&127);
+}
+
 void put_tag(ByteIOContext *s, const char *tag)
 {
     while (*tag) {
Index: libavformat/nutenc.c
===================================================================
--- libavformat/nutenc.c	(revision 23915)
+++ libavformat/nutenc.c	(working copy)
@@ -241,27 +241,6 @@
     nut->frame_code['N'].flags= FLAG_INVALID;
 }

-/**
- * Get the length in bytes which is needed to store val as v.
- */
-static int get_length(uint64_t val){
-    int i=1;
-
-    while(val>>=7)
-        i++;
-
-    return i;
-}
-
-static void put_v(ByteIOContext *bc, uint64_t val){
-    int i= get_length(val);
-
-    while(--i>0)
-        put_byte(bc, 128 | (val>>(7*i)));
-
-    put_byte(bc, val&127);
-}
-
 static void put_tt(NUTContext *nut, StreamContext *nus, ByteIOContext
*bc, uint64_t val){
     val *= nut->time_base_count;
     val += nus->time_base - nut->time_base;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: moving_put_v_r23915.patch
Type: application/octet-stream
Size: 1971 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100701/ef392bb2/attachment.obj>



More information about the ffmpeg-devel mailing list