/** * Find the best suited decoder mode GUID and render format. */ static int FindVideoServiceConversion(vlc_va_t *va, directx_sys_t *dx_sys, const es_format_t *fmt, const AVCodecContext *avctx) { input_list_t p_list = { 0 }; int err = dx_sys->pf_get_input_list(va, &p_list); if (err != VLC_SUCCESS) return err; if (p_list.count == 0) { msg_Warn( va, "No input format found for HWAccel" ); return VLC_EGENERIC; } err = VLC_EGENERIC; /* Retreive supported modes from the decoder service */ for (unsigned i = 0; i < p_list.count; i++) { const GUID *g = &p_list.list[i]; char *psz_decoder_name = directx_va_GetDecoderName(g); msg_Dbg(va, "- '%s' is supported", psz_decoder_name); free(psz_decoder_name); } /* Try all supported mode by our priority */ const directx_va_mode_t *mode = DXVA_MODES; for (; mode->name; ++mode) { if (!mode->codec || mode->codec != avctx->codec_id) continue; /* */ bool is_supported = false; for (const GUID *g = &p_list.list[0]; !is_supported && g < &p_list.list[p_list.count]; g++) { is_supported = IsEqualGUID(mode->guid, g); } if ( is_supported ) { is_supported = profile_supported( mode, fmt ); if (!is_supported) msg_Warn( va, "Unsupported profile %d for %s ", fmt->i_profile, directx_va_GetDecoderName(mode->guid) ); } if (!is_supported) continue; /* */ msg_Dbg(va, "Trying to use '%s' as input", mode->name); if (dx_sys->pf_setup_output(va, mode->guid, &fmt->video)==VLC_SUCCESS) { dx_sys->input = *mode->guid; err = VLC_SUCCESS; break; } } p_list.pf_release(&p_list); return err; }
/** * Find the best suited decoder mode GUID and render format. */ static int FindVideoServiceConversion(vlc_va_t *va, directx_sys_t *dx_sys, const es_format_t *fmt) { input_list_t p_list = { 0 }; int err = dx_sys->pf_get_input_list(va, &p_list); if (err != VLC_SUCCESS) return err; /* Retreive supported modes from the decoder service */ for (unsigned i = 0; i < p_list.count; i++) { const GUID *g = &p_list.list[i]; const directx_va_mode_t *mode = FindDxvaMode(g); if (mode) { msg_Dbg(va, "- '%s' is supported by hardware", mode->name); } else { msg_Warn(va, "- Unknown GUID = " GUID_FMT, GUID_PRINT( *g ) ); } } /* Try all supported mode by our priority */ const directx_va_mode_t *mode = DXVA_MODES; for (; mode->name; ++mode) { if (!mode->codec || mode->codec != dx_sys->codec_id) continue; /* */ bool is_supported = false; for (const GUID *g = &p_list.list[0]; !is_supported && g < &p_list.list[p_list.count]; g++) { is_supported = IsEqualGUID(mode->guid, g); } if ( is_supported ) { is_supported = profile_supported( mode, fmt ); if (!is_supported) msg_Warn( va, "Unsupported profile for HWAccel: %d", fmt->i_profile ); } if (!is_supported) continue; /* */ msg_Dbg(va, "Trying to use '%s' as input", mode->name); if (dx_sys->pf_setup_output(va, mode->guid)==VLC_SUCCESS) { dx_sys->input = *mode->guid; err = VLC_SUCCESS; break; } } p_list.pf_release(&p_list); return err; }