From 3865c166c91155bf1f29a902491661eef36f72e2 Mon Sep 17 00:00:00 2001 From: cehoyos Date: Tue, 10 Nov 2009 10:04:32 +0000 Subject: Fail in query_format() if a VDPAU decoder is not available. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29870 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/vo_vdpau.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'libvo/vo_vdpau.c') diff --git a/libvo/vo_vdpau.c b/libvo/vo_vdpau.c index 6276ef02fd..c69cca1ab2 100644 --- a/libvo/vo_vdpau.c +++ b/libvo/vo_vdpau.c @@ -555,13 +555,14 @@ static void free_video_specific(void) video_mixer = VDP_INVALID_HANDLE; } -static int create_vdp_decoder(int max_refs) +static int create_vdp_decoder(uint32_t format, uint32_t width, uint32_t height, + int max_refs) { VdpStatus vdp_st; VdpDecoderProfile vdp_decoder_profile; if (decoder != VDP_INVALID_HANDLE) vdp_decoder_destroy(decoder); - switch (image_format) { + switch (format) { case IMGFMT_VDPAU_MPEG1: vdp_decoder_profile = VDP_DECODER_PROFILE_MPEG1; break; @@ -582,7 +583,7 @@ static int create_vdp_decoder(int max_refs) goto err_out; } vdp_st = vdp_decoder_create(vdp_device, vdp_decoder_profile, - vid_width, vid_height, max_refs, &decoder); + width, height, max_refs, &decoder); CHECK_ST_WARNING("Failed creating VDPAU decoder"); if (vdp_st != VDP_STATUS_OK) { err_out: @@ -662,7 +663,8 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, vid_width = width; vid_height = height; free_video_specific(); - if (IMGFMT_IS_VDPAU(image_format) && !create_vdp_decoder(2)) + if (IMGFMT_IS_VDPAU(image_format) + && !create_vdp_decoder(image_format, vid_width, vid_height, 2)) return -1; int_pause = 0; @@ -986,7 +988,7 @@ static int draw_slice(uint8_t *image[], int stride[], int w, int h, if (!IMGFMT_IS_VDPAU(image_format)) return VO_FALSE; if ((decoder == VDP_INVALID_HANDLE || decoder_max_refs < max_refs) - && !create_vdp_decoder(max_refs)) + && !create_vdp_decoder(image_format, vid_width, vid_height, max_refs)) return VO_FALSE; vdp_st = vdp_decoder_render(decoder, rndr->surface, (void *)&rndr->info, rndr->bitstream_buffers_used, rndr->bitstream_buffers); @@ -1110,6 +1112,7 @@ static int query_format(uint32_t format) case IMGFMT_VDPAU_H264: case IMGFMT_VDPAU_WMV3: case IMGFMT_VDPAU_VC1: + if (create_vdp_decoder(image_format, vid_width, vid_height, 2)) return default_flags; } return 0; -- cgit v1.2.3