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

Function ffio_init_context

libavformat/aviobuf.c:50–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48static int set_buf_size(AVIOContext *s, int buf_size);
49
50void ffio_init_context(FFIOContext *ctx,
51 unsigned char *buffer,
52 int buffer_size,
53 int write_flag,
54 void *opaque,
55 int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
56 int (*write_packet)(void *opaque, const uint8_t *buf, int buf_size),
57 int64_t (*seek)(void *opaque, int64_t offset, int whence))
58{
59 AVIOContext *const s = &ctx->pub;
60
61 memset(ctx, 0, sizeof(*ctx));
62
63 s->buffer = buffer;
64 ctx->orig_buffer_size =
65 s->buffer_size = buffer_size;
66 s->buf_ptr = buffer;
67 s->buf_ptr_max = buffer;
68 s->opaque = opaque;
69 s->direct = 0;
70
71 url_resetbuf(s, write_flag ? AVIO_FLAG_WRITE : AVIO_FLAG_READ);
72
73 s->write_packet = write_packet;
74 s->read_packet = read_packet;
75 s->seek = seek;
76 s->pos = 0;
77 s->eof_reached = 0;
78 s->error = 0;
79 s->seekable = seek ? AVIO_SEEKABLE_NORMAL : 0;
80 s->min_packet_size = 0;
81 s->max_packet_size = 0;
82 s->update_checksum = NULL;
83 ctx->short_seek_threshold = SHORT_SEEK_THRESHOLD;
84
85 if (!read_packet && !write_flag) {
86 s->pos = buffer_size;
87 s->buf_end = s->buffer + buffer_size;
88 }
89 s->read_pause = NULL;
90 s->read_seek = NULL;
91
92 s->write_data_type = NULL;
93 s->ignore_boundary_point = 0;
94 ctx->current_type = AVIO_DATA_MARKER_UNKNOWN;
95 ctx->last_time = AV_NOPTS_VALUE;
96 ctx->short_seek_get = NULL;
97}
98
99void ffio_init_read_context(FFIOContext *s, const uint8_t *buffer, int buffer_size)
100{

Callers 14

codec_config_obuFunction · 0.85
audio_element_obuFunction · 0.85
mix_presentation_obuFunction · 0.85
dvdvideo_subdemux_openFunction · 0.85
ffio_init_read_contextFunction · 0.85
ffio_init_write_contextFunction · 0.85
avio_alloc_contextFunction · 0.85
ffio_reset_dyn_bufFunction · 0.85
parameter_block_obuFunction · 0.85
init_packetizerFunction · 0.85

Calls 1

url_resetbufFunction · 0.85

Tested by

no test coverage detected