annotate bytestream.h @ 4354:d18568fb0187 libavcodec

Avoid calling decode_slice when context_initialized is not set. Avoids a crash due to dsp.clear_blocks being NULL when called.
author reimar
date Tue, 16 Jan 2007 17:46:26 +0000
parents d6f83e2f8804
children 05e932ddaaa9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4054
f20c7bb12103 change gif demuxer to gif decoder
bcoudurier
parents:
diff changeset
1 /*
f20c7bb12103 change gif demuxer to gif decoder
bcoudurier
parents:
diff changeset
2 * Bytestream functions
f20c7bb12103 change gif demuxer to gif decoder
bcoudurier
parents:
diff changeset
3 * copyright (c) 2006 Baptiste Coudurier <baptiste.coudurier@free.fr>
f20c7bb12103 change gif demuxer to gif decoder
bcoudurier
parents:
diff changeset
4 *
f20c7bb12103 change gif demuxer to gif decoder
bcoudurier
parents:
diff changeset
5 * This file is part of FFmpeg.
f20c7bb12103 change gif demuxer to gif decoder
bcoudurier
parents:
diff changeset
6 *
f20c7bb12103 change gif demuxer to gif decoder
bcoudurier
parents:
diff changeset
7 * FFmpeg is free software; you can redistribute it and/or
f20c7bb12103 change gif demuxer to gif decoder
bcoudurier
parents:
diff changeset
8 * modify it under the terms of the GNU Lesser General Public
f20c7bb12103 change gif demuxer to gif decoder
bcoudurier
parents:
diff changeset
9 * License as published by the Free Software Foundation; either
f20c7bb12103 change gif demuxer to gif decoder
bcoudurier
parents:
diff changeset
10 * version 2.1 of the License, or (at your option) any later version.
f20c7bb12103 change gif demuxer to gif decoder
bcoudurier
parents:
diff changeset
11 *
f20c7bb12103 change gif demuxer to gif decoder
bcoudurier
parents:
diff changeset
12 * FFmpeg is distributed in the hope that it will be useful,
f20c7bb12103 change gif demuxer to gif decoder
bcoudurier
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
f20c7bb12103 change gif demuxer to gif decoder
bcoudurier
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
f20c7bb12103 change gif demuxer to gif decoder
bcoudurier
parents:
diff changeset
15 * Lesser General Public License for more details.
f20c7bb12103 change gif demuxer to gif decoder
bcoudurier
parents:
diff changeset
16 *
f20c7bb12103 change gif demuxer to gif decoder
bcoudurier
parents:
diff changeset
17 * You should have received a copy of the GNU Lesser General Public
f20c7bb12103 change gif demuxer to gif decoder
bcoudurier
parents:
diff changeset
18 * License along with FFmpeg; if not, write to the Free Software
f20c7bb12103 change gif demuxer to gif decoder
bcoudurier
parents:
diff changeset
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
f20c7bb12103 change gif demuxer to gif decoder
bcoudurier
parents:
diff changeset
20 */
f20c7bb12103 change gif demuxer to gif decoder
bcoudurier
parents:
diff changeset
21
f20c7bb12103 change gif demuxer to gif decoder
bcoudurier
parents:
diff changeset
22 #ifndef FFMPEG_BYTESTREAM_H
f20c7bb12103 change gif demuxer to gif decoder
bcoudurier
parents:
diff changeset
23 #define FFMPEG_BYTESTREAM_H
f20c7bb12103 change gif demuxer to gif decoder
bcoudurier
parents:
diff changeset
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
f20c7bb12103 change gif demuxer to gif decoder
bcoudurier
parents:
diff changeset
26 {
f20c7bb12103 change gif demuxer to gif decoder
bcoudurier
parents:
diff changeset
27 (*b) += 4;
f20c7bb12103 change gif demuxer to gif decoder
bcoudurier
parents:
diff changeset
28 return LE_32(*b - 4);
f20c7bb12103 change gif demuxer to gif decoder
bcoudurier
parents:
diff changeset
29 }
f20c7bb12103 change gif demuxer to gif decoder
bcoudurier
parents:
diff changeset
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
f20c7bb12103 change gif demuxer to gif decoder
bcoudurier
parents:
diff changeset
32 {
f20c7bb12103 change gif demuxer to gif decoder
bcoudurier
parents:
diff changeset
33 (*b) += 2;
f20c7bb12103 change gif demuxer to gif decoder
bcoudurier
parents:
diff changeset
34 return LE_16(*b - 2);
f20c7bb12103 change gif demuxer to gif decoder
bcoudurier
parents:
diff changeset
35 }
f20c7bb12103 change gif demuxer to gif decoder
bcoudurier
parents:
diff changeset
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
f20c7bb12103 change gif demuxer to gif decoder
bcoudurier
parents:
diff changeset
38 {
f20c7bb12103 change gif demuxer to gif decoder
bcoudurier
parents:
diff changeset
39 (*b)++;
f20c7bb12103 change gif demuxer to gif decoder
bcoudurier
parents:
diff changeset
40 return (*b)[-1];
f20c7bb12103 change gif demuxer to gif decoder
bcoudurier
parents:
diff changeset
41 }
f20c7bb12103 change gif demuxer to gif decoder
bcoudurier
parents:
diff changeset
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
f20c7bb12103 change gif demuxer to gif decoder
bcoudurier
parents:
diff changeset
44 {
f20c7bb12103 change gif demuxer to gif decoder
bcoudurier
parents:
diff changeset
45 memcpy(dst, *b, size);
f20c7bb12103 change gif demuxer to gif decoder
bcoudurier
parents:
diff changeset
46 (*b) += size;
f20c7bb12103 change gif demuxer to gif decoder
bcoudurier
parents:
diff changeset
47 return size;
f20c7bb12103 change gif demuxer to gif decoder
bcoudurier
parents:
diff changeset
48 }
f20c7bb12103 change gif demuxer to gif decoder
bcoudurier
parents:
diff changeset
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
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents: 4054
diff changeset
65 {
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents: 4054
diff changeset
66 *(*b)++ = value;
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents: 4054
diff changeset
67 *(*b)++ = value >> 8;
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents: 4054
diff changeset
68 *(*b)++ = value >> 16;
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents: 4054
diff changeset
69 *(*b)++ = value >> 24;
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents: 4054
diff changeset
70 }
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents: 4054
diff changeset
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
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents: 4054
diff changeset
73 {
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents: 4054
diff changeset
74 *(*b)++ = value;
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents: 4054
diff changeset
75 *(*b)++ = value >> 8;
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents: 4054
diff changeset
76 }
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents: 4054
diff changeset
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
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents: 4054
diff changeset
79 {
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents: 4054
diff changeset
80 *(*b)++ = value;
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents: 4054
diff changeset
81 }
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents: 4054
diff changeset
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
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents: 4054
diff changeset
84 {
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents: 4054
diff changeset
85 memcpy(*b, src, size);
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents: 4054
diff changeset
86 (*b) += size;
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents: 4054
diff changeset
87 }
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents: 4054
diff changeset
88
4054
f20c7bb12103 change gif demuxer to gif decoder
bcoudurier
parents:
diff changeset
89 #endif /* FFMPEG_BYTESTREAM_H */