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;
}
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
unsigned int color
)
{
- return BadImplementation;
+ assert(display);
+
+ if (!subpicture)
+ return XvMCBadSubpicture;
+
+ /* TODO: Assert clear rect is within bounds? Or clip? */
+
+ return Success;
}
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
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
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;
}