changeset 4224:bb346dbc0958 libavformat

return size written in ff_avc_parse_nal_units
author bcoudurier
date Fri, 16 Jan 2009 01:11:34 +0000
parents 8f2cb573b5b0
children 0231b1d5cd15
files avc.c avc.h
diffstat 2 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/avc.c	Thu Jan 15 14:07:59 2009 +0000
+++ b/avc.c	Fri Jan 16 01:11:34 2009 +0000
@@ -60,20 +60,23 @@
     return end + 3;
 }
 
-void ff_avc_parse_nal_units(ByteIOContext *pb, const uint8_t *buf_in, int size)
+int ff_avc_parse_nal_units(ByteIOContext *pb, const uint8_t *buf_in, int size)
 {
     const uint8_t *p = buf_in;
     const uint8_t *end = p + size;
     const uint8_t *nal_start, *nal_end;
 
+    size = 0;
     nal_start = ff_avc_find_startcode(p, end);
     while (nal_start < end) {
         while(!*(nal_start++));
         nal_end = ff_avc_find_startcode(nal_start, end);
         put_be32(pb, nal_end - nal_start);
         put_buffer(pb, nal_start, nal_end - nal_start);
+        size += 4 + nal_end - nal_start;
         nal_start = nal_end;
     }
+    return size;
 }
 
 static int ff_avc_parse_nal_units_buf(const uint8_t *buf_in, uint8_t **buf, int *size)
--- a/avc.h	Thu Jan 15 14:07:59 2009 +0000
+++ b/avc.h	Fri Jan 16 01:11:34 2009 +0000
@@ -25,7 +25,7 @@
 #include <stdint.h>
 #include "avio.h"
 
-void ff_avc_parse_nal_units(ByteIOContext *s, const uint8_t *buf, int size);
+int ff_avc_parse_nal_units(const uint8_t *buf_in, uint8_t **buf, int *size);
 int ff_isom_write_avcc(ByteIOContext *pb, const uint8_t *data, int len);
 const uint8_t *ff_avc_find_startcode(const uint8_t *p, const uint8_t *end);