MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / parse

Function parse

libavcodec/ffv1_parser.c:31–74  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29} FFV1ParseContext;
30
31static int parse(AVCodecParserContext *s,
32 AVCodecContext *avctx,
33 const uint8_t **poutbuf, int *poutbuf_size,
34 const uint8_t *buf, int buf_size)
35{
36 FFV1ParseContext *p = s->priv_data;
37 FFV1Context *f = &p->f;
38 RangeCoder c;
39 uint8_t keystate = 128;
40
41 *poutbuf = buf;
42 *poutbuf_size = buf_size;
43
44 if (!p->got_first) {
45 int ret = ff_ffv1_common_init(avctx, f);
46 p->got_first = 1;
47 if (ret < 0)
48 return buf_size;
49
50 if (avctx->extradata_size > 0 && (ret = ff_ffv1_read_extra_header(f)) < 0)
51 return buf_size;
52 }
53
54 ff_init_range_decoder(&c, buf, buf_size);
55 ff_build_rac_states(&c, 0.05 * (1LL << 32), 256 - 8);
56
57 f->avctx = avctx;
58 s->key_frame = get_rac(&c, &keystate);
59 s->pict_type = AV_PICTURE_TYPE_I;
60 s->field_order = AV_FIELD_UNKNOWN;
61 s->picture_structure = AV_PICTURE_STRUCTURE_UNKNOWN;
62
63 if (s->key_frame) {
64 uint8_t state[CONTEXT_SIZE];
65 memset(state, 128, sizeof(state));
66 ff_ffv1_parse_header(f, &c, state);
67 }
68
69 s->width = f->width;
70 s->height = f->height;
71 s->format = f->pix_fmt;
72
73 return buf_size;
74}
75
76static av_cold void ffv1_close(AVCodecParserContext *s)
77{

Callers

nothing calls this directly

Calls 6

ff_ffv1_common_initFunction · 0.85
ff_init_range_decoderFunction · 0.85
ff_build_rac_statesFunction · 0.85
get_racFunction · 0.85
ff_ffv1_parse_headerFunction · 0.85

Tested by

no test coverage detected