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

Function av_packet_ref

libavcodec/packet.c:440–474  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

438}
439
440int av_packet_ref(AVPacket *dst, const AVPacket *src)
441{
442 int ret;
443
444 dst->buf = NULL;
445
446 ret = av_packet_copy_props(dst, src);
447 if (ret < 0)
448 goto fail;
449
450 if (!src->buf) {
451 ret = packet_alloc(&dst->buf, src->size);
452 if (ret < 0)
453 goto fail;
454 av_assert1(!src->size || src->data);
455 if (src->size)
456 memcpy(dst->buf->data, src->data, src->size);
457
458 dst->data = dst->buf->data;
459 } else {
460 dst->buf = av_buffer_ref(src->buf);
461 if (!dst->buf) {
462 ret = AVERROR(ENOMEM);
463 goto fail;
464 }
465 dst->data = src->data;
466 }
467
468 dst->size = src->size;
469
470 return 0;
471fail:
472 av_packet_unref(dst);
473 return ret;
474}
475
476AVPacket *av_packet_clone(const AVPacket *src)
477{

Callers 15

gif_write_packetFunction · 0.85
flush_packetFunction · 0.85
apng_write_packetFunction · 0.85
extract_extradataFunction · 0.85
tee_write_packetFunction · 0.85
write_muxed_fileFunction · 0.85
webp_write_packetFunction · 0.85
stream_params_copyFunction · 0.85
write_packetFunction · 0.85
amv_write_packetFunction · 0.85
fifo_write_packetFunction · 0.85

Calls 4

av_packet_copy_propsFunction · 0.85
packet_allocFunction · 0.85
av_buffer_refFunction · 0.85
av_packet_unrefFunction · 0.85

Tested by

no test coverage detected