external/libwebmdec/src/open-callbacks.c
static int init_video_decoder(webmdec_t *handle)
{
    vpx_codec_iface_t *interface;
    const int codec =
        nestegg_track_codec_id(handle->demuxer, handle->video_track);
    switch (codec) {
        case NESTEGG_CODEC_VP8: interface = vpx_codec_vp8_dx(); break;
        case NESTEGG_CODEC_VP9: interface = vpx_codec_vp9_dx(); break;
        default: return 0;  /* Not supported. */
    }

    vpx_codec_dec_cfg_t config = {
        .threads = 1,
        .w = handle->video_params.width,
        .h = handle->video_params.height,
    };

    handle->video_decoder = malloc(sizeof(*handle->video_decoder));
    if (!handle->video_decoder) {
        return 0;
    }
    int status = vpx_codec_dec_init(handle->video_decoder, interface, &config,
                                    VPX_CODEC_USE_ERROR_CONCEALMENT);
    if (status == VPX_CODEC_INCAPABLE) {
        status = vpx_codec_dec_init(handle->video_decoder, interface, &config,
                                    0);
    }
    if (status != VPX_CODEC_OK) {
        free(handle->video_decoder);
        handle->video_decoder = NULL;
        return 0;
    }

    return 1;
}
/**
 * init_video_decoder:  Create a video decoder for the given stream,
 * returning whether the creation succeeded.
 */
Create a video decoder for the given stream,
returning whether the creation succeeded.
Create a video decoder for the given stream returning whether the creation succeeded .
static int init_video_decoder(webmdec_t *handle)
{
    vpx_codec_iface_t *interface;
    const int codec =
        nestegg_track_codec_id(handle->demuxer, handle->video_track);
    switch (codec) {
        case NESTEGG_CODEC_VP8: interface = vpx_codec_vp8_dx(); break;
        case NESTEGG_CODEC_VP9: interface = vpx_codec_vp9_dx(); break;
        default: return 0;  
    }
    vpx_codec_dec_cfg_t config = {
        .threads = 1,
        .w = handle->video_params.width,
        .h = handle->video_params.height,
    };
    handle->video_decoder = malloc(sizeof(*handle->video_decoder));
    if (!handle->video_decoder) {
        return 0;
    }
    int status = vpx_codec_dec_init(handle->video_decoder, interface, &config,
                                    VPX_CODEC_USE_ERROR_CONCEALMENT);
    if (status == VPX_CODEC_INCAPABLE) {
        status = vpx_codec_dec_init(handle->video_decoder, interface, &config,
                                    0);
    }
    if (status != VPX_CODEC_OK) {
        free(handle->video_decoder);
        handle->video_decoder = NULL;
        return 0;
    }
    return 1;
}
static int init_video_decoder ( webmdec_t * handle ) { vpx_codec_iface_t * interface ; const int codec = nestegg_track_codec_id ( handle -> demuxer , handle -> video_track ) ; switch ( codec ) { case NESTEGG_CODEC_VP8 : interface = vpx_codec_vp8_dx ( ) ; break ; case NESTEGG_CODEC_VP9 : interface = vpx_codec_vp9_dx ( ) ; break ; default : return 0 ; } vpx_codec_dec_cfg_t config = { . threads = 1 , . w = handle -> video_params . width , . h = handle -> video_params . height , } ; handle -> video_decoder = malloc ( sizeof ( * handle -> video_decoder ) ) ; if ( ! handle -> video_decoder ) { return 0 ; } int status = vpx_codec_dec_init ( handle -> video_decoder , interface , & config , VPX_CODEC_USE_ERROR_CONCEALMENT ) ; if ( status == VPX_CODEC_INCAPABLE ) { status = vpx_codec_dec_init ( handle -> video_decoder , interface , & config , 0 ) ; } if ( status != VPX_CODEC_OK ) { free ( handle -> video_decoder ) ; handle -> video_decoder = NULL ; return 0 ; } return 1 ; }
init_video_decoder:  Create a video decoder for the given stream,
 returning whether the creation succeeded.
init_video_decoder : Create a video decoder for the given stream returning whether the creation succeeded .
/* Not supported. */