static int mkv_field_order(MatroskaDemuxContext *matroska, int64_t field_order)

{

    int major, minor, micro, bttb = 0;



    /* workaround a bug in our Matroska muxer, introduced in version 57.36 alongside

     * this function, and fixed in 57.52 */

    if (sscanf(matroska->muxingapp, "Lavf%d.%d.%d", &major, &minor, &micro) == 3)

        bttb = (major == 57 && minor >= 36 && minor <= 51 && micro >= 100);



    switch (field_order) {

    case MATROSKA_VIDEO_FIELDORDER_PROGRESSIVE:

        return AV_FIELD_PROGRESSIVE;

    case MATROSKA_VIDEO_FIELDORDER_UNDETERMINED:

        return AV_FIELD_UNKNOWN;

    case MATROSKA_VIDEO_FIELDORDER_TT:

        return AV_FIELD_TT;

    case MATROSKA_VIDEO_FIELDORDER_BB:

        return AV_FIELD_BB;

    case MATROSKA_VIDEO_FIELDORDER_BT:

        return bttb ? AV_FIELD_TB : AV_FIELD_BT;

    case MATROSKA_VIDEO_FIELDORDER_TB:

        return bttb ? AV_FIELD_BT : AV_FIELD_TB;

    default:

        return AV_FIELD_UNKNOWN;

    }

}

static int mkv_field_order(MatroskaDemuxContext *matroska, int64_t field_order)

{

    int major, minor, micro, bttb = 0;



    



    if (sscanf(matroska->muxingapp, "Lavf%d.%d.%d", &major, &minor, &micro) == 3)

        bttb = (major == 57 && minor >= 36 && minor <= 51 && micro >= 100);



    switch (field_order) {

    case MATROSKA_VIDEO_FIELDORDER_PROGRESSIVE:

        return AV_FIELD_PROGRESSIVE;

    case MATROSKA_VIDEO_FIELDORDER_UNDETERMINED:

        return AV_FIELD_UNKNOWN;

    case MATROSKA_VIDEO_FIELDORDER_TT:

        return AV_FIELD_TT;

    case MATROSKA_VIDEO_FIELDORDER_BB:

        return AV_FIELD_BB;

    case MATROSKA_VIDEO_FIELDORDER_BT:

        return bttb ? AV_FIELD_TB : AV_FIELD_BT;

    case MATROSKA_VIDEO_FIELDORDER_TB:

        return bttb ? AV_FIELD_BT : AV_FIELD_TB;

    default:

        return AV_FIELD_UNKNOWN;

    }

}

    if (sscanf(matroska->muxingapp, "Lavf%d.%d.%d", &major, &minor, &micro) == 3)
static int FUNC_0(MatroskaDemuxContext *VAR_0, int64_t VAR_1)

{

    int VAR_2, VAR_3, VAR_4, VAR_5 = 0;



    



    if (sscanf(VAR_0->muxingapp, "Lavf%d.%d.%d", &VAR_2, &VAR_3, &VAR_4) == 3)

        VAR_5 = (VAR_2 == 57 && VAR_3 >= 36 && VAR_3 <= 51 && VAR_4 >= 100);



    switch (VAR_1) {

    case MATROSKA_VIDEO_FIELDORDER_PROGRESSIVE:

        return AV_FIELD_PROGRESSIVE;

    case MATROSKA_VIDEO_FIELDORDER_UNDETERMINED:

        return AV_FIELD_UNKNOWN;

    case MATROSKA_VIDEO_FIELDORDER_TT:

        return AV_FIELD_TT;

    case MATROSKA_VIDEO_FIELDORDER_BB:

        return AV_FIELD_BB;

    case MATROSKA_VIDEO_FIELDORDER_BT:

        return VAR_5 ? AV_FIELD_TB : AV_FIELD_BT;

    case MATROSKA_VIDEO_FIELDORDER_TB:

        return VAR_5 ? AV_FIELD_BT : AV_FIELD_TB;

    default:

        return AV_FIELD_UNKNOWN;

    }

}

static int FUNC_0(MatroskaDemuxContext *VAR_0, int64_t VAR_1)
{ int VAR_2, VAR_3, VAR_4, VAR_5 = 0; if (sscanf(VAR_0->muxingapp, "Lavf%d.%d.%d", &VAR_2, &VAR_3, &VAR_4) == 3)
VAR_5 = (VAR_2 == 57 && VAR_3 >= 36 && VAR_3 <= 51 && VAR_4 >= 100); switch (VAR_1) { case MATROSKA_VIDEO_FIELDORDER_PROGRESSIVE:
return AV_FIELD_PROGRESSIVE; case MATROSKA_VIDEO_FIELDORDER_UNDETERMINED:
return AV_FIELD_UNKNOWN; case MATROSKA_VIDEO_FIELDORDER_TT:
return AV_FIELD_TT; case MATROSKA_VIDEO_FIELDORDER_BB:
return AV_FIELD_BB; case MATROSKA_VIDEO_FIELDORDER_BT:
return VAR_5 ? AV_FIELD_TB : AV_FIELD_BT; case MATROSKA_VIDEO_FIELDORDER_TB:
return VAR_5 ? AV_FIELD_BT : AV_FIELD_TB; default:
return AV_FIELD_UNKNOWN; } }