static int get_last_needed_nal(H264Context *h)

{

    int nals_needed = 0;

    int i;



    for (i = 0; i < h->pkt.nb_nals; i++) {

        H2645NAL *nal = &h->pkt.nals[i];

        GetBitContext gb;



        /* packets can sometimes contain multiple PPS/SPS,

         * e.g. two PAFF field pictures in one packet, or a demuxer

         * which splits NALs strangely if so, when frame threading we

         * can't start the next thread until we've read all of them */

        switch (nal->type) {

        case NAL_SPS:

        case NAL_PPS:

            nals_needed = i;

            break;

        case NAL_DPA:

        case NAL_IDR_SLICE:

        case NAL_SLICE:

            init_get_bits(&gb, nal->data + 1, (nal->size - 1) * 8);

            if (!get_ue_golomb(&gb))

                nals_needed = i;

        }

    }



    return nals_needed;

}

static int get_last_needed_nal(H264Context *h)

{

    int nals_needed = 0;

    int i;



    for (i = 0; i < h->pkt.nb_nals; i++) {

        H2645NAL *nal = &h->pkt.nals[i];

        GetBitContext gb;



        







        switch (nal->type) {

        case NAL_SPS:

        case NAL_PPS:

            nals_needed = i;

            break;

        case NAL_DPA:

        case NAL_IDR_SLICE:

        case NAL_SLICE:

            init_get_bits(&gb, nal->data + 1, (nal->size - 1) * 8);

            if (!get_ue_golomb(&gb))

                nals_needed = i;

        }

    }



    return nals_needed;

}

static int FUNC_0(H264Context *VAR_0)

{

    int VAR_1 = 0;

    int VAR_2;



    for (VAR_2 = 0; VAR_2 < VAR_0->pkt.nb_nals; VAR_2++) {

        H2645NAL *nal = &VAR_0->pkt.nals[VAR_2];

        GetBitContext gb;



        







        switch (nal->type) {

        case NAL_SPS:

        case NAL_PPS:

            VAR_1 = VAR_2;

            break;

        case NAL_DPA:

        case NAL_IDR_SLICE:

        case NAL_SLICE:

            init_get_bits(&gb, nal->data + 1, (nal->size - 1) * 8);

            if (!get_ue_golomb(&gb))

                VAR_1 = VAR_2;

        }

    }



    return VAR_1;

}

static int FUNC_0(H264Context *VAR_0)
{ int VAR_1 = 0; int VAR_2; for (VAR_2 = 0; VAR_2 < VAR_0->pkt.nb_nals; VAR_2++) { H2645NAL *nal = &VAR_0->pkt.nals[VAR_2]; GetBitContext gb; switch (nal->type) { case NAL_SPS:
case NAL_PPS:
VAR_1 = VAR_2; break; case NAL_DPA:
case NAL_IDR_SLICE:
case NAL_SLICE:
init_get_bits(&gb, nal->data + 1, (nal->size - 1) * 8); if (!get_ue_golomb(&gb))
VAR_1 = VAR_2; } } return VAR_1; }