static int mxf_read_primer_pack(void *arg, AVIOContext *pb, int tag, int size, UID uid, int64_t klv_offset)

{

    MXFContext *mxf = arg;

    int item_num = avio_rb32(pb);

    int item_len = avio_rb32(pb);



    if (item_len != 18) {

        avpriv_request_sample(pb, "Primer pack item length %d", item_len);

        return AVERROR_PATCHWELCOME;

    }

    if (item_num > 65536) {

        av_log(mxf->fc, AV_LOG_ERROR, "item_num %d is too large\n", item_num);

        return AVERROR_INVALIDDATA;

    }





    mxf->local_tags = av_calloc(item_num, item_len);

    if (!mxf->local_tags)

        return AVERROR(ENOMEM);

    mxf->local_tags_count = item_num;

    avio_read(pb, mxf->local_tags, item_num*item_len);

    return 0;

}
static int mxf_read_primer_pack(void *arg, AVIOContext *pb, int tag, int size, UID uid, int64_t klv_offset)

{

    MXFContext *mxf = arg;

    int item_num = avio_rb32(pb);

    int item_len = avio_rb32(pb);



    if (item_len != 18) {

        avpriv_request_sample(pb, "Primer pack item length %d", item_len);

        return AVERROR_PATCHWELCOME;

    }

    if (item_num > 65536) {

        av_log(mxf->fc, AV_LOG_ERROR, "item_num %d is too large\n", item_num);

        return AVERROR_INVALIDDATA;

    }





    mxf->local_tags = av_calloc(item_num, item_len);

    if (!mxf->local_tags)

        return AVERROR(ENOMEM);

    mxf->local_tags_count = item_num;

    avio_read(pb, mxf->local_tags, item_num*item_len);

    return 0;

}
static int FUNC_0(void *VAR_0, AVIOContext *VAR_1, int VAR_2, int VAR_3, UID VAR_4, int64_t VAR_5)

{

    MXFContext *mxf = VAR_0;

    int VAR_6 = avio_rb32(VAR_1);

    int VAR_7 = avio_rb32(VAR_1);



    if (VAR_7 != 18) {

        avpriv_request_sample(VAR_1, "Primer pack item length %d", VAR_7);

        return AVERROR_PATCHWELCOME;

    }

    if (VAR_6 > 65536) {

        av_log(mxf->fc, AV_LOG_ERROR, "VAR_6 %d is too large\n", VAR_6);

        return AVERROR_INVALIDDATA;

    }





    mxf->local_tags = av_calloc(VAR_6, VAR_7);

    if (!mxf->local_tags)

        return AVERROR(ENOMEM);

    mxf->local_tags_count = VAR_6;

    avio_read(VAR_1, mxf->local_tags, VAR_6*VAR_7);

    return 0;

}
static int FUNC_0(void *VAR_0, AVIOContext *VAR_1, int VAR_2, int VAR_3, UID VAR_4, int64_t VAR_5)
{ MXFContext *mxf = VAR_0; int VAR_6 = avio_rb32(VAR_1); int VAR_7 = avio_rb32(VAR_1); if (VAR_7 != 18) { avpriv_request_sample(VAR_1, "Primer pack item length %d", VAR_7); return AVERROR_PATCHWELCOME; } if (VAR_6 > 65536) { av_log(mxf->fc, AV_LOG_ERROR, "VAR_6 %d is too large\n", VAR_6); return AVERROR_INVALIDDATA; } mxf->local_tags = av_calloc(VAR_6, VAR_7); if (!mxf->local_tags)
return AVERROR(ENOMEM); mxf->local_tags_count = VAR_6; avio_read(VAR_1, mxf->local_tags, VAR_6*VAR_7); return 0; }