Beispiel #1
0
static block_t *ParseNonVCL(decoder_t *p_dec, uint8_t i_nal_type, block_t *p_nalb)
{
    block_t *p_ret = p_nalb;

    switch(i_nal_type)
    {
        case HEVC_NAL_VPS:
        case HEVC_NAL_SPS:
        case HEVC_NAL_PPS:
        {
            uint8_t i_id;
            if( hevc_get_xps_id(p_nalb->p_buffer, p_nalb->i_buffer, &i_id) &&
                InsertXPS(p_dec, i_nal_type, i_id, p_nalb) ) /* also checks id range */
            {
                const hevc_sequence_parameter_set_t *p_sps;
                if( i_nal_type == HEVC_NAL_SPS &&
                   !p_dec->fmt_out.video.i_frame_rate_base &&
                   (p_sps = p_dec->p_sys->rgi_p_decsps[i_id]) )
                {
                    (void) hevc_get_frame_rate( p_sps, p_dec->p_sys->rgi_p_decvps,
                                                &p_dec->fmt_out.video.i_frame_rate,
                                                &p_dec->fmt_out.video.i_frame_rate_base );
                }
            }
        }
            break;

        case HEVC_NAL_AUD:
        case HEVC_NAL_EOS:
        case HEVC_NAL_EOB:
        case HEVC_NAL_FD:
            break;
    }

    return p_ret;
}
Beispiel #2
0
Datei: hevc.c Projekt: etix/vlc
static block_t * ParseAUHead(decoder_t *p_dec, uint8_t i_nal_type, block_t *p_nalb)
{
    decoder_sys_t *p_sys = p_dec->p_sys;
    block_t *p_ret = NULL;

    if(p_sys->post.p_chain || p_sys->frame.p_chain)
        p_ret = OutputQueues(p_sys, true);

    switch(i_nal_type)
    {
        case HEVC_NAL_AUD:
            if(!p_ret && p_sys->pre.p_chain)
                p_ret = OutputQueues(p_sys, true);
            break;

        case HEVC_NAL_VPS:
        case HEVC_NAL_SPS:
        case HEVC_NAL_PPS:
        {
            uint8_t i_id;
            if( hevc_get_xps_id(p_nalb->p_buffer, p_nalb->i_buffer, &i_id) &&
                InsertXPS(p_dec, i_nal_type, i_id, p_nalb) )
            {
                const hevc_sequence_parameter_set_t *p_sps;
                if( i_nal_type == HEVC_NAL_SPS &&
                   (p_sps = p_dec->p_sys->rgi_p_decsps[i_id]) )
                {
                    if(!p_dec->fmt_out.video.i_frame_rate)
                    {
                        (void) hevc_get_frame_rate( p_sps, p_dec->p_sys->rgi_p_decvps,
                                                    &p_dec->fmt_out.video.i_frame_rate,
                                                    &p_dec->fmt_out.video.i_frame_rate_base );
                    }

                    if(p_dec->fmt_out.video.primaries == COLOR_PRIMARIES_UNDEF)
                    {
                        (void) hevc_get_colorimetry( p_sps,
                                                     &p_dec->fmt_out.video.primaries,
                                                     &p_dec->fmt_out.video.transfer,
                                                     &p_dec->fmt_out.video.space,
                                                     &p_dec->fmt_out.video.b_color_range_full);
                    }

                    unsigned sizes[4];
                    if( hevc_get_picture_size( p_sps, &sizes[0], &sizes[1],
                                                      &sizes[2], &sizes[3] ) )
                    {
                        if( p_dec->fmt_out.video.i_width != sizes[0] ||
                            p_dec->fmt_out.video.i_height != sizes[1] )
                        {
                            p_dec->fmt_out.video.i_width = sizes[0];
                            p_dec->fmt_out.video.i_height = sizes[1];
                        }
                    }

                    if(p_dec->fmt_out.i_profile == -1)
                    {
                        uint8_t i_profile, i_level;
                        if( hevc_get_sps_profile_tier_level( p_sps, &i_profile, &i_level ) )
                        {
                            p_dec->fmt_out.i_profile = i_profile;
                            p_dec->fmt_out.i_level = i_level;
                        }
                    }
                }
            }
            break;
        }

        case HEVC_NAL_PREF_SEI:
            HxxxParse_AnnexB_SEI( p_nalb->p_buffer, p_nalb->i_buffer,
                                  2 /* nal header */, ParseSEICallback, p_dec );
            break;

        default:
            break;
    }

    block_ChainLastAppend(&p_sys->pre.pp_chain_last, p_nalb);

    return p_ret;
}