[MPlayer-dev-eng] [PATCH]Fail earlier if VDPAU decoder is unavailable

Carl Eugen Hoyos cehoyos at rainbow.studorg.tuwien.ac.at
Sat Nov 7 01:28:35 CET 2009


Hi!

Some time ago, it was discussed how mplayer could fail earlier if the 
hardware decoder is not available.

Is this patch a step in the right direction?

Please comment, Carl Eugen
-------------- next part --------------
Index: libvo/vo_vdpau.c
===================================================================
--- libvo/vo_vdpau.c	(revision 29843)
+++ libvo/vo_vdpau.c	(working copy)
@@ -555,13 +555,13 @@ static void free_video_specific(void)
     video_mixer = VDP_INVALID_HANDLE;
 }
 
-static int create_vdp_decoder(int max_refs)
+static int create_vdp_decoder(int max_refs, uint32_t format)
 {
     VdpStatus vdp_st;
-    VdpDecoderProfile vdp_decoder_profile;
+    VdpDecoderProfile vdp_decoder_profile = VDP_INVALID_HANDLE;
     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;
@@ -659,7 +662,7 @@ static int config(uint32_t width, uint32_t height,
     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(2, format))
         return -1;
 
     int_pause   = 0;
@@ -983,7 +986,7 @@ static int draw_slice(uint8_t *image[], int stride
     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(max_refs, image_format))
         return VO_FALSE;
 
     vdp_st = vdp_decoder_render(decoder, rndr->surface, (void *)&rndr->info, rndr->bitstream_buffers_used, rndr->bitstream_buffers);
@@ -1107,6 +1110,8 @@ static int query_format(uint32_t format)
     case IMGFMT_VDPAU_H264:
     case IMGFMT_VDPAU_WMV3:
     case IMGFMT_VDPAU_VC1:
+        vid_width = vid_height = 48;
+        if (create_vdp_decoder(2, format))
         return default_flags;
     }
     return 0;


More information about the MPlayer-dev-eng mailing list