Originally committed as revision 12145 to svn://svn.ffmpeg.org/ffmpeg/trunk
Michael Niedermayer authored on 2008/02/20 01:08:52... | ... |
@@ -21,9 +21,9 @@ |
21 | 21 |
#include "avformat.h" |
22 | 22 |
#include "avio.h" |
23 | 23 |
|
24 |
-uint8_t *ff_avc_find_startcode(uint8_t *p, uint8_t *end) |
|
24 |
+const uint8_t *ff_avc_find_startcode(const uint8_t *p, const uint8_t *end) |
|
25 | 25 |
{ |
26 |
- uint8_t *a = p + 4 - ((long)p & 3); |
|
26 |
+ const uint8_t *a = p + 4 - ((long)p & 3); |
|
27 | 27 |
|
28 | 28 |
for( end -= 3; p < a && p < end; p++ ) { |
29 | 29 |
if( p[0] == 0 && p[1] == 0 && p[2] == 1 ) |
... | ... |
@@ -31,7 +31,7 @@ uint8_t *ff_avc_find_startcode(uint8_t *p, uint8_t *end) |
31 | 31 |
} |
32 | 32 |
|
33 | 33 |
for( end -= 3; p < end; p += 4 ) { |
34 |
- uint32_t x = *(uint32_t*)p; |
|
34 |
+ const uint32_t x = *(uint32_t*)p; |
|
35 | 35 |
// if( (x - 0x01000100) & (~x) & 0x80008000 ) // little endian |
36 | 36 |
// if( (x - 0x00010001) & (~x) & 0x00800080 ) // big endian |
37 | 37 |
if( (x - 0x01010101) & (~x) & 0x80808080 ) { // generic |
... | ... |
@@ -58,12 +58,12 @@ uint8_t *ff_avc_find_startcode(uint8_t *p, uint8_t *end) |
58 | 58 |
return end + 3; |
59 | 59 |
} |
60 | 60 |
|
61 |
-int ff_avc_parse_nal_units(uint8_t *buf_in, uint8_t **buf, int *size) |
|
61 |
+int ff_avc_parse_nal_units(const uint8_t *buf_in, uint8_t **buf, int *size) |
|
62 | 62 |
{ |
63 | 63 |
ByteIOContext *pb; |
64 |
- uint8_t *p = buf_in; |
|
65 |
- uint8_t *end = p + *size; |
|
66 |
- uint8_t *nal_start, *nal_end; |
|
64 |
+ const uint8_t *p = buf_in; |
|
65 |
+ const uint8_t *end = p + *size; |
|
66 |
+ const uint8_t *nal_start, *nal_end; |
|
67 | 67 |
int ret = url_open_dyn_buf(&pb); |
68 | 68 |
if(ret < 0) |
69 | 69 |
return ret; |
... | ... |
@@ -81,19 +81,19 @@ int ff_avc_parse_nal_units(uint8_t *buf_in, uint8_t **buf, int *size) |
81 | 81 |
return 0; |
82 | 82 |
} |
83 | 83 |
|
84 |
-int ff_isom_write_avcc(ByteIOContext *pb, uint8_t *data, int len) |
|
84 |
+int ff_isom_write_avcc(ByteIOContext *pb, const uint8_t *data, int len) |
|
85 | 85 |
{ |
86 | 86 |
if (len > 6) { |
87 | 87 |
/* check for h264 start code */ |
88 | 88 |
if (AV_RB32(data) == 0x00000001) { |
89 |
- uint8_t *buf=NULL, *end; |
|
89 |
+ uint8_t *buf=NULL, *end, *start; |
|
90 | 90 |
uint32_t sps_size=0, pps_size=0; |
91 | 91 |
uint8_t *sps=0, *pps=0; |
92 | 92 |
|
93 | 93 |
int ret = ff_avc_parse_nal_units(data, &buf, &len); |
94 | 94 |
if (ret < 0) |
95 | 95 |
return ret; |
96 |
- data = buf; |
|
96 |
+ start = buf; |
|
97 | 97 |
end = buf + len; |
98 | 98 |
|
99 | 99 |
/* look for sps and pps */ |
... | ... |
@@ -126,7 +126,7 @@ int ff_isom_write_avcc(ByteIOContext *pb, uint8_t *data, int len) |
126 | 126 |
put_byte(pb, 1); /* number of pps */ |
127 | 127 |
put_be16(pb, pps_size); |
128 | 128 |
put_buffer(pb, pps, pps_size); |
129 |
- av_free(data); |
|
129 |
+ av_free(start); |
|
130 | 130 |
} else { |
131 | 131 |
put_buffer(pb, data, len); |
132 | 132 |
} |
... | ... |
@@ -25,8 +25,8 @@ |
25 | 25 |
#include <stdint.h> |
26 | 26 |
#include "avio.h" |
27 | 27 |
|
28 |
-int ff_avc_parse_nal_units(uint8_t *buf_in, uint8_t **buf, int *size); |
|
29 |
-int ff_isom_write_avcc(ByteIOContext *pb, uint8_t *data, int len); |
|
30 |
-uint8_t *ff_avc_find_startcode(uint8_t *p, uint8_t *end); |
|
28 |
+int ff_avc_parse_nal_units(const uint8_t *buf_in, uint8_t **buf, int *size); |
|
29 |
+int ff_isom_write_avcc(ByteIOContext *pb, const uint8_t *data, int len); |
|
30 |
+const uint8_t *ff_avc_find_startcode(const uint8_t *p, const uint8_t *end); |
|
31 | 31 |
|
32 | 32 |
#endif /* AVC_H */ |