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

Function gsm_parse

libavcodec/gsm_parser.c:40–85  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38} GSMParseContext;
39
40static int gsm_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
41 const uint8_t **poutbuf, int *poutbuf_size,
42 const uint8_t *buf, int buf_size)
43{
44 GSMParseContext *s = s1->priv_data;
45 ParseContext *pc = &s->pc;
46 int next;
47
48 if (!s->block_size) {
49 switch (avctx->codec_id) {
50 case AV_CODEC_ID_GSM:
51 s->block_size = GSM_BLOCK_SIZE;
52 s->duration = GSM_FRAME_SIZE;
53 break;
54 case AV_CODEC_ID_GSM_MS:
55 s->block_size = avctx->block_align ? avctx->block_align
56 : GSM_MS_BLOCK_SIZE;
57 s->duration = GSM_FRAME_SIZE * 2;
58 break;
59 default:
60 av_assert0(0);
61 }
62 }
63
64 if (!s->remaining)
65 s->remaining = s->block_size;
66 if (s->remaining <= buf_size) {
67 next = s->remaining;
68 s->remaining = 0;
69 } else {
70 next = END_NOT_FOUND;
71 s->remaining -= buf_size;
72 }
73
74 if (ff_combine_frame(pc, next, &buf, &buf_size) < 0 || !buf_size) {
75 *poutbuf = NULL;
76 *poutbuf_size = 0;
77 return buf_size;
78 }
79
80 s1->duration = s->duration;
81
82 *poutbuf = buf;
83 *poutbuf_size = buf_size;
84 return next;
85}
86
87const FFCodecParser ff_gsm_parser = {
88 PARSER_CODEC_LIST(AV_CODEC_ID_GSM, AV_CODEC_ID_GSM_MS),

Callers

nothing calls this directly

Calls 1

ff_combine_frameFunction · 0.85

Tested by

no test coverage detected