static int append_flv_data(RTMPContext *rt, RTMPPacket *pkt, int skip)

{

    int old_flv_size, ret;

    PutByteContext pbc;

    const uint8_t *data = pkt->data + skip;

    const int size      = pkt->size - skip;

    uint32_t ts         = pkt->timestamp;



    if (pkt->type == RTMP_PT_AUDIO) {

        rt->has_audio = 1;

    } else if (pkt->type == RTMP_PT_VIDEO) {

        rt->has_video = 1;

    }



    old_flv_size = update_offset(rt, size + 15);



    if ((ret = av_reallocp(&rt->flv_data, rt->flv_size)) < 0) {

        rt->flv_size = rt->flv_off = 0;

        return ret;

    }

    bytestream2_init_writer(&pbc, rt->flv_data, rt->flv_size);

    bytestream2_skip_p(&pbc, old_flv_size);

    bytestream2_put_byte(&pbc, pkt->type);

    bytestream2_put_be24(&pbc, size);

    bytestream2_put_be24(&pbc, ts);

    bytestream2_put_byte(&pbc, ts >> 24);

    bytestream2_put_be24(&pbc, 0);

    bytestream2_put_buffer(&pbc, data, size);

    bytestream2_put_be32(&pbc, 0);



    return 0;

}

static int append_flv_data(RTMPContext *rt, RTMPPacket *pkt, int skip)

{

    int old_flv_size, ret;

    PutByteContext pbc;

    const uint8_t *data = pkt->data + skip;

    const int size      = pkt->size - skip;

    uint32_t ts         = pkt->timestamp;



    if (pkt->type == RTMP_PT_AUDIO) {

        rt->has_audio = 1;

    } else if (pkt->type == RTMP_PT_VIDEO) {

        rt->has_video = 1;

    }



    old_flv_size = update_offset(rt, size + 15);



    if ((ret = av_reallocp(&rt->flv_data, rt->flv_size)) < 0) {

        rt->flv_size = rt->flv_off = 0;

        return ret;

    }

    bytestream2_init_writer(&pbc, rt->flv_data, rt->flv_size);

    bytestream2_skip_p(&pbc, old_flv_size);

    bytestream2_put_byte(&pbc, pkt->type);

    bytestream2_put_be24(&pbc, size);

    bytestream2_put_be24(&pbc, ts);

    bytestream2_put_byte(&pbc, ts >> 24);

    bytestream2_put_be24(&pbc, 0);

    bytestream2_put_buffer(&pbc, data, size);

    bytestream2_put_be32(&pbc, 0);



    return 0;

}

    bytestream2_put_be32(&pbc, 0);
static int FUNC_0(RTMPContext *VAR_0, RTMPPacket *VAR_1, int VAR_2)

{

    int VAR_3, VAR_4;

    PutByteContext pbc;

    const uint8_t *VAR_5 = VAR_1->VAR_5 + VAR_2;

    const int VAR_6      = VAR_1->VAR_6 - VAR_2;

    uint32_t ts         = VAR_1->timestamp;



    if (VAR_1->type == RTMP_PT_AUDIO) {

        VAR_0->has_audio = 1;

    } else if (VAR_1->type == RTMP_PT_VIDEO) {

        VAR_0->has_video = 1;

    }



    VAR_3 = update_offset(VAR_0, VAR_6 + 15);



    if ((VAR_4 = av_reallocp(&VAR_0->flv_data, VAR_0->flv_size)) < 0) {

        VAR_0->flv_size = VAR_0->flv_off = 0;

        return VAR_4;

    }

    bytestream2_init_writer(&pbc, VAR_0->flv_data, VAR_0->flv_size);

    bytestream2_skip_p(&pbc, VAR_3);

    bytestream2_put_byte(&pbc, VAR_1->type);

    bytestream2_put_be24(&pbc, VAR_6);

    bytestream2_put_be24(&pbc, ts);

    bytestream2_put_byte(&pbc, ts >> 24);

    bytestream2_put_be24(&pbc, 0);

    bytestream2_put_buffer(&pbc, VAR_5, VAR_6);

    bytestream2_put_be32(&pbc, 0);



    return 0;

}

static int FUNC_0(RTMPContext *VAR_0, RTMPPacket *VAR_1, int VAR_2)
{ int VAR_3, VAR_4; PutByteContext pbc; const uint8_t *VAR_5 = VAR_1->VAR_5 + VAR_2; const int VAR_6      = VAR_1->VAR_6 - VAR_2; uint32_t ts         = VAR_1->timestamp; if (VAR_1->type == RTMP_PT_AUDIO) { VAR_0->has_audio = 1; } else if (VAR_1->type == RTMP_PT_VIDEO) { VAR_0->has_video = 1; } VAR_3 = update_offset(VAR_0, VAR_6 + 15); if ((VAR_4 = av_reallocp(&VAR_0->flv_data, VAR_0->flv_size)) < 0) { VAR_0->flv_size = VAR_0->flv_off = 0; return VAR_4; } bytestream2_init_writer(&pbc, VAR_0->flv_data, VAR_0->flv_size); bytestream2_skip_p(&pbc, VAR_3); bytestream2_put_byte(&pbc, VAR_1->type); bytestream2_put_be24(&pbc, VAR_6); bytestream2_put_be24(&pbc, ts); bytestream2_put_byte(&pbc, ts >> 24); bytestream2_put_be24(&pbc, 0); bytestream2_put_buffer(&pbc, VAR_5, VAR_6); bytestream2_put_be32(&pbc, 0); return 0; }