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

Function framehash_write_packet

libavformat/hashenc.c:282–318  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

280}
281
282static int framehash_write_packet(struct AVFormatContext *s, AVPacket *pkt)
283{
284 struct HashContext *c = s->priv_data;
285 char buf[AV_HASH_MAX_SIZE*2+128];
286 int len;
287 av_hash_init(c->hashes[0]);
288 av_hash_update(c->hashes[0], pkt->data, pkt->size);
289
290 snprintf(buf, sizeof(buf) - (AV_HASH_MAX_SIZE * 2 + 1), "%d, %10"PRId64", %10"PRId64", %8"PRId64", %8d, ",
291 pkt->stream_index, pkt->dts, pkt->pts, pkt->duration, pkt->size);
292 len = strlen(buf);
293 av_hash_final_hex(c->hashes[0], buf + len, sizeof(buf) - len);
294 avio_write(s->pb, buf, strlen(buf));
295
296 if (c->format_version > 1 && pkt->side_data_elems) {
297 int i;
298 avio_printf(s->pb, ", S=%d", pkt->side_data_elems);
299 for (i = 0; i < pkt->side_data_elems; i++) {
300 av_hash_init(c->hashes[0]);
301 if (HAVE_BIGENDIAN && pkt->side_data[i].type == AV_PKT_DATA_PALETTE) {
302 for (size_t j = 0; j < pkt->side_data[i].size; j += sizeof(uint32_t)) {
303 uint32_t data = AV_RL32(pkt->side_data[i].data + j);
304 av_hash_update(c->hashes[0], (uint8_t *)&data, sizeof(uint32_t));
305 }
306 } else
307 av_hash_update(c->hashes[0], pkt->side_data[i].data, pkt->side_data[i].size);
308 snprintf(buf, sizeof(buf) - (AV_HASH_MAX_SIZE * 2 + 1),
309 ", %8zu, ", pkt->side_data[i].size);
310 len = strlen(buf);
311 av_hash_final_hex(c->hashes[0], buf + len, sizeof(buf) - len);
312 avio_write(s->pb, buf, strlen(buf));
313 }
314 }
315
316 avio_printf(s->pb, "\n");
317 return 0;
318}
319#endif
320
321#if CONFIG_FRAMEHASH_MUXER

Callers

nothing calls this directly

Calls 5

av_hash_initFunction · 0.85
av_hash_updateFunction · 0.85
av_hash_final_hexFunction · 0.85
avio_writeFunction · 0.85
avio_printfFunction · 0.85

Tested by

no test coverage detected