libav-12.3/libavcodec/hevc_parser.c
// Split after the parameter sets at the beginning of the stream if they exist.
Split after the parameter sets at the beginning of the stream if they exist.
Split after the parameter sets at the beginning of the stream if they exist .
static int hevc_split(AVCodecContext *avctx, const uint8_t *buf, int buf_size)
{
    int i;
    uint32_t state = -1;
    int has_ps = 0;
    for (i = 0; i < buf_size; i++) {
        state = (state << 8) | buf[i];
        if (((state >> 8) & 0xFFFFFF) == START_CODE) {
            int nut = (state >> 1) & 0x3F;
            if (nut >= NAL_VPS && nut <= NAL_PPS)
                has_ps = 1;
            else if (has_ps)
                return i - 3;
            else 
                return 0;
        }
    }
    return 0;
}
static int hevc_split ( AVCodecContext * avctx , const uint8_t * buf , int buf_size ) { int i ; uint32_t state = -1 ; int has_ps = 0 ; for ( i = 0 ; i < buf_size ; i ++ ) { state = ( state << 8 ) | buf [ i ] ; if ( ( ( state >> 8 ) & 0xFFFFFF ) == START_CODE ) { int nut = ( state >> 1 ) & 0x3F ; if ( nut >= NAL_VPS && nut <= NAL_PPS ) has_ps = 1 ; else if ( has_ps ) return i - 3 ; else return 0 ; } } return 0 ; }
Split after the parameter sets at the beginning of the stream if they exist.
Split after the parameter sets at the beginning of the stream if they exist .
// no parameter set at the beginning of the stream