g3dvl: Added more XvMC stubs to get mplayer working.
authorYounes Manton <younes.m@gmail.com>
Thu, 24 Jul 2008 20:50:18 +0000 (16:50 -0400)
committerYounes Manton <younes.m@gmail.com>
Thu, 24 Jul 2008 20:50:18 +0000 (16:50 -0400)
src/libXvMC/context.c
src/libXvMC/subpicture.c
src/libXvMC/surface.c

index 59e1cb2b256567eb9a83f1beef8552ca6e3cda0d..9cf654d6bb211069765833cf889c32fa7a9898e6 100644 (file)
@@ -183,18 +183,36 @@ XvMCSurfaceInfo* XvMCListSurfaceTypes(Display *display, XvPortID port, int *num)
        surface_info->chroma_format = XVMC_CHROMA_FORMAT_420;
        surface_info->max_width = 2048;
        surface_info->max_height = 2048;
+       surface_info->subpicture_max_width = 2048;
+       surface_info->subpicture_max_height = 2048;
        surface_info->mc_type = XVMC_IDCT | XVMC_MPEG_2;
        surface_info->surface_type_id = 123; /* FIXME: XAllocID(display)*/;
-       surface_info->flags |= XVMC_INTRA_UNSIGNED;
+       surface_info->flags = XVMC_INTRA_UNSIGNED | XVMC_SUBPICTURE_INDEPENDENT_SCALING | XVMC_BACKEND_SUBPICTURE;
        
        return surface_info;
 }
 
 XvImageFormatValues* XvMCListSubpictureTypes(Display* display, XvPortID port, int surface_type_id, int *count_return)
 {
-       /* TODO */
-       *count_return = 0;
-       
-       return NULL;
+       XvImageFormatValues *image_formats = calloc(1, sizeof(XvImageFormatValues));
+       
+       *count_return = 1;
+       
+       image_formats[0].id = 123;
+       image_formats[0].type = XvRGB;
+       image_formats[0].byte_order = LSBFirst;
+       image_formats[0].bits_per_pixel = 8;
+       image_formats[0].format = XvPacked;
+       image_formats[0].num_planes = 1;
+       image_formats[0].depth = 8;
+       image_formats[0].red_mask = 0x0000FF;
+       image_formats[0].green_mask = 0x00FF00;
+       image_formats[0].blue_mask = 0xFF0000;
+       image_formats[0].component_order[0] = 'R';
+       image_formats[0].component_order[0] = 'G';
+       image_formats[0].component_order[0] = 'B';
+       image_formats[0].scanline_order = XvTopToBottom;
+       
+       return image_formats;
 }
 
index 38d934383342e85603d4c753817515c568e9025b..c8f70c90d0c09f96aa5c2c511855f27e1d6799fd 100644 (file)
@@ -13,7 +13,33 @@ Status XvMCCreateSubpicture
        int xvimage_id
 )
 {
-       return BadImplementation;
+       assert(display);
+       
+       if (!context)
+               return XvMCBadContext;
+       
+       assert(subpicture);
+       
+       if (width > 2048 || height > 2048)
+               return BadValue;
+       
+       if (xvimage_id != 123)
+               return BadMatch;
+       
+       subpicture->subpicture_id = XAllocID(display);
+       subpicture->context_id = context->context_id;
+       subpicture->xvimage_id = xvimage_id;
+       subpicture->width = width;
+       subpicture->height = height;
+       subpicture->num_palette_entries = 0;
+       subpicture->entry_bytes = 0;
+       subpicture->component_order[0] = 0;
+       subpicture->component_order[1] = 0;
+       subpicture->component_order[2] = 0;
+       subpicture->component_order[3] = 0;
+       /* TODO: subpicture->privData = ;*/
+       
+       return Success;
 }
 
 Status XvMCClearSubpicture
@@ -27,7 +53,14 @@ Status XvMCClearSubpicture
        unsigned int color
 )
 {
-       return BadImplementation;
+       assert(display);
+       
+       if (!subpicture)
+               return XvMCBadSubpicture;
+       
+       /* TODO: Assert clear rect is within bounds? Or clip? */
+       
+       return Success;
 }
 
 Status XvMCCompositeSubpicture
@@ -43,17 +76,42 @@ Status XvMCCompositeSubpicture
        short dsty
 )
 {
-       return BadImplementation;
+       assert(display);
+       
+       if (!subpicture)
+               return XvMCBadSubpicture;
+       
+       assert(image);
+       
+       if (subpicture->xvimage_id != image->id)
+               return BadMatch;
+       
+       /* TODO: Assert rects are within bounds? Or clip? */
+       
+       return Success;
 }
 
 Status XvMCDestroySubpicture(Display *display, XvMCSubpicture *subpicture)
 {
+       assert(display);
+       
+       if (!subpicture)
+               return XvMCBadSubpicture;
+       
        return BadImplementation;
 }
 
 Status XvMCSetSubpicturePalette(Display *display, XvMCSubpicture *subpicture, unsigned char *palette)
 {
-       return BadImplementation;
+       assert(display);
+       
+       if (!subpicture)
+               return XvMCBadSubpicture;
+       
+       assert(palette);
+       
+       /* We don't support paletted subpictures */
+       return BadMatch;
 }
 
 Status XvMCBlendSubpicture
@@ -71,7 +129,19 @@ Status XvMCBlendSubpicture
        unsigned short surfh
 )
 {
-       return BadImplementation;
+       assert(display);
+       
+       if (!target_surface)
+               return XvMCBadSurface;
+       
+       if (!subpicture)
+               return XvMCBadSubpicture;
+       
+       if (target_surface->context_id != subpicture->context_id)
+               return BadMatch;
+       
+       /* TODO: Assert rects are within bounds? Or clip? */
+       return Success;
 }
 
 Status XvMCBlendSubpicture2
@@ -90,21 +160,56 @@ Status XvMCBlendSubpicture2
        unsigned short surfh
 )
 {
-       return BadImplementation;
+       assert(display);
+       
+       if (!source_surface || !target_surface)
+               return XvMCBadSurface;
+       
+       if (!subpicture)
+               return XvMCBadSubpicture;
+       
+       if (source_surface->context_id != subpicture->context_id)
+               return BadMatch;
+               
+       if (source_surface->context_id != subpicture->context_id)
+               return BadMatch;
+       
+       /* TODO: Assert rects are within bounds? Or clip? */
+       return Success;
 }
 
 Status XvMCSyncSubpicture(Display *display, XvMCSubpicture *subpicture)
 {
-       return BadImplementation;
+       assert(display);
+       
+       if (!subpicture)
+               return XvMCBadSubpicture;
+       
+       return Success;
 }
 
 Status XvMCFlushSubpicture(Display *display, XvMCSubpicture *subpicture)
 {
-       return BadImplementation;
+       assert(display);
+       
+       if (!subpicture)
+               return XvMCBadSubpicture;
+       
+       return Success;
 }
 
 Status XvMCGetSubpictureStatus(Display *display, XvMCSubpicture *subpicture, int *status)
 {
-       return BadImplementation;
+       assert(display);
+       
+       if (!subpicture)
+               return XvMCBadSubpicture;
+       
+       assert(status);
+       
+       /* TODO */
+       *status = 0;
+       
+       return Success;
 }
 
index a550114655ce3df755184ee146146db1da842342..1c07220e84437539fba3c4ace65f77f3b0862e80 100644 (file)
@@ -281,14 +281,23 @@ Status XvMCRenderSurface
 
 Status XvMCFlushSurface(Display *display, XvMCSurface *surface)
 {
+       assert(display);
+       
+       if (!surface)
+               return XvMCBadSurface;
+       
        /* TODO: Check display & surface match */
-       return BadImplementation;
+       return Success;
 }
 
 Status XvMCSyncSurface(Display *display, XvMCSurface *surface)
 {
-       /* TODO: Check display & surface match */
-       return BadImplementation;
+       assert(display);
+       
+       if (!surface)
+               return XvMCBadSurface;
+       
+       return Success;
 }
 
 Status XvMCPutSurface
@@ -358,7 +367,7 @@ Status XvMCGetSurfaceStatus(Display *display, XvMCSurface *surface, int *status)
        /* TODO */
        *status = 0;
        
-       return BadImplementation;
+       return Success;
 }
 
 Status XvMCDestroySurface(Display *display, XvMCSurface *surface)