comparison bytestream.h @ 4054:f20c7bb12103 libavcodec

change gif demuxer to gif decoder
author bcoudurier
date Sun, 22 Oct 2006 15:05:03 +0000
parents
children f6f67a8bdd09
comparison
equal deleted inserted replaced
4053:fb4e436780fb 4054:f20c7bb12103
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
25 static always_inline unsigned int bytestream_get_le32(uint8_t **b)
26 {
27 (*b) += 4;
28 return LE_32(*b - 4);
29 }
30
31 static always_inline unsigned int bytestream_get_le16(uint8_t **b)
32 {
33 (*b) += 2;
34 return LE_16(*b - 2);
35 }
36
37 static always_inline unsigned int bytestream_get_byte(uint8_t **b)
38 {
39 (*b)++;
40 return (*b)[-1];
41 }
42
43 static always_inline unsigned int bytestream_get_buffer(uint8_t **b, uint8_t *dst, unsigned int size)
44 {
45 memcpy(dst, *b, size);
46 (*b) += size;
47 return size;
48 }
49
50 #endif /* FFMPEG_BYTESTREAM_H */