Mercurial > libavcodec.hg
annotate bytestream.h @ 4364:05e932ddaaa9 libavcodec
rename BE/LE_8/16/32 to AV_RL/B_8/16/32
| author | alex |
|---|---|
| date | Fri, 19 Jan 2007 22:12:59 +0000 |
| parents | d6f83e2f8804 |
| children | 601865b7fc26 |
| rev | line source |
|---|---|
| 4054 | 1 /* |
| 2 * Bytestream functions | |
| 3 * copyright (c) 2006 Baptiste Coudurier <baptiste.coudurier@free.fr> | |
| 4 * | |
| 5 * This file is part of FFmpeg. | |
| 6 * | |
| 7 * FFmpeg is free software; you can redistribute it and/or | |
| 8 * modify it under the terms of the GNU Lesser General Public | |
| 9 * License as published by the Free Software Foundation; either | |
| 10 * version 2.1 of the License, or (at your option) any later version. | |
| 11 * | |
| 12 * FFmpeg is distributed in the hope that it will be useful, | |
| 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 15 * Lesser General Public License for more details. | |
| 16 * | |
| 17 * You should have received a copy of the GNU Lesser General Public | |
| 18 * License along with FFmpeg; if not, write to the Free Software | |
| 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
| 20 */ | |
| 21 | |
| 22 #ifndef FFMPEG_BYTESTREAM_H | |
| 23 #define FFMPEG_BYTESTREAM_H | |
| 24 | |
|
4283
d6f83e2f8804
rename always_inline to av_always_inline and move to common.h
mru
parents:
4251
diff
changeset
|
25 static av_always_inline unsigned int bytestream_get_le32(uint8_t **b) |
| 4054 | 26 { |
| 27 (*b) += 4; | |
| 4364 | 28 return AV_RL32(*b - 4); |
| 4054 | 29 } |
| 30 | |
|
4283
d6f83e2f8804
rename always_inline to av_always_inline and move to common.h
mru
parents:
4251
diff
changeset
|
31 static av_always_inline unsigned int bytestream_get_le16(uint8_t **b) |
| 4054 | 32 { |
| 33 (*b) += 2; | |
| 4364 | 34 return AV_RL16(*b - 2); |
| 4054 | 35 } |
| 36 | |
|
4283
d6f83e2f8804
rename always_inline to av_always_inline and move to common.h
mru
parents:
4251
diff
changeset
|
37 static av_always_inline unsigned int bytestream_get_byte(uint8_t **b) |
| 4054 | 38 { |
| 39 (*b)++; | |
| 40 return (*b)[-1]; | |
| 41 } | |
| 42 | |
|
4283
d6f83e2f8804
rename always_inline to av_always_inline and move to common.h
mru
parents:
4251
diff
changeset
|
43 static av_always_inline unsigned int bytestream_get_buffer(uint8_t **b, uint8_t *dst, unsigned int size) |
| 4054 | 44 { |
| 45 memcpy(dst, *b, size); | |
| 46 (*b) += size; | |
| 47 return size; | |
| 48 } | |
| 49 | |
|
4283
d6f83e2f8804
rename always_inline to av_always_inline and move to common.h
mru
parents:
4251
diff
changeset
|
50 static av_always_inline void bytestream_put_be32(uint8_t **b, const unsigned int value) |
|
4251
b0d38ef4b547
add bytestream big endian 16/32 writing functions
bcoudurier
parents:
4125
diff
changeset
|
51 { |
|
b0d38ef4b547
add bytestream big endian 16/32 writing functions
bcoudurier
parents:
4125
diff
changeset
|
52 *(*b)++ = value >> 24; |
|
b0d38ef4b547
add bytestream big endian 16/32 writing functions
bcoudurier
parents:
4125
diff
changeset
|
53 *(*b)++ = value >> 16; |
|
b0d38ef4b547
add bytestream big endian 16/32 writing functions
bcoudurier
parents:
4125
diff
changeset
|
54 *(*b)++ = value >> 8; |
|
b0d38ef4b547
add bytestream big endian 16/32 writing functions
bcoudurier
parents:
4125
diff
changeset
|
55 *(*b)++ = value; |
|
b0d38ef4b547
add bytestream big endian 16/32 writing functions
bcoudurier
parents:
4125
diff
changeset
|
56 }; |
|
b0d38ef4b547
add bytestream big endian 16/32 writing functions
bcoudurier
parents:
4125
diff
changeset
|
57 |
|
4283
d6f83e2f8804
rename always_inline to av_always_inline and move to common.h
mru
parents:
4251
diff
changeset
|
58 static av_always_inline void bytestream_put_be16(uint8_t **b, const unsigned int value) |
|
4251
b0d38ef4b547
add bytestream big endian 16/32 writing functions
bcoudurier
parents:
4125
diff
changeset
|
59 { |
|
b0d38ef4b547
add bytestream big endian 16/32 writing functions
bcoudurier
parents:
4125
diff
changeset
|
60 *(*b)++ = value >> 8; |
|
b0d38ef4b547
add bytestream big endian 16/32 writing functions
bcoudurier
parents:
4125
diff
changeset
|
61 *(*b)++ = value; |
|
b0d38ef4b547
add bytestream big endian 16/32 writing functions
bcoudurier
parents:
4125
diff
changeset
|
62 } |
|
b0d38ef4b547
add bytestream big endian 16/32 writing functions
bcoudurier
parents:
4125
diff
changeset
|
63 |
|
4283
d6f83e2f8804
rename always_inline to av_always_inline and move to common.h
mru
parents:
4251
diff
changeset
|
64 static av_always_inline void bytestream_put_le32(uint8_t **b, const unsigned int value) |
| 4125 | 65 { |
| 66 *(*b)++ = value; | |
| 67 *(*b)++ = value >> 8; | |
| 68 *(*b)++ = value >> 16; | |
| 69 *(*b)++ = value >> 24; | |
| 70 } | |
| 71 | |
|
4283
d6f83e2f8804
rename always_inline to av_always_inline and move to common.h
mru
parents:
4251
diff
changeset
|
72 static av_always_inline void bytestream_put_le16(uint8_t **b, const unsigned int value) |
| 4125 | 73 { |
| 74 *(*b)++ = value; | |
| 75 *(*b)++ = value >> 8; | |
| 76 } | |
| 77 | |
|
4283
d6f83e2f8804
rename always_inline to av_always_inline and move to common.h
mru
parents:
4251
diff
changeset
|
78 static av_always_inline void bytestream_put_byte(uint8_t **b, const unsigned int value) |
| 4125 | 79 { |
| 80 *(*b)++ = value; | |
| 81 } | |
| 82 | |
|
4283
d6f83e2f8804
rename always_inline to av_always_inline and move to common.h
mru
parents:
4251
diff
changeset
|
83 static av_always_inline void bytestream_put_buffer(uint8_t **b, const uint8_t *src, unsigned int size) |
| 4125 | 84 { |
| 85 memcpy(*b, src, size); | |
| 86 (*b) += size; | |
| 87 } | |
| 88 | |
| 4054 | 89 #endif /* FFMPEG_BYTESTREAM_H */ |
