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

Function av_parser_init

libavcodec/parser.c:36–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34
35#if FF_API_PARSER_CODECID
36av_cold AVCodecParserContext *av_parser_init(int codec_id)
37#else
38av_cold AVCodecParserContext *av_parser_init(enum AVCodecID codec_id)
39#endif
40{
41 AVCodecParserContext *s = NULL;
42 const AVCodecParser *parser;
43 const FFCodecParser *ffparser;
44 void *i = 0;
45 int ret;
46
47 if (codec_id == AV_CODEC_ID_NONE)
48 return NULL;
49
50 while ((parser = av_parser_iterate(&i))) {
51 if (parser->codec_ids[0] == codec_id ||
52 parser->codec_ids[1] == codec_id ||
53 parser->codec_ids[2] == codec_id ||
54 parser->codec_ids[3] == codec_id ||
55 parser->codec_ids[4] == codec_id ||
56 parser->codec_ids[5] == codec_id ||
57 parser->codec_ids[6] == codec_id)
58 goto found;
59 }
60 return NULL;
61
62found:
63 ffparser = ffcodecparser(parser);
64 s = av_mallocz(sizeof(AVCodecParserContext));
65 if (!s)
66 goto err_out;
67 s->parser = parser;
68 s->priv_data = av_mallocz(ffparser->priv_data_size);
69 if (!s->priv_data)
70 goto err_out;
71 s->fetch_timestamp=1;
72 s->pict_type = AV_PICTURE_TYPE_I;
73 if (ffparser->init) {
74 ret = ffparser->init(s);
75 if (ret != 0)
76 goto err_out;
77 }
78 s->key_frame = -1;
79 s->dts_sync_point = INT_MIN;
80 s->dts_ref_dts_delta = INT_MIN;
81 s->pts_dts_delta = INT_MIN;
82 s->format = -1;
83
84 return s;
85
86err_out:
87 if (s)
88 av_freep(&s->priv_data);
89 av_free(s);
90 return NULL;
91}
92
93void ff_fetch_timestamp(AVCodecParserContext *s, int off, int remove, int fuzzy)

Callers 8

LLVMFuzzerTestOneInputFunction · 0.85
read_frame_internalFunction · 0.85
flac_read_timestampFunction · 0.85
dash_initFunction · 0.85
old_flac_headerFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85

Calls 5

av_parser_iterateFunction · 0.85
ffcodecparserFunction · 0.85
av_freepFunction · 0.85
av_malloczFunction · 0.50
av_freeFunction · 0.50

Tested by

no test coverage detected