static int copy_packet_data(AVPacket *pkt, AVPacket *src, int dup)

{

    pkt->data      = NULL;

    pkt->side_data = NULL;

    if (pkt->buf) {

        AVBufferRef *ref = av_buffer_ref(src->buf);

        if (!ref)

            return AVERROR(ENOMEM);

        pkt->buf  = ref;

        pkt->data = ref->data;

    } else {

        DUP_DATA(pkt->data, src->data, pkt->size, 1, ALLOC_BUF);

    }

#if FF_API_DESTRUCT_PACKET

FF_DISABLE_DEPRECATION_WARNINGS

    pkt->destruct = dummy_destruct_packet;

FF_ENABLE_DEPRECATION_WARNINGS

#endif

    if (pkt->side_data_elems && dup)

        pkt->side_data = src->side_data;

    if (pkt->side_data_elems && !dup) {

        return av_copy_packet_side_data(pkt, src);

    }

    return 0;



failed_alloc:

    av_destruct_packet(pkt);

    return AVERROR(ENOMEM);

}

static int copy_packet_data(AVPacket *pkt, AVPacket *src, int dup)

{

    pkt->data      = NULL;

    pkt->side_data = NULL;

    if (pkt->buf) {

        AVBufferRef *ref = av_buffer_ref(src->buf);

        if (!ref)

            return AVERROR(ENOMEM);

        pkt->buf  = ref;

        pkt->data = ref->data;

    } else {

        DUP_DATA(pkt->data, src->data, pkt->size, 1, ALLOC_BUF);

    }

#if FF_API_DESTRUCT_PACKET

FF_DISABLE_DEPRECATION_WARNINGS

    pkt->destruct = dummy_destruct_packet;

FF_ENABLE_DEPRECATION_WARNINGS

#endif

    if (pkt->side_data_elems && dup)

        pkt->side_data = src->side_data;

    if (pkt->side_data_elems && !dup) {

        return av_copy_packet_side_data(pkt, src);

    }

    return 0;



failed_alloc:

    av_destruct_packet(pkt);

    return AVERROR(ENOMEM);

}

    av_destruct_packet(pkt);     av_destruct_packet(pkt);
static int FUNC_0(AVPacket *VAR_0, AVPacket *VAR_1, int VAR_2)

{

    VAR_0->data      = NULL;

    VAR_0->side_data = NULL;

    if (VAR_0->buf) {

        AVBufferRef *ref = av_buffer_ref(VAR_1->buf);

        if (!ref)

            return AVERROR(ENOMEM);

        VAR_0->buf  = ref;

        VAR_0->data = ref->data;

    } else {

        DUP_DATA(VAR_0->data, VAR_1->data, VAR_0->size, 1, ALLOC_BUF);

    }

#if FF_API_DESTRUCT_PACKET

FF_DISABLE_DEPRECATION_WARNINGS

    VAR_0->destruct = dummy_destruct_packet;

FF_ENABLE_DEPRECATION_WARNINGS

#endif

    if (VAR_0->side_data_elems && VAR_2)

        VAR_0->side_data = VAR_1->side_data;

    if (VAR_0->side_data_elems && !VAR_2) {

        return av_copy_packet_side_data(VAR_0, VAR_1);

    }

    return 0;



failed_alloc:

    av_destruct_packet(VAR_0);

    return AVERROR(ENOMEM);

}

static int FUNC_0(AVPacket *VAR_0, AVPacket *VAR_1, int VAR_2)
{ VAR_0->data      = NULL; VAR_0->side_data = NULL; if (VAR_0->buf) { AVBufferRef *ref = av_buffer_ref(VAR_1->buf); if (!ref)
return AVERROR(ENOMEM); VAR_0->buf  = ref; VAR_0->data = ref->data; } else { DUP_DATA(VAR_0->data, VAR_1->data, VAR_0->size, 1, ALLOC_BUF); } #if FF_API_DESTRUCT_PACKET
FF_DISABLE_DEPRECATION_WARNINGS
VAR_0->destruct = dummy_destruct_packet; FF_ENABLE_DEPRECATION_WARNINGS
#endif
if (VAR_0->side_data_elems && VAR_2)
VAR_0->side_data = VAR_1->side_data; if (VAR_0->side_data_elems && !VAR_2) { return av_copy_packet_side_data(VAR_0, VAR_1); } return 0; failed_alloc:
av_destruct_packet(VAR_0); return AVERROR(ENOMEM); }