/** * Configure the background color setting. */ VdpStatus vlVdpPresentationQueueSetBackgroundColor(VdpPresentationQueue presentation_queue, VdpColor *const background_color) { vlVdpPresentationQueue *pq; union pipe_color_union color; if (!background_color) return VDP_STATUS_INVALID_POINTER; pq = vlGetDataHTAB(presentation_queue); if (!pq) return VDP_STATUS_INVALID_HANDLE; color.f[0] = background_color->red; color.f[1] = background_color->green; color.f[2] = background_color->blue; color.f[3] = background_color->alpha; pipe_mutex_lock(pq->device->mutex); vl_compositor_set_clear_color(&pq->cstate, &color); pipe_mutex_unlock(pq->device->mutex); return VDP_STATUS_OK; }
VdpStatus vlVdpPresentationQueueSetBackgroundColor(VdpPresentationQueue presentation_queue, VdpColor *const background_color) { vlVdpPresentationQueue *pq; VDPAU_MSG(VDPAU_TRACE, "[VDPAU] Setting Background Color\n"); if (!background_color) return VDP_STATUS_INVALID_POINTER; pq = vlGetDataHTAB(presentation_queue); if (!pq) return VDP_STATUS_INVALID_HANDLE; vl_compositor_set_clear_color(&pq->compositor, (float*)background_color); return VDP_STATUS_OK; }
/** * Set attribute values. */ VdpStatus vlVdpVideoMixerSetAttributeValues(VdpVideoMixer mixer, uint32_t attribute_count, VdpVideoMixerAttribute const *attributes, void const *const *attribute_values) { const VdpColor *background_color; union pipe_color_union color; const float *vdp_csc; float val; unsigned i; VdpStatus ret; if (!(attributes && attribute_values)) return VDP_STATUS_INVALID_POINTER; vlVdpVideoMixer *vmixer = vlGetDataHTAB(mixer); if (!vmixer) return VDP_STATUS_INVALID_HANDLE; pipe_mutex_lock(vmixer->device->mutex); for (i = 0; i < attribute_count; ++i) { switch (attributes[i]) { case VDP_VIDEO_MIXER_ATTRIBUTE_BACKGROUND_COLOR: background_color = attribute_values[i]; color.f[0] = background_color->red; color.f[1] = background_color->green; color.f[2] = background_color->blue; color.f[3] = background_color->alpha; vl_compositor_set_clear_color(&vmixer->cstate, &color); break; case VDP_VIDEO_MIXER_ATTRIBUTE_CSC_MATRIX: vdp_csc = attribute_values[i]; vmixer->custom_csc = !!vdp_csc; if (!vdp_csc) vl_csc_get_matrix(VL_CSC_COLOR_STANDARD_BT_601, NULL, 1, &vmixer->csc); else memcpy(vmixer->csc, vdp_csc, sizeof(vl_csc_matrix)); if (!debug_get_bool_option("G3DVL_NO_CSC", FALSE)) vl_compositor_set_csc_matrix(&vmixer->cstate, (const vl_csc_matrix *)&vmixer->csc); break; case VDP_VIDEO_MIXER_ATTRIBUTE_NOISE_REDUCTION_LEVEL: val = *(float*)attribute_values[i]; if (val < 0.f || val > 1.f) { ret = VDP_STATUS_INVALID_VALUE; goto fail; } vmixer->noise_reduction.level = val * 10; vlVdpVideoMixerUpdateNoiseReductionFilter(vmixer); break; case VDP_VIDEO_MIXER_ATTRIBUTE_LUMA_KEY_MIN_LUMA: val = *(float*)attribute_values[i]; if (val < 0.f || val > 1.f) { ret = VDP_STATUS_INVALID_VALUE; goto fail; } vmixer->luma_key_min = val; break; case VDP_VIDEO_MIXER_ATTRIBUTE_LUMA_KEY_MAX_LUMA: val = *(float*)attribute_values[i]; if (val < 0.f || val > 1.f) { ret = VDP_STATUS_INVALID_VALUE; goto fail; } vmixer->luma_key_max = val; break; case VDP_VIDEO_MIXER_ATTRIBUTE_SHARPNESS_LEVEL: val = *(float*)attribute_values[i]; if (val < -1.f || val > 1.f) { ret = VDP_STATUS_INVALID_VALUE; goto fail; } vmixer->sharpness.value = val; vlVdpVideoMixerUpdateSharpnessFilter(vmixer); break; case VDP_VIDEO_MIXER_ATTRIBUTE_SKIP_CHROMA_DEINTERLACE: if (*(uint8_t*)attribute_values[i] > 1) { ret = VDP_STATUS_INVALID_VALUE; goto fail; } vmixer->skip_chroma_deint = *(uint8_t*)attribute_values[i]; vlVdpVideoMixerUpdateDeinterlaceFilter(vmixer); break; default: ret = VDP_STATUS_INVALID_VIDEO_MIXER_ATTRIBUTE; goto fail; } } pipe_mutex_unlock(vmixer->device->mutex); return VDP_STATUS_OK; fail: pipe_mutex_unlock(vmixer->device->mutex); return ret; }