Go to the documentation of this file.
   23 #ifndef AVCODEC_BYTESTREAM_H 
   24 #define AVCODEC_BYTESTREAM_H 
   42 #define DEF(type, name, bytes, read, write)                                  \ 
   43 static av_always_inline type bytestream_get_ ## name(const uint8_t **b)        \ 
   46     return read(*b - bytes);                                                   \ 
   48 static av_always_inline void bytestream_put_ ## name(uint8_t **b,              \ 
   54 static av_always_inline void bytestream2_put_ ## name ## u(PutByteContext *p,  \ 
   57     bytestream_put_ ## name(&p->buffer, value);                                \ 
   59 static av_always_inline void bytestream2_put_ ## name(PutByteContext *p,       \ 
   62     if (!p->eof && (p->buffer_end - p->buffer >= bytes)) {                     \ 
   63         write(p->buffer, value);                                               \ 
   68 static av_always_inline type bytestream2_get_ ## name ## u(GetByteContext *g)  \ 
   70     return bytestream_get_ ## name(&g->buffer);                                \ 
   72 static av_always_inline type bytestream2_get_ ## name(GetByteContext *g)       \ 
   74     if (g->buffer_end - g->buffer < bytes) {                                   \ 
   75         g->buffer = g->buffer_end;                                             \ 
   78     return bytestream2_get_ ## name ## u(g);                                   \ 
   80 static av_always_inline type bytestream2_peek_ ## name(GetByteContext *g)      \ 
   82     if (g->buffer_end - g->buffer < bytes)                                     \ 
   84     return read(g->buffer);                                                    \ 
   98 #   define bytestream2_get_ne16  bytestream2_get_be16 
   99 #   define bytestream2_get_ne24  bytestream2_get_be24 
  100 #   define bytestream2_get_ne32  bytestream2_get_be32 
  101 #   define bytestream2_get_ne64  bytestream2_get_be64 
  102 #   define bytestream2_get_ne16u bytestream2_get_be16u 
  103 #   define bytestream2_get_ne24u bytestream2_get_be24u 
  104 #   define bytestream2_get_ne32u bytestream2_get_be32u 
  105 #   define bytestream2_get_ne64u bytestream2_get_be64u 
  106 #   define bytestream2_put_ne16  bytestream2_put_be16 
  107 #   define bytestream2_put_ne24  bytestream2_put_be24 
  108 #   define bytestream2_put_ne32  bytestream2_put_be32 
  109 #   define bytestream2_put_ne64  bytestream2_put_be64 
  110 #   define bytestream2_peek_ne16 bytestream2_peek_be16 
  111 #   define bytestream2_peek_ne24 bytestream2_peek_be24 
  112 #   define bytestream2_peek_ne32 bytestream2_peek_be32 
  113 #   define bytestream2_peek_ne64 bytestream2_peek_be64 
  115 #   define bytestream2_get_ne16  bytestream2_get_le16 
  116 #   define bytestream2_get_ne24  bytestream2_get_le24 
  117 #   define bytestream2_get_ne32  bytestream2_get_le32 
  118 #   define bytestream2_get_ne64  bytestream2_get_le64 
  119 #   define bytestream2_get_ne16u bytestream2_get_le16u 
  120 #   define bytestream2_get_ne24u bytestream2_get_le24u 
  121 #   define bytestream2_get_ne32u bytestream2_get_le32u 
  122 #   define bytestream2_get_ne64u bytestream2_get_le64u 
  123 #   define bytestream2_put_ne16  bytestream2_put_le16 
  124 #   define bytestream2_put_ne24  bytestream2_put_le24 
  125 #   define bytestream2_put_ne32  bytestream2_put_le32 
  126 #   define bytestream2_put_ne64  bytestream2_put_le64 
  127 #   define bytestream2_peek_ne16 bytestream2_peek_le16 
  128 #   define bytestream2_peek_ne24 bytestream2_peek_le24 
  129 #   define bytestream2_peek_ne32 bytestream2_peek_le32 
  130 #   define bytestream2_peek_ne64 bytestream2_peek_le64 
  139     g->buffer_start = 
buf;
 
  140     g->buffer_end   = 
buf + buf_size;
 
  156     return g->buffer_end - 
g->buffer;
 
  190     return (
int)(
g->buffer - 
g->buffer_start);
 
  200     return (
int)(
g->buffer_end - 
g->buffer_start);
 
  215                              g->buffer_end - 
g->buffer);
 
  224         g->buffer = 
g->buffer_start + 
offset;
 
  267     int size2 = 
FFMIN(
g->buffer_end - 
g->buffer, 
size);
 
  268     memcpy(dst, 
g->buffer, size2);
 
  277     memcpy(dst, 
g->buffer, 
size);
 
  363     memcpy(dst, *
b, 
size);
 
  
uint64_t_TMPL AV_WL64 unsigned int_TMPL le32
static av_always_inline unsigned int bytestream2_get_eof(PutByteContext *p)
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
const uint8_t * buffer_start
static av_always_inline void bytestream2_skipu(GetByteContext *g, unsigned int size)
static av_always_inline int bytestream2_seek(GetByteContext *g, int offset, int whence)
static av_always_inline int bytestream2_tell_p(PutByteContext *p)
static av_always_inline int bytestream2_size_p(PutByteContext *p)
static av_always_inline unsigned int bytestream2_get_bytes_left_p(PutByteContext *p)
static av_always_inline unsigned int bytestream2_get_bytes_left(GetByteContext *g)
static av_always_inline void bytestream2_skip(GetByteContext *g, unsigned int size)
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_WB32 unsigned int_TMPL be24
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL le24
static av_always_inline void bytestream2_init_writer(PutByteContext *p, uint8_t *buf, int buf_size)
static av_always_inline unsigned int bytestream2_put_buffer(PutByteContext *p, const uint8_t *src, unsigned int size)
#define av_assert0(cond)
assert() equivalent, that is always enabled.
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_RL16
static av_always_inline unsigned int bytestream2_copy_bufferu(PutByteContext *p, GetByteContext *g, unsigned int size)
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL be64
static av_always_inline unsigned int bytestream2_get_buffer(GetByteContext *g, uint8_t *dst, unsigned int size)
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL be32
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
static av_always_inline int bytestream2_tell(GetByteContext *g)
static av_always_inline int bytestream2_size(GetByteContext *g)
#define DEF(type, name, bytes, read, write)
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_RB32
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_RL24
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf offset
static av_always_inline void bytestream_put_buffer(uint8_t **b, const uint8_t *src, unsigned int size)
static av_always_inline void bytestream2_skip_p(PutByteContext *p, unsigned int size)
static av_always_inline void bytestream2_set_bufferu(PutByteContext *p, const uint8_t c, unsigned int size)
static av_always_inline void bytestream2_set_buffer(PutByteContext *p, const uint8_t c, unsigned int size)
const uint8_t * buffer_end
static av_always_inline unsigned int bytestream_get_buffer(const uint8_t **b, uint8_t *dst, unsigned int size)
static av_always_inline unsigned int bytestream2_copy_buffer(PutByteContext *p, GetByteContext *g, unsigned int size)
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_WB32 unsigned int_TMPL AV_WB24 unsigned int_TMPL be16
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL le16
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
static av_always_inline int bytestream2_seek_p(PutByteContext *p, int offset, int whence)
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_WB32 unsigned int_TMPL AV_WB24 unsigned int_TMPL AV_WB16 unsigned int_TMPL AV_RB8
static av_always_inline unsigned int bytestream2_get_bufferu(GetByteContext *g, uint8_t *dst, unsigned int size)
static av_always_inline unsigned int bytestream2_put_bufferu(PutByteContext *p, const uint8_t *src, unsigned int size)
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_WB32 unsigned int_TMPL AV_RB24
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_RB64
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_WB32 unsigned int_TMPL AV_WB24 unsigned int_TMPL AV_RB16