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

Function av_hash_alloc

libavutil/hash.c:114–149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

112}
113
114int av_hash_alloc(AVHashContext **ctx, const char *name)
115{
116 AVHashContext *res;
117 int i;
118 *ctx = NULL;
119 for (i = 0; i < NUM_HASHES; i++)
120 if (av_strcasecmp(name, hashdesc[i].name) == 0)
121 break;
122 if (i >= NUM_HASHES) return AVERROR(EINVAL);
123 res = av_mallocz(sizeof(*res));
124 if (!res) return AVERROR(ENOMEM);
125 res->type = i;
126 switch (i) {
127 case MD5: res->ctx = av_md5_alloc(); break;
128 case MURMUR3: res->ctx = av_murmur3_alloc(); break;
129 case RIPEMD128:
130 case RIPEMD160:
131 case RIPEMD256:
132 case RIPEMD320: res->ctx = av_ripemd_alloc(); break;
133 case SHA160:
134 case SHA224:
135 case SHA256: res->ctx = av_sha_alloc(); break;
136 case SHA512_224:
137 case SHA512_256:
138 case SHA384:
139 case SHA512: res->ctx = av_sha512_alloc(); break;
140 case CRC32: res->crctab = av_crc_get_table(AV_CRC_32_IEEE_LE); break;
141 case ADLER32: break;
142 }
143 if (i != ADLER32 && i != CRC32 && !res->ctx) {
144 av_free(res);
145 return AVERROR(ENOMEM);
146 }
147 *ctx = res;
148 return 0;
149}
150
151void av_hash_init(AVHashContext *ctx)
152{

Callers 7

mainFunction · 0.85
hash_initFunction · 0.85
streamhash_initFunction · 0.85
framehash_initFunction · 0.85
mainFunction · 0.85
avtext_context_openFunction · 0.85
decodeFunction · 0.85

Calls 9

av_strcasecmpFunction · 0.85
av_md5_allocFunction · 0.85
av_murmur3_allocFunction · 0.85
av_ripemd_allocFunction · 0.85
av_sha_allocFunction · 0.85
av_sha512_allocFunction · 0.85
av_crc_get_tableFunction · 0.85
av_malloczFunction · 0.70
av_freeFunction · 0.70

Tested by 2

mainFunction · 0.68
decodeFunction · 0.68